EgtGeomKernel :

- miglioramenti alla triangolazione delle bezier.
This commit is contained in:
Daniele Bariletti
2024-07-24 10:13:45 +02:00
parent 89c22ffd06
commit c3e7d3d8c7
+36 -11
View File
@@ -1651,13 +1651,14 @@ Tree::GetPolygons( POLYLINEMATRIX& vvPolygons, bool bForTriangulation, POLYLINEM
vvPolygons.push_back( vCellPolygons) ;
if ( bForTriangulation ) {
POLYLINEVECTOR vCellPolygons3d ;
PolyLine plPolygon3d ;
plPolygon3d.AddUPoint( 0, m_mVert[nId][0]) ;
plPolygon3d.AddUPoint( 1, m_mVert[nId][1]) ;
plPolygon3d.AddUPoint( 2, m_mVert[nId][2]) ;
plPolygon3d.AddUPoint( 3, m_mVert[nId][3]) ;
plPolygon3d.AddUPoint( 0, m_mVert[nId][0]) ;
vCellPolygons3d.push_back( plPolygon3d) ;
//PolyLine plPolygon3d ;
//plPolygon3d.AddUPoint( 0, m_mVert[nId][0]) ;
//plPolygon3d.AddUPoint( 1, m_mVert[nId][1]) ;
//plPolygon3d.AddUPoint( 2, m_mVert[nId][2]) ;
//plPolygon3d.AddUPoint( 3, m_mVert[nId][3]) ;
//plPolygon3d.AddUPoint( 0, m_mVert[nId][0]) ;
//vCellPolygons3d.push_back( plPolygon3d) ;
vCellPolygons3d.push_back( vPolygonsBasic3d[i]) ;
vvPolygons3d.push_back( vCellPolygons3d) ;
}
}
@@ -1887,7 +1888,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon
// ora devo controllare se uno dei lati della cella è collassato in un punto.
// se così, devo guardare se sui due lati adiacenti a quello di polo ho messo dei punti extra
// se ne ho messi solo su uno dei due allora devo togliere il vertice dell'altro lato
if ( AreSamePointApprox(m_mVert.at(nId).at(0), m_mVert.at(nId).at(1)) && ( vbBonusVert[1] || vbBonusVert[3] ) ) {
if ( AreSamePointApprox(m_mVert.at(nId).at(0), m_mVert.at(nId).at(1))) {
// se ho punti bonus su entrambi i lati non devo fare nulla
if ( !( vbBonusVert[1] && vbBonusVert[3] ) ) {
// sennò devo togliere l'estremo del lato su cui NON ho punti bonus
@@ -1911,9 +1912,15 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon
vbKeepPoint.back() = false ;
m_mTree[nId].m_nVertToErase = 0 ; // ptBL
}
// se non ho bonus su nessuno dei due
else {
// ne scelgo uno dei due da togliere
vbKeepPoint[vnVert[1]] = false ;
m_mTree[nId].m_nVertToErase = 1 ; // ptBr
}
}
}
if ( AreSamePointApprox(m_mVert.at(nId).at(1), m_mVert.at(nId).at(2)) && ( vbBonusVert[0] || vbBonusVert[2] ) ) {
if ( AreSamePointApprox(m_mVert.at(nId).at(1), m_mVert.at(nId).at(2))) {
// se ho punti bonus su entrambi i lati non devo fare nulla
if ( !( vbBonusVert[0] && vbBonusVert[2] ) ) {
// sennò devo togliere l'estremo del lato su cui NON ho punti bonus
@@ -1933,9 +1940,15 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon
vbKeepPoint[vnVert[2]] = false ;
m_mTree[nId].m_nVertToErase = 2 ; // ptTR
}
// se non ho bonus su nessuno dei due
else {
// ne scelgo uno dei due da togliere
vbKeepPoint[vnVert[2]] = false ;
m_mTree[nId].m_nVertToErase = 2 ; // ptTR
}
}
}
if ( AreSamePointApprox(m_mVert.at(nId).at(2), m_mVert.at(nId).at(3)) && ( vbBonusVert[1] || vbBonusVert[3] ) ) {
if ( AreSamePointApprox(m_mVert.at(nId).at(2), m_mVert.at(nId).at(3))) {
// se ho punti bonus su entrambi i lati non devo fare nulla
if ( !( vbBonusVert[1] && vbBonusVert[3] ) ) {
// sennò devo togliere l'estremo del lato su cui NON ho punti bonus
@@ -1955,9 +1968,15 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon
vbKeepPoint[vnVert[3]] = false ;
m_mTree[nId].m_nVertToErase = 3 ; // ptTl
}
// se non ho bonus su nessuno dei due
else {
// ne scelgo uno dei due da togliere
vbKeepPoint[vnVert[3]] = false ;
m_mTree[nId].m_nVertToErase = 3 ; // ptTl
}
}
}
if ( AreSamePointApprox(m_mVert.at(nId).at(3), m_mVert.at(nId).at(0)) && ( vbBonusVert[0] || vbBonusVert[2] ) ) {
if ( AreSamePointApprox(m_mVert.at(nId).at(3), m_mVert.at(nId).at(0))) {
// se ho punti bonus su entrambi i lati non devo fare nulla
if ( !( vbBonusVert[0] && vbBonusVert[2] ) ) {
// sennò devo togliere l'estremo del lato su cui NON ho punti bonus
@@ -1981,6 +2000,12 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon
vbKeepPoint[vnVert[3]] = false ;
m_mTree[nId].m_nVertToErase = 3 ; // ptTl
}
// se non ho bonus su nessuno dei due
else {
// ne scelgo uno dei due da togliere
vbKeepPoint[vnVert[3]] = false ;
m_mTree[nId].m_nVertToErase = 3 ; // ptTl
}
}
}
}