EgtGeomKernel :
- aggiunta delle coordinate U e V ai vertici delle TriMesh. Manca da modificare : - funzione MoveVertex - surfBezier.cpp quando verrà aggiunto il ramo Trim&Mesh.
This commit is contained in:
@@ -99,14 +99,14 @@ StmFromTriangleSoup::AddTriangle( const Point3d& ptP0, const Point3d& ptP1, cons
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
StmFromTriangleSoup::AddVertex( const Point3d& ptP)
|
||||
StmFromTriangleSoup::AddVertex( const Point3d& ptP, const double dU, const double dV)
|
||||
{
|
||||
// verifico se già presente
|
||||
int nId ;
|
||||
if ( m_VertGrid.Find( ptP, 2 * EPS_SMALL, nId))
|
||||
return nId ;
|
||||
// aggiungo il vertice
|
||||
if ( ( nId = m_pSTM->AddVertex( ptP)) == SVT_NULL)
|
||||
if ( ( nId = m_pSTM->AddVertex( ptP, dU, dV)) == SVT_NULL)
|
||||
return SVT_NULL ;
|
||||
m_VertGrid.InsertPoint( ptP, nId) ;
|
||||
return nId ;
|
||||
|
||||
+44
-2
@@ -107,7 +107,7 @@ SurfTriMesh::Clear( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SurfTriMesh::AddVertex( const Point3d& ptVert)
|
||||
SurfTriMesh::AddVertex( const Point3d& ptVert, const double dU, const double dV)
|
||||
{
|
||||
// imposto ricalcolo
|
||||
m_nStatus = TO_VERIFY ;
|
||||
@@ -118,7 +118,11 @@ SurfTriMesh::AddVertex( const Point3d& ptVert)
|
||||
try { m_vVert.emplace_back( ptVert) ;}
|
||||
catch(...) { return SVT_NULL ;}
|
||||
// ne determino l'indice
|
||||
return int( m_vVert.size() - 1) ;
|
||||
int nId = int( m_vVert.size() - 1) ;
|
||||
// aggiugo le coordinate corrispondenti allo spazio parametrico
|
||||
m_vVert[nId].dU = dU ;
|
||||
m_vVert[nId].dV = dV ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -475,6 +479,19 @@ SurfTriMesh::GetVertex( int nId, Point3d& ptP) const
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfTriMesh::GetVertexParam( int nId, double& dU, double& dV) const
|
||||
{
|
||||
// verifico esistenza del vertice
|
||||
if ( nId < 0 || nId >= GetVertexSize() || m_vVert[nId].nIdTria == SVT_DEL)
|
||||
return false ;
|
||||
// recupero i dati
|
||||
dU = m_vVert[nId].dU ;
|
||||
dV = m_vVert[nId].dV ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SurfTriMesh::GetFirstVertex( Point3d& ptP) const
|
||||
@@ -482,6 +499,13 @@ SurfTriMesh::GetFirstVertex( Point3d& ptP) const
|
||||
return GetNextVertex( SVT_NULL, ptP) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SurfTriMesh::GetFirstVertexParam( int nId, double& dU, double& dV) const
|
||||
{
|
||||
return GetNextVertexParam( SVT_NULL, dU, dV) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SurfTriMesh::GetNextVertex( int nId, Point3d& ptP) const
|
||||
@@ -499,6 +523,24 @@ SurfTriMesh::GetNextVertex( int nId, Point3d& ptP) const
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
SurfTriMesh::GetNextVertexParam( int nId, double& dU, double& dV) const
|
||||
{
|
||||
// cerco il primo successivo valido
|
||||
do {
|
||||
nId ++ ;
|
||||
} while ( nId < GetVertexSize() && m_vVert[nId].nIdTria == SVT_DEL) ;
|
||||
// se oltrepassata fine
|
||||
if ( nId >= GetVertexSize())
|
||||
return SVT_NULL ;
|
||||
// recupero i dati
|
||||
dU = m_vVert[nId].dU ;
|
||||
dV = m_vVert[nId].dV ;
|
||||
// ritorno indice triangolo corrente
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfTriMesh::GetTriangle( int nId, int nIdVert[3]) const
|
||||
|
||||
+11
-4
@@ -28,11 +28,15 @@ class SurfFlatRegion ;
|
||||
class StmVert
|
||||
{
|
||||
public :
|
||||
StmVert( void) : ptP(), nIdTria( SVT_NULL), nFlag( 0), nTemp( 0) {}
|
||||
StmVert( const Point3d& ptQ) : ptP( ptQ), nIdTria( SVT_NULL), nFlag( 0), nTemp( 0) {}
|
||||
StmVert( const Point3d& ptQ, int nIdT, int nF) : ptP( ptQ), nIdTria( nIdT), nFlag( nF), nTemp( 0) {}
|
||||
StmVert( void) : ptP(), nIdTria( SVT_NULL), nFlag( 0), nTemp( 0), dU( -1), dV( -1) {}
|
||||
StmVert( const Point3d& ptQ) : ptP( ptQ), nIdTria( SVT_NULL), nFlag( 0), nTemp( 0), dU( -1), dV( -1) {}
|
||||
StmVert( const Point3d& ptQ, int nIdT, int nF) : ptP( ptQ), nIdTria( nIdT), nFlag( nF), nTemp( 0), dU( -1), dV( -1) {}
|
||||
public :
|
||||
Point3d ptP ;
|
||||
double dU ; // parametro riferito alle coordinate del punto nello spazio parametrico ( nSpanU x nSpanV)
|
||||
// della sup di Bezier // -1 se non definito
|
||||
double dV ; // parametro riferito alle coordinate del punto nello spazio parametrico ( nSpanU x nSpanV)
|
||||
// della sup di Bezier // -1 se non definito
|
||||
int nIdTria ;
|
||||
int nFlag ;
|
||||
mutable int nTemp ;
|
||||
@@ -215,7 +219,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
{ m_dSmoothAng = std::max( dSmoothAngDeg, EPS_ANG_SMALL) ;
|
||||
m_dCosSmAng = cos( m_dSmoothAng * DEGTORAD) ;
|
||||
m_OGrMgr.Reset() ; }
|
||||
int AddVertex( const Point3d& ptVert) override ;
|
||||
int AddVertex( const Point3d& ptVert, const double dU = -1 , const double dV = -1) override ;
|
||||
bool MoveVertex( int nInd, const Point3d& ptNewVert) override ;
|
||||
int AddTriangle( const int nIdVert[3], int nTFlag = 0) override ;
|
||||
bool RemoveTriangle( int nId) override ;
|
||||
@@ -244,8 +248,11 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW
|
||||
double GetSmoothAngle( void) const override
|
||||
{ return m_dSmoothAng ; }
|
||||
bool GetVertex( int nId, Point3d& ptP) const override ;
|
||||
bool GetVertexParam( int nId, double& dU, double& dV) const override ;
|
||||
int GetFirstVertex( Point3d& ptP) const override ;
|
||||
int GetFirstVertexParam( int nId, double& dU, double& dV) const override ;
|
||||
int GetNextVertex( int nId, Point3d& ptP) const override ;
|
||||
int GetNextVertexParam( int nId, double& dU, double& dV) const override ;
|
||||
bool GetTriangle( int nId, int nIdVert[3]) const override ;
|
||||
int GetFirstTriangle( int nIdVert[3]) const override ;
|
||||
int GetNextTriangle( int nId, int nIdVert[3]) const override ;
|
||||
|
||||
Reference in New Issue
Block a user