EgtGeomKernel :

- corretti bug di identificazione EdgeIn e EdgeOut nel tracing dei loop
di trim di sup. di Bezier.
This commit is contained in:
Daniele Bariletti
2024-02-01 17:30:42 +01:00
parent 46dbd17d7b
commit 7043b2b318
+76 -26
View File
@@ -2166,8 +2166,24 @@ Tree::FindInters( int& nId, const CurveLine& clTrim, PNTVECTOR& vptInters, bool
// determino il lato/vertice di uscita
OnWhichEdge( nId, ptInters, nEdge) ;
m_mTree[nId].m_vInters.back().nOut = nEdge ;
if ( (int)vptInters.size() == 0 || ! AreSamePointExact( ptInters , vptInters.back()))
// se è risultato che sono abbastanza vicino( di EPS_SMALL) ad un vertice allora il punto aggiunto sarà il vertice vero e proprio
if ( nEdge == 4)
ptInters = ptTl ;
else if ( nEdge == 5)
ptInters = ptBL ;
else if ( nEdge == 6)
ptInters = ptBr ;
else if ( nEdge == 7)
ptInters = ptTR ;
// aggiungo il nuovo punto al vettore delle intersezioni
if ( (int)vptInters.size() == 0 || ! AreSamePointApprox( ptInters , vptInters.back()))
vptInters.push_back( ptInters) ;
else {
// se l'ultimo punto del vettore delle intersezioni è quasi uguale al punto che devo aggiungere allora lo sostituisco con quest'ultimo
vptInters.pop_back() ;
vptInters.push_back( ptInters) ;
}
// salvo il vettore intersezione per la cella e capisco in quale altra cella passare
if ( (int)vptInters.size() == 1)
m_mTree[nId].m_vInters.back().vpt.push_back( vptInters[0]) ;
@@ -2546,40 +2562,74 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, INTVECTOR& vTo
Vector3d vLast = ptLast - ptSecondToLast ;
vLast.Normalize() ;
Vector3d vEdge ;
if ( AreSameEdge( nEdge, 0)) {
if ( AreSamePointExact( ptLast, ptTl)) {
vEdge = m_mTree[nId].GetBottomLeft() - ptTl ;
vEdge.Normalize() ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
//if ( AreSameEdge( nEdge, 0)) {
// if ( AreSamePointExact( ptLast, ptTl)) {
// vEdge = m_mTree[nId].GetBottomLeft() - ptTl ;
// vEdge.Normalize() ;
// if ( AreOppositeVectorApprox( vLast, vEdge)) {
// plTrimmedPoly.EraseLastUPoint() ;
// nEdge = 1 ;
// }
// }
//}
//else if ( AreSameEdge( nEdge, 1) && AreSamePointExact( ptLast, m_mTree[nId].GetBottomLeft())) {
// vEdge = ptBr - m_mTree[nId].GetBottomLeft() ;
// vEdge.Normalize() ;
// if ( AreOppositeVectorApprox( vLast, vEdge)) {
// plTrimmedPoly.EraseLastUPoint() ;
// nEdge = 2 ;
// }
//}
//else if ( AreSameEdge( nEdge, 2)) {
// if ( AreSamePointExact( ptLast, ptBr)) {
// vEdge = m_mTree[nId].GetTopRight() - ptBr ;
// vEdge.Normalize() ;
// if ( AreOppositeVectorApprox( vLast, vEdge)) {
// plTrimmedPoly.EraseLastUPoint() ;
// nEdge = 3 ;
// }
// }
//}
//else if ( AreSameEdge( nEdge, 3) && AreSamePointExact( ptLast, m_mTree[nId].GetTopRight())) {
// vEdge = ptTl - m_mTree[nId].GetTopRight() ;
// vEdge.Normalize() ;
// if ( AreOppositeVectorApprox( vLast, vEdge)) {
// plTrimmedPoly.EraseLastUPoint() ;
// nEdge = 0 ;
// }
//}
// estendo: se l'ultimo tratto è sovrapposto e controverso allora elimino l'ultimo punto
if ( nEdge == 0 || nEdge == 7 ) {
//vEdge = ptTl - m_mTree[nId].GetTopRight() ;
vEdge.Set( 1,0,0) ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
plTrimmedPoly.EraseLastUPoint() ;
nEdge = 0 ;
}
}
else if ( nEdge == 1 || nEdge == 4 ) {
//vEdge = ptBr - m_mTree[nId].GetBottomLeft() ;
vEdge.Set( 0,-1,0) ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
plTrimmedPoly.EraseLastUPoint() ;
nEdge = 1 ;
}
}
}
else if ( AreSameEdge( nEdge, 1) && AreSamePointExact( ptLast, m_mTree[nId].GetBottomLeft())) {
vEdge = ptBr - m_mTree[nId].GetBottomLeft() ;
vEdge.Normalize() ;
else if ( nEdge == 2 || nEdge == 5 ) {
//vEdge = ptTl - m_mTree[nId].GetTopRight() ;
vEdge.Set( -1,0,0) ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
plTrimmedPoly.EraseLastUPoint() ;
nEdge = 2 ;
plTrimmedPoly.EraseLastUPoint() ;
nEdge = 2 ;
}
}
else if ( AreSameEdge( nEdge, 2)) {
if ( AreSamePointExact( ptLast, ptBr)) {
vEdge = m_mTree[nId].GetTopRight() - ptBr ;
vEdge.Normalize() ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
else if ( nEdge == 3 || nEdge == 6 ) {
//vEdge = m_mTree[nId].GetTopRight() - ptBr ;
vEdge.Set( 0,1,0) ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
plTrimmedPoly.EraseLastUPoint() ;
nEdge = 3 ;
}
}
}
else if ( AreSameEdge( nEdge, 3) && AreSamePointExact( ptLast, m_mTree[nId].GetTopRight())) {
vEdge = ptTl - m_mTree[nId].GetTopRight() ;
vEdge.Normalize() ;
if ( AreOppositeVectorApprox( vLast, vEdge)) {
plTrimmedPoly.EraseLastUPoint() ;
nEdge = 0 ;
}
}