EgtGeomKernel :
- correzioni e miglioramenti alla triangolazione delle bezier.
This commit is contained in:
@@ -1643,7 +1643,10 @@ Tree::GetPolygons( POLYLINEMATRIX& vvPolygons, bool bForTriangulation, POLYLINEM
|
||||
break ;
|
||||
}
|
||||
// ora analizzo anche i loop che sono contenuti nella cella
|
||||
CreateIslandAndHoles( i, vvPolygons, vvPolygons3d, nPoly, vnParentChunk, bForTriangulation) ;
|
||||
if( bForTriangulation)
|
||||
CreateIslandAndHoles( i, vvPolygons, vvPolygons3d, nPoly, vnParentChunk, bForTriangulation, vPolygonsCorrected[i], vPolygonsBasic3d[i]) ;
|
||||
else
|
||||
CreateIslandAndHoles( i, vvPolygons, vvPolygons3d, nPoly, vnParentChunk, bForTriangulation, vPolygonsBasic[i], vPolygonsBasic3d[i]) ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
@@ -3073,6 +3076,14 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX
|
||||
bool bNotCameBack = true ;
|
||||
bool bValidNextStart = false ;
|
||||
bool bAtNextStart = false ;
|
||||
int nEdgeWithVertexSkipped ;
|
||||
switch ( nVertToErase) {
|
||||
case 0 : nEdgeWithVertexSkipped = 2 ; break ;
|
||||
case 1 : nEdgeWithVertexSkipped = 3 ; break ;
|
||||
case 2 : nEdgeWithVertexSkipped = 0 ; break ;
|
||||
case 3 : nEdgeWithVertexSkipped = 1 ; break ;
|
||||
default : nEdgeWithVertexSkipped = -1 ; break ;
|
||||
}
|
||||
if ( w < nPassToCheck - 1) {
|
||||
int nSecondCheck = 0 ;
|
||||
int nNext ;
|
||||
@@ -3118,7 +3129,7 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX
|
||||
|
||||
// se ho trovato un altro loop salto all'inizio del for, dopo aver aggiunto eventuali punti intermedi
|
||||
if ( bValidNextStart) {
|
||||
for ( int p = 1 ; p < (int) vEdgeVertex[nEdge].size() ; ++ p) {
|
||||
for ( int p = nEdge == nEdgeWithVertexSkipped ? 0 : 1 ; p < (int) vEdgeVertex[nEdge].size() ; ++ p) {
|
||||
if ( CheckIfBefore( nEdge, vEdgeVertex[nEdge][p], m_mTree[nId].m_vInters[vToCheckNow[nNext]].vpt[0])) {
|
||||
plTrimmedPoly.AddUPoint( c, vEdgeVertex[nEdge][p]) ;
|
||||
plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[nEdge][p]) ;
|
||||
@@ -3133,7 +3144,7 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX
|
||||
Point3d ptStart ;
|
||||
plTrimmedPoly.GetFirstPoint( ptStart) ;
|
||||
Point3d ptLast ; plTrimmedPoly.GetLastPoint( ptLast) ;
|
||||
for ( int p = 1 ; p < (int) vEdgeVertex[nEdge].size() ; ++ p) {
|
||||
for ( int p = nEdge == nEdgeWithVertexSkipped ? 0 : 1 ; p < (int) vEdgeVertex[nEdge].size() ; ++ p) {
|
||||
if ( CheckIfBefore( nEdge, vEdgeVertex[nEdge][p], ptStart) && CheckIfBefore( nEdge, ptLast, vEdgeVertex[nEdge][p])) {
|
||||
plTrimmedPoly.AddUPoint( c, vEdgeVertex[nEdge][p]) ;
|
||||
plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[nEdge][p]) ;
|
||||
@@ -3169,7 +3180,7 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX
|
||||
bNotCameBack = ! ( AreSameEdge( nEdge, nEdgeIn) && CheckIfBefore( plTrimmedPoly, nEdge)) ;
|
||||
}
|
||||
Point3d ptLast ; plTrimmedPoly.GetLastPoint( ptLast) ;
|
||||
for ( int p = 1 ; p < (int) vEdgeVertex[nEdge].size() ; ++ p) {
|
||||
for ( int p = nEdge == nEdgeWithVertexSkipped ? 0 : 1 ; p < (int) vEdgeVertex[nEdge].size() ; ++ p) {
|
||||
if ( CheckIfBefore( nEdge, vEdgeVertex[nEdge][p], ptStart) && CheckIfBefore( nEdge, ptLast, vEdgeVertex[nEdge][p])) {
|
||||
plTrimmedPoly.AddUPoint( c, vEdgeVertex[nEdge][p]) ;
|
||||
plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[nEdge][p]) ;
|
||||
@@ -3219,7 +3230,8 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Tree::CreateIslandAndHoles( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX& vPolygons3d, int& nPoly, INTVECTOR& vnParentChunk, bool bForTriangulation)
|
||||
Tree::CreateIslandAndHoles( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX& vPolygons3d, int& nPoly, INTVECTOR& vnParentChunk, bool bForTriangulation,
|
||||
const PolyLine& plPolygonsBasic, const PolyLine& plPolygonsBasic3d)
|
||||
{
|
||||
// vettore dei poligoni ( loop) della cella nId
|
||||
POLYLINEVECTOR vCellPolygons ;
|
||||
@@ -4084,7 +4096,9 @@ Tree::CheckIfBefore( int nEdgeA, int nEdgeB) const
|
||||
if ( nEdgeB == 0 || nEdgeB == 4)
|
||||
return true ;
|
||||
break ;
|
||||
default : return false ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user