EgtGeomKernel :

- gestione traslazione, rotazione e cambi di frame per Voronoi
- aggiunta funzione per resettare Voronoi degli oggetti.
This commit is contained in:
SaraP
2024-03-15 16:03:51 +01:00
parent 5952eee22c
commit d253312139
13 changed files with 397 additions and 274 deletions
+37 -27
View File
@@ -162,7 +162,7 @@ CurveLine::Dump( string& sOut, bool bMM, const char* szNewLine) const
// dati generali di una curva
if ( ! CurveDump( *this, sOut, bMM, szNewLine))
return false ;
// parametri : sono già compresi nei dati generali (PS e PE)
// parametri : sono già compresi nei dati generali (PS e PE)
return true ;
}
@@ -223,7 +223,7 @@ CurveLine::GetLocalBBox( BBox3d& b3Loc, int nFlag) const
return false ;
// assegno il box in locale
b3Loc.Set( m_PtStart, m_PtEnd) ;
// se c'è estrusione, devo tenerne conto
// se c'è estrusione, devo tenerne conto
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
Point3d ptMinExtr = b3Loc.GetMin() + m_VtExtr * m_dThick ;
Point3d ptMaxExtr = b3Loc.GetMax() + m_VtExtr * m_dThick ;
@@ -241,7 +241,7 @@ CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
// verifico lo stato
if ( m_nStatus != OK)
return false ;
// verifico validità del frame
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
return false ;
// porto gli estremi nel riferimento passato
@@ -251,7 +251,7 @@ CurveLine::GetBBox( const Frame3d& frRef, BBox3d& b3Ref, int nFlag) const
ptFrEnd.ToGlob( frRef) ;
// assegno il box nel riferimento
b3Ref.Set( ptFrStart, ptFrEnd) ;
// se c'è estrusione, devo tenerne conto
// se c'è estrusione, devo tenerne conto
if ( ! m_VtExtr.IsSmall() && abs( m_dThick) > EPS_SMALL) {
Vector3d vtFrExtr = m_VtExtr ;
vtFrExtr.ToGlob( frRef) ;
@@ -390,7 +390,7 @@ CurveLine::GetLength( double& dLen) const
if ( m_nStatus != OK)
return false ;
// la lunghezza è la distanza tra gli estremi
// la lunghezza è la distanza tra gli estremi
dLen = Dist( m_PtStart, m_PtEnd) ;
return ( dLen > EPS_SMALL) ;
@@ -416,7 +416,7 @@ CurveLine::GetLengthAtParam( double dU, double& dLen) const
return true ;
}
// la lunghezza totale è la distanza tra gli estremi
// la lunghezza totale è la distanza tra gli estremi
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
// fine
@@ -448,7 +448,7 @@ CurveLine::GetParamAtLength( double dLen, double& dU) const
return true ;
}
// la lunghezza totale è la distanza tra gli estremi
// la lunghezza totale è la distanza tra gli estremi
double dTotLen = Dist( m_PtStart, m_PtEnd) ;
// se dopo fine, errore
@@ -811,8 +811,10 @@ CurveLine::Translate( const Vector3d& vtMove)
if ( m_nStatus != OK)
return false ;
// imposto ricalcolo di Voronoi
ResetVoronoiObject() ;
// traslo Voronoi
if ( m_pVoronoiObj != nullptr)
m_pVoronoiObj->Translate( vtMove) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -830,12 +832,14 @@ CurveLine::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, do
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// verifico validità dell'asse di rotazione
// verifico validità dell'asse di rotazione
if ( vtAx.IsSmall())
return false ;
// imposto ricalcolo di Voronoi
ResetVoronoiObject() ;
// ruoto Voronoi
if ( m_pVoronoiObj != nullptr)
m_pVoronoiObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -894,7 +898,7 @@ CurveLine::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// verifico validità del piano di specchiatura
// verifico validità del piano di specchiatura
if ( vtNorm.IsSmall())
return false ;
@@ -919,7 +923,7 @@ CurveLine::Shear( const Point3d& ptOn, const Vector3d& vtNorm, const Vector3d& v
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// verifico validità dei parametri
// verifico validità dei parametri
if ( vtNorm.IsSmall() || vtDir.IsSmall())
return false ;
@@ -949,16 +953,18 @@ CurveLine::ToGlob( const Frame3d& frRef)
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// verifico validità del frame
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
return false ;
// se frame identità, non devo fare alcunché
// se frame identità, non devo fare alcunché
if ( IsGlobFrame( frRef))
return true ;
// imposto ricalcolo di Voronoi
ResetVoronoiObject() ;
// trasformo Voronoi
if ( m_pVoronoiObj != nullptr)
m_pVoronoiObj->ToGlob( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -973,16 +979,18 @@ CurveLine::ToLoc( const Frame3d& frRef)
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// verifico validità del frame
// verifico validità del frame
if ( frRef.GetType() == Frame3d::ERR)
return false ;
// se frame identità, non devo fare alcunché
// se frame identità, non devo fare alcunché
if ( IsGlobFrame( frRef))
return true ;
// imposto ricalcolo di Voronoi
ResetVoronoiObject() ;
// trasformo Voronoi
if ( m_pVoronoiObj != nullptr)
m_pVoronoiObj->ToLoc( frRef) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -997,16 +1005,18 @@ CurveLine::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
// la curva deve essere validata
if ( m_nStatus != OK)
return false ;
// verifico validità dei frame
// verifico validità dei frame
if ( frOri.GetType() == Frame3d::ERR || frDest.GetType() == Frame3d::ERR)
return false ;
// se i due riferimenti coincidono, non devo fare alcunché
// se i due riferimenti coincidono, non devo fare alcunché
if ( AreSameFrame( frOri, frDest))
return true ;
// imposto ricalcolo di Voronoi
ResetVoronoiObject() ;
// trasformo Voronoi
if ( m_pVoronoiObj != nullptr)
m_pVoronoiObj->LocToLoc( frOri, frDest) ;
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
@@ -1065,7 +1075,7 @@ CurveLine::GetVoronoiObject() const
if ( m_nStatus != OK)
return nullptr ;
// se non è stato calcolato, lo calcolo
// se non è stato calcolato, lo calcolo
if ( m_pVoronoiObj == nullptr)
CalcVoronoiObject() ;