EgtGeomKernel :

- correzioni e migliorie alla triangolazione con le bezier.
This commit is contained in:
Daniele Bariletti
2024-08-02 15:12:35 +02:00
parent 2710f735d1
commit f0bfbb6c85
3 changed files with 337 additions and 307 deletions
+5 -10
View File
@@ -1600,11 +1600,6 @@ SurfBezier::GetApproxSurf( double dTol, double dSideMin) const
}
}
// conto quanti punti ho in totale, senza eliminare le ripetizioni
int nTotPnt = 0 ;
for ( PolyLine& pl2D : vPL)
nTotPnt+= pl2D.GetPointNbr() ;
// se ho ottenuto meno triangoli di quelli che avrei dovuto avere allora potrei aver avuto un problema in prossimità di un polo
// se comunque ho corrispondenza tra vPnt e vPnt3d allora eseguo la trinagolazione in 3d
int nTriaNumber = ( vPnt.size() - 2) + (2 * (vPL.size() - 1)) - (vPL.size() > 2 ? vPL.size() - 2 : 0) - (vPL.size() != 1 ? vPL.size() : 0) ;
@@ -1713,7 +1708,6 @@ SurfBezier::GetApproxSurf( double dTol, double dSideMin) const
bool
SurfBezier::ReorderPntVector( const POLYLINEVECTOR& vPL, bool bTriangulatedIn3D, const PNTVECTOR& vPnt, const POLYLINEVECTOR& vPLToOrd, PNTVECTOR& vPntOrd) const
{
int nCurrPoint = 0 ;
BOOLVECTOR vbPolyChecked( vPL.size()) ;
fill( vbPolyChecked.begin(), vbPolyChecked.end(), false) ;
for ( int p = 0 ; p < int(vPnt.size()) ; ++p) {
@@ -4152,6 +4146,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
}
// reinizializzo la superficie con il nuovo numero di span in U
nSpanU = nSpanU0 + nRep1 ;
if( nSpanU != nSpanU1 + nRep0)
LOG_DBG_ERR( GetEGkLogger(), "There could be an errore in the creation of a ruled surface in mode RLT_B_MINDIST") ;
if ( nSpanU < max(nSpanU0, nSpanU1))
nSpanU = max(nSpanU0, nSpanU1) ;
nSecondRowInd = nDegU * nSpanU + 1 ;
@@ -4413,7 +4409,6 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
int nAtEnd1 = 0 ;
Point3d ptP0 ; plU0.GetFirstPoint( ptP0) ;
int c = 0 ;
int nCrvCount = 0 ;
int nRep0 = 0 ; // match interni consecutivi uguali di punti della curva U0 con punti della curva U1
int nRep1 = 0 ;
double dLastParamMatch = 0 ;
@@ -4453,7 +4448,6 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
else {
dLastParamMatch = dParam ;
ptLastPointMatch = ptJoint ;
nCrvCount = pCrvU1->GetCurveCount() ;
// se sono già troppo vicino ad un split esistente allora non faccio nulla
if ( abs(dParam - round( dParam)) < 100 * EPS_PARAM) {
++c ;
@@ -4527,7 +4521,6 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
else {
dLastParamMatch = dParam ;
ptLastPointMatch = ptJoint ;
nCrvCount = pCrvU0->GetCurveCount() ;
//se sono troppo vicino ad uno split esistente allora non faccio nulla
if( abs(dParam - round( dParam)) < 100 * EPS_PARAM) {
++c ;
@@ -4660,6 +4653,9 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
// ( numero di sottocurve che compongono la U0 + tutte le ripetizioni dei match di punti della curva U1 con i punti di U0)
nSpanU = nSpanU0 + nAtStart0 + nAtEnd0 + nRep1 ;
if( nSpanU != nSpanU1 + nAtStart1 + nAtEnd1 + nRep0)
LOG_DBG_ERR( GetEGkLogger(), "There could be an error in the creation of a ruled surface in mode RLT_B_MINDIST_PLUS") ;
nSecondRowInd = nDegU * nSpanU + 1 ;
// inizializzo la superficie
Init( nDegU, nDegV, nSpanU, nSpanV, bRat) ;
@@ -4912,7 +4908,6 @@ SurfBezier::CreateBySetOfCurves( const ICURVEPOVECTOR& vCrvBez)
}
SetControlPoint( n + (s * nDegU) + (nDegU * nSpanU + 1) * (g * 3 + 6), ptCtrl2) ;
//// trovo i punti di controllo intermedi tra le curve usando la parabola che unisce queste tre curve////
double dPar = double(n) / nDegU ;
Point3d ptP0 = pCrv0->GetControlPoint( n) ;
Point3d ptP1 = pCrv1->GetControlPoint( n) ;
Point3d ptP2 = pCrv2->GetControlPoint( n) ;
+331 -297
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -218,6 +218,7 @@ class Cell
std::vector<Inters> m_vInters ; // vettore delle intersezioni della cella con i loop di trim
// ogni elemento del vettore è l'insieme dei punti che caratterizza un attraversamento della cella
int m_nVertToErase ; // vertice da eliminare dal poligono della cella, in caso di lato sovrapposto ad un lato di polo
// contati in senso CCW a partire dal bottom left
private :
Point3d m_ptPbl ; // punto bottom left