EgtGeomKernel 1.6b3 :
- aggiunta gestione buchi alle triangolazione di poligoni - creazione suerfici trimesh da regioni con buchi.
This commit is contained in:
+39
-2
@@ -75,7 +75,7 @@ SurfTriMesh::AddVertex( const Point3d& ptVert)
|
||||
m_nStatus = TO_VERIFY ;
|
||||
m_OGrMgr.Reset() ;
|
||||
// inserisco il vertice
|
||||
try { m_vVert.push_back( StmVert( ptVert)) ;}
|
||||
try { m_vVert.emplace_back( ptVert) ;}
|
||||
catch(...) { return SVT_NULL ;}
|
||||
// ne determino l'indice
|
||||
return int( m_vVert.size() - 1) ;
|
||||
@@ -138,7 +138,7 @@ SurfTriMesh::AddTriangle( const int nIdVert[3])
|
||||
m_nStatus = TO_VERIFY ;
|
||||
m_OGrMgr.Reset() ;
|
||||
// inserisco il triangolo
|
||||
try { m_vTria.push_back( StmTria( nIdVert)) ;}
|
||||
try { m_vTria.emplace_back( nIdVert) ;}
|
||||
catch(...) { return SVT_NULL ;}
|
||||
// ne determino l'indice
|
||||
return int( m_vTria.size() - 1) ;
|
||||
@@ -871,6 +871,43 @@ SurfTriMesh::CreateByFlatContour( const PolyLine& PL)
|
||||
return AdjustTopology() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfTriMesh::CreateByRegion( const POLYLINEVECTOR& vPL)
|
||||
{
|
||||
// eseguo la triangolazione, dopo aver verificato che l'insieme di contorni costituisca una regione
|
||||
PNTVECTOR vPnt ;
|
||||
INTVECTOR vTria ;
|
||||
Triangulate Tri ;
|
||||
if ( ! Tri.Make( vPL, vPnt, vTria))
|
||||
return false ;
|
||||
|
||||
// inizializzo la superficie
|
||||
int nVert = int( vPnt.size()) ;
|
||||
int nTria = int( vTria.size()) / 3 ;
|
||||
if ( ! Init( nVert, nTria))
|
||||
return false ;
|
||||
|
||||
// inserisco i vertici nella superficie
|
||||
for ( int i = 0 ; i < int( vPnt.size()) ; ++ i) {
|
||||
if ( AddVertex( vPnt[i]) == SVT_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// recupero i triangoli e li inserisco nella superficie
|
||||
int vV[3] ;
|
||||
for ( int i = 0 ; i < nTria ; ++i) {
|
||||
vV[0] = vTria[3*i] ;
|
||||
vV[1] = vTria[3*i+1] ;
|
||||
vV[2] = vTria[3*i+2] ;
|
||||
if ( AddTriangle( vV) == SVT_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// compatto e sistemo la topologia
|
||||
return AdjustTopology() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfTriMesh::CreateByExtrusion( const PolyLine& PL, const Vector3d& vtExtr)
|
||||
|
||||
Reference in New Issue
Block a user