EgtGeomKernel :

- aggiunta delle coordintae U e V ai vertici delle TriMesh.
This commit is contained in:
Daniele Bariletti
2023-10-02 14:55:04 +02:00
parent 381a137604
commit eccf683ef4
3 changed files with 78 additions and 27 deletions
+48 -5
View File
@@ -107,18 +107,22 @@ SurfTriMesh::Clear( void)
//----------------------------------------------------------------------------
int
SurfTriMesh::AddVertex( const Point3d& ptVert)
SurfTriMesh::AddVertex( const Point3d& ptVert, const double dU, const double dV)
{
// imposto ricalcolo
// imposto ricalcolo
m_nStatus = TO_VERIFY ;
m_nParts = - 1 ;
m_OGrMgr.Reset() ;
ResetHashGrids3d() ;
// inserisco il vertice
// inserisco il vertice
try { m_vVert.emplace_back( ptVert) ;}
catch(...) { return SVT_NULL ;}
// ne determino l'indice
return int( m_vVert.size() - 1) ;
// ne determino l'indice
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,20 @@ 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 +500,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 +524,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