EgtGeomKernel :
- prima versione delle superfici trimesh.
This commit is contained in:
+6
-6
@@ -197,17 +197,17 @@ bool
|
||||
CurveArc::Save( ostream& osOut) const
|
||||
{
|
||||
// centro
|
||||
osOut << ToString( m_PtCen) ;
|
||||
osOut << ToString( m_PtCen) << ";" ;
|
||||
// versore Normale
|
||||
osOut << ";" << ToString( m_VtN) ;
|
||||
osOut << ToString( m_VtN) << ";" ;
|
||||
// raggio
|
||||
osOut << ";" << ToString( m_dRad) ;
|
||||
osOut << ToString( m_dRad) << ";" ;
|
||||
// versore Iniziale
|
||||
osOut << ";" << ToString( m_VtS) ;
|
||||
osOut << ToString( m_VtS) << ";" ;
|
||||
// angolo al centro
|
||||
osOut << ";" << ToString( m_dAngCenDeg) ;
|
||||
osOut << ToString( m_dAngCenDeg) << ";" ;
|
||||
// deltaN
|
||||
osOut << ";" << ToString( m_dDeltaN) << ";" << endl ;
|
||||
osOut << ToString( m_dDeltaN) << ";" << endl ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+2
-2
@@ -342,9 +342,9 @@ bool
|
||||
CurveBezier::Save( ostream& osOut) const
|
||||
{
|
||||
// flag razionale
|
||||
osOut << m_bRat ;
|
||||
osOut << ToString( m_bRat) << ";" ;
|
||||
// grado
|
||||
osOut << ";" << ToString( m_nDeg) << ";" << endl ;
|
||||
osOut << ToString( m_nDeg) << ";" << endl ;
|
||||
// ciclo sui punti di controllo ( con pesi se razionale)
|
||||
for ( int i = 0 ; i <= m_nDeg ; ++ i) {
|
||||
if ( ! m_bRat)
|
||||
|
||||
+2
-2
@@ -115,8 +115,8 @@ bool
|
||||
CurveLine::Save( ostream& osOut) const
|
||||
{
|
||||
// parametri : punti iniziale e finale
|
||||
osOut << ToString( m_PtStart) ;
|
||||
osOut << ";" << ToString( m_PtEnd) << ";" << endl ;
|
||||
osOut << ToString( m_PtStart) << ";";
|
||||
osOut << ToString( m_PtEnd) << ";" << endl ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -263,12 +263,7 @@ copy $(TargetPath) \EgtProg\Dll64</Command>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StringUtils3d.cpp" />
|
||||
<ClCompile Include="SurfTriMesh.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SurfTriMesh.cpp" />
|
||||
<ClCompile Include="Vector3d.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
+4
-4
@@ -256,10 +256,10 @@ GeomDB::SaveHeader( ostream& osOut) const
|
||||
osOut << "MAT_DEF" << endl ;
|
||||
Color colDef( 0, 0, 0, 0) ;
|
||||
GetDefaultMaterial( colDef) ;
|
||||
osOut << ToString( colDef.GetIntRed()) ;
|
||||
osOut << "," << ToString( colDef.GetIntGreen()) ;
|
||||
osOut << "," << ToString( colDef.GetIntBlue()) ;
|
||||
osOut << "," << ToString( colDef.GetIntAlpha()) << ";" << endl ;
|
||||
osOut << ToString( colDef.GetIntRed()) << "," ;
|
||||
osOut << ToString( colDef.GetIntGreen()) << "," ;
|
||||
osOut << ToString( colDef.GetIntBlue()) << "," ;
|
||||
osOut << ToString( colDef.GetIntAlpha()) << ";" << endl ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
+345
-1125
File diff suppressed because it is too large
Load Diff
+59
-34
@@ -14,9 +14,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "ObjGraphicsMgr.h"
|
||||
#include "DllMain.h"
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include <vector>
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const int VT_NULL = - 1 ; // vertice o triangolo nullo
|
||||
const int VT_DEL = - 2 ; // vertice o triangolo cancellato
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class StmVert
|
||||
{
|
||||
public :
|
||||
StmVert( void) : ptP(), nIdTria( VT_NULL), nFlag( 0) {}
|
||||
StmVert( const Point3d& ptQ) : ptP( ptQ), nIdTria( VT_NULL), nFlag( 0) {}
|
||||
StmVert( const Point3d& ptQ, int nIdT, int nF) : ptP( ptQ), nIdTria( nIdT), nFlag( nF) {}
|
||||
public :
|
||||
Point3d ptP ;
|
||||
int nIdTria ;
|
||||
int nFlag ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class StmTria
|
||||
{
|
||||
public :
|
||||
StmTria( void) : vtN(), nTFlag( 0), nEFlag( 0)
|
||||
{ nIdVert[0] = VT_NULL ; nIdVert[1] = VT_NULL ; nIdVert[2] = VT_NULL ;
|
||||
nIdAdjac[0] = VT_NULL ; nIdAdjac[1] = VT_NULL ; nIdAdjac[2] = VT_NULL ; }
|
||||
StmTria( const int nIdV[3]) : vtN(), nTFlag( 0), nEFlag( 0)
|
||||
{ nIdVert[0] = nIdV[0] ; nIdVert[1] = nIdV[1] ; nIdVert[2] = nIdV[2] ;
|
||||
nIdAdjac[0] = VT_NULL ; nIdAdjac[1] = VT_NULL ; nIdAdjac[2] = VT_NULL ; }
|
||||
StmTria( const int nIdV[3], const int nIdA[3], const Vector3d& vtV, int nTF, int nEF)
|
||||
: vtN( vtV), nTFlag( nTF), nEFlag( nEF)
|
||||
{ nIdVert[0] = nIdV[0] ; nIdVert[1] = nIdV[1] ; nIdVert[2] = nIdV[2] ;
|
||||
nIdAdjac[0] = nIdA[0] ; nIdAdjac[1] = nIdA[1] ; nIdAdjac[2] = nIdA[2] ; }
|
||||
public :
|
||||
int nIdVert[3] ;
|
||||
int nIdAdjac[3] ;
|
||||
Vector3d vtN ;
|
||||
int nTFlag ;
|
||||
int nEFlag ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class SurfTriMesh : public ISurfTriMesh
|
||||
{
|
||||
@@ -56,53 +96,38 @@ class SurfTriMesh : public ISurfTriMesh
|
||||
{ return m_bClosed ; }
|
||||
|
||||
public : // ISurfTriMesh
|
||||
virtual bool Copy( const IGeoObj* pGObjSrc) ;
|
||||
virtual bool Init( int nNumVert, int nNumTria) ;
|
||||
virtual bool AddVertex( const Point3d& ptVert) ;
|
||||
virtual bool AddVertex( const Point3d& ptVert, int nTria, int nFlag) ;
|
||||
virtual bool AddTriangle(
|
||||
|
||||
virtual const Point3d& GetControlPoint( int nInd, bool* pbOk = NULL) const ;
|
||||
virtual double GetControlWeight( int nInd, bool* pbOk = NULL) const ;
|
||||
virtual bool GetControlPolygonLength( double& dLen) const ;
|
||||
virtual int GetSingularParam( double& dPar) const ;
|
||||
virtual int AddVertex( const Point3d& ptVert) ;
|
||||
virtual int AddTriangle( const int nIdVert[3]) ;
|
||||
virtual int GetFirstTriangle( Point3d& ptP0, Point3d& ptP1, Point3d& ptP2) const ;
|
||||
virtual int GetNextTriangle( int nId, Point3d& ptP0, Point3d& ptP1, Point3d& ptP2) const ;
|
||||
|
||||
public :
|
||||
SurfTriMesh( void) ;
|
||||
const SurfTriMesh& operator =( const SurfTriMesh& stSrc)
|
||||
{ if ( &stSrc != this && Init( m_vVert.size(), m_vTria.size())) {
|
||||
m_nStatus = stSrc.m_nStatus ;
|
||||
m_bClosed = stSrc.m_bClosed ;
|
||||
m_vVert = stSrc.m_vVert ;
|
||||
m_vTria = stSrc.m_vTria ;
|
||||
}
|
||||
return *this ; }
|
||||
{ if ( ! Copy( stSrc))
|
||||
LOG_ERROR( GetEGkLogger(), "SurfTriMesh : copy error")
|
||||
return *this ; }
|
||||
|
||||
private :
|
||||
bool Copy( const SurfTriMesh& clSrc) ;
|
||||
bool Validate( void) ;
|
||||
bool SetVertex( int nInd, const StmVert& vV) ;
|
||||
bool SetTriangle( int nInd, const StmTria& tT) ;
|
||||
int GetVertexNum( void) const
|
||||
{ return int( m_vVert.size()) ; }
|
||||
int GetTriangleNum( void) const
|
||||
{ return int( m_vTria.size()) ; }
|
||||
bool CalcTriangleNormal( int nT) ;
|
||||
bool InvertTriangle( int nT) ;
|
||||
|
||||
private :
|
||||
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
|
||||
|
||||
private :
|
||||
class Vertex {
|
||||
public :
|
||||
Vertex( void) : ptP(), nIdTria( 0), nFlag( 0) {}
|
||||
Vertex( const Point3d& ptQ, int nIdT, int nF) : ptP( ptQ), nIdTria( nIdT), nFlag( nF) {}
|
||||
public :
|
||||
Point3d ptP ;
|
||||
int nIdTria ;
|
||||
int nFlag ;
|
||||
} ;
|
||||
class Tria {
|
||||
public :
|
||||
int nIdVert[3] ;
|
||||
int nIdAdjac[3] ;
|
||||
Vector3d vtN ;
|
||||
int nFlag ;
|
||||
int nAux ;
|
||||
} ;
|
||||
typedef std::vector<Vertex> VERTVECTOR ;
|
||||
typedef std::vector<Tria> TRIAVECTOR ;
|
||||
typedef std::vector<StmVert> VERTVECTOR ;
|
||||
typedef std::vector<StmTria> TRIAVECTOR ;
|
||||
|
||||
private :
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
|
||||
Reference in New Issue
Block a user