EgtGeomKernel 1.6b4 :
- SurfTM aggiunta GetTriangleBoundaryEdges per classificare edge di poligoni.
This commit is contained in:
Binary file not shown.
@@ -40,5 +40,7 @@ const double BEZARC_ANG_CEN_MAX = 90 ;
|
||||
//----------------- Costanti per superfici TriMesh ---------------------------
|
||||
// tolleranza lineare standard
|
||||
const double STM_STD_LIN_TOL = 0.1 ;
|
||||
// angolo limite per definire un edge che è contorno di poligono
|
||||
const double STM_STD_BOUNDARY_ANG = 0.1 ;
|
||||
// angolo limite per mediare le normali in un vertice
|
||||
const double STM_STD_SMOOTH_ANG = 25.0 ;
|
||||
|
||||
+3
-3
@@ -71,9 +71,9 @@ class GeoObjFactory
|
||||
typedef IGeoObj* ( *GeoCreator) ( void) ;
|
||||
// per registrare le funzioni di creazione
|
||||
static bool Register( int nKey, std::string sKey, int nNgeId, GeoCreator Creator)
|
||||
{ return GetKeyTypeMap().insert( std::pair< std::string, int>( sKey, nKey)).second &&
|
||||
GetNgeIdTypeMap().insert( std::pair< int, int>( nNgeId, nKey)).second &&
|
||||
GetCreatorMap().insert( std::pair< int, GeoCreator>( nKey, Creator)).second ; }
|
||||
{ return GetKeyTypeMap().emplace( sKey, nKey).second &&
|
||||
GetNgeIdTypeMap().emplace( nNgeId, nKey).second &&
|
||||
GetCreatorMap().emplace( nKey, Creator).second ; }
|
||||
// per restituire il tipo data la chiave
|
||||
static int KeyToType( std::string sKey)
|
||||
{ KeyTypeMap::iterator Iter = GetKeyTypeMap().find( sKey) ;
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class IdManager
|
||||
bool AddObj( int nId, GdbObj* pGObj)
|
||||
{ if ( nId > m_nMaxId)
|
||||
m_nMaxId = nId ;
|
||||
return m_GdbIdMap.insert( INTPGDBO_UMAP::value_type( nId, pGObj)).second ; }
|
||||
return m_GdbIdMap.emplace( nId, pGObj).second ; }
|
||||
bool RemoveObj( int nId)
|
||||
{ m_GdbIdMap.erase( nId) ;
|
||||
if ( nId == m_nMaxId && m_nMaxId > 0)
|
||||
|
||||
+23
-3
@@ -32,9 +32,10 @@ GEOOBJ_REGISTER( SRF_TRIMESH, NGE_S_TRM, SurfTriMesh) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
SurfTriMesh::SurfTriMesh( void)
|
||||
: m_nStatus( TO_VERIFY), m_dLinTol( STM_STD_LIN_TOL), m_dSmoothAng( STM_STD_SMOOTH_ANG),
|
||||
m_bClosed( false), m_nTempProp()
|
||||
: m_nStatus( TO_VERIFY), m_dLinTol( STM_STD_LIN_TOL), m_dBoundaryAng( STM_STD_BOUNDARY_ANG),
|
||||
m_dSmoothAng( STM_STD_SMOOTH_ANG), m_bClosed( false), m_nTempProp()
|
||||
{
|
||||
m_dCosBndAng = cos( m_dBoundaryAng * DEGTORAD) ;
|
||||
m_dCosSmAng = cos( m_dSmoothAng * DEGTORAD) ;
|
||||
}
|
||||
|
||||
@@ -278,12 +279,31 @@ SurfTriMesh::GetNextTriangle( int nId, Triangle3d& Tria) const
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfTriMesh::GetTriangleBoundaryEdges( int nId, TriFlags3d& TFlags) const
|
||||
{
|
||||
// verifico esistenza del triangolo
|
||||
if ( nId < 0 || nId >= GetTriangleSize() || m_vTria[nId].nIdVert[0] == SVT_DEL)
|
||||
return false ;
|
||||
|
||||
// verifico i tre lati
|
||||
for ( int i = 0 ; i < 3 ; ++ i) {
|
||||
// indice triangolo adiacente al lato
|
||||
int nT = m_vTria[nId].nIdAdjac[i] ;
|
||||
// se non c'è triangolo adiacente o se forma un angolo oltre il limite, il lato è un contorno
|
||||
TFlags.bFlag[i] = ( nT == SVT_NULL || m_vTria[nId].vtN * m_vTria[nT].vtN < m_dCosBndAng) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfTriMesh::GetTriangleSmoothNormals( int nId, TriNormals3d& TNrms) const
|
||||
{
|
||||
// verifico esistenza del triangolo
|
||||
if ( nId >= GetTriangleSize() || m_vTria[nId].nIdVert[0] == SVT_DEL)
|
||||
if ( nId < 0 || nId >= GetTriangleSize() || m_vTria[nId].nIdVert[0] == SVT_DEL)
|
||||
return false ;
|
||||
|
||||
// recupero le normali di ciascun vertice
|
||||
|
||||
+9
-2
@@ -101,6 +101,10 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
virtual bool Init( int nNumVert, int nNumTria) ;
|
||||
virtual void SetLinearTolerance( double dLinTol)
|
||||
{ m_dLinTol = std::max( dLinTol, EPS_SMALL) ; }
|
||||
virtual void SetBoundaryAngle( double dBoundaryAngDeg)
|
||||
{ m_dBoundaryAng = std::max( dBoundaryAngDeg, EPS_ANG_SMALL) ;
|
||||
m_dCosBndAng = cos( m_dBoundaryAng * DEGTORAD) ;
|
||||
m_OGrMgr.Reset() ; }
|
||||
virtual void SetSmoothAngle( double dSmoothAngDeg)
|
||||
{ m_dSmoothAng = std::max( dSmoothAngDeg, EPS_ANG_SMALL) ;
|
||||
m_dCosSmAng = cos( m_dSmoothAng * DEGTORAD) ;
|
||||
@@ -133,7 +137,8 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
virtual int GetFirstTriangle( int nIdVert[3]) const ;
|
||||
virtual int GetNextTriangle( int nId, int nIdVert[3]) const ;
|
||||
virtual int GetFirstTriangle( Triangle3d& Tria) const ;
|
||||
virtual int GetNextTriangle( int nId, Triangle3d& Tria) const ;
|
||||
virtual int GetNextTriangle( int nId, Triangle3d& Tria) const ;
|
||||
virtual bool GetTriangleBoundaryEdges( int nId, TriFlags3d& TFlags) const ;
|
||||
virtual bool GetTriangleSmoothNormals( int nId, TriNormals3d& TNrms) const ;
|
||||
|
||||
public : // IGeoObjRW
|
||||
@@ -185,8 +190,10 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
|
||||
Status m_nStatus ; // stato
|
||||
double m_dLinTol ; // tolleranza lineare di costruzione
|
||||
double m_dBoundaryAng ; // angolo limite per considerare un lato un contorno (in gradi)
|
||||
double m_dCosBndAng ; // coseno dell'angolo limite per considerare un lato un contorno
|
||||
double m_dSmoothAng ; // angolo limite per mediare le normali (in gradi)
|
||||
double m_dCosSmAng ; // coseno dell'angolo precedente
|
||||
double m_dCosSmAng ; // coseno dell'angolo limite per mediare le normali
|
||||
bool m_bClosed ; // la superficie racchiude un volume
|
||||
VERTVECTOR m_vVert ; // vettore dei vertici
|
||||
TRIAVECTOR m_vTria ; // vettore dei triangoli
|
||||
|
||||
Reference in New Issue
Block a user