EgtGeomKernel :

- sistemati vari bug
Manca
- da testare superfici e trim complessi
This commit is contained in:
Daniele Bariletti
2023-06-13 16:40:45 +02:00
parent d3d7f94c3a
commit cb1edcf20a
3 changed files with 43 additions and 12 deletions
+37 -7
View File
@@ -1434,7 +1434,7 @@ Tree::FindCell( const Point3d& ptToAssign, CurveLine& clTrim) const
// se ho diviso preliminarmente le patches e in uno dei due parametri ho un numero dispari di patches devo individuare a mano la cella parent
// in cui individuare la foglia giusta
if ( m_bSplitPatches && ( (m_nSpanU % 2 != 0 && m_nSpanU > 1) || (m_nSpanV % 2 != 0 && m_nSpanV > 1))) {
if ( m_bSplitPatches && ( m_nSpanU > 1 || m_nSpanV > 1)) {
INTVECTOR nParents = FindCell( ptToAssign, clTrim, m_vnParents) ;
nId = nParents.back() ;
}
@@ -1664,7 +1664,7 @@ Tree::TraceLoopLabelCell( void)
// aggiungo la fine del segmento nel vettore delle intersezioni
vptInters.push_back( ptCurr) ;
}
if ( AreSamePointExact( ptCurr, ptStart))
if ( nId == nFirstCell)
vptInters.pop_back() ;
m_mTree[nId].m_vInters.back().vpt = vptInters ;
if ( bLoopInside) {
@@ -1683,16 +1683,18 @@ Tree::TraceLoopLabelCell( void)
else {
// verifico se sono effettivamente nella cella di partenza o nella penultima cella
// devo verificare se il loop finisce in un vertice! in questo caso sono nella penultima cella! e devo fare un FindInters di nuovo per sistemare
//Point3d ptLast = m_mTree[nId].m_vInters.back().vpt.back() ;
Point3d ptLast = ptCurr ;
Point3d ptLast = m_mTree[nId].m_vInters.back().vpt.back() ; // devo recuperare l'intersezione del trim con i bordi delle celle////////////////////
//Point3d ptLast = ptCurr ;
if ( nId != nFirstCell) {
Point3d ptTl( m_mTree[nId].GetBottomLeft().x, m_mTree[nId].GetTopRight().y) ;
Point3d ptBr( m_mTree[nId].GetTopRight().x, m_mTree[nId].GetBottomLeft().y) ;
int nLastId ;
int nLastId, nEdge ;
// qui devo tener conto anche della possibilità che il trim termini parzialmente coincidente con un lato///////////////////////////////////
if ( AreSamePointApprox( m_mTree[nId].GetTopRight(), ptLast) ||
AreSamePointApprox( ptTl, ptLast) ||
AreSamePointApprox( m_mTree[nId].GetBottomLeft(), ptLast) ||
AreSamePointApprox( ptBr, ptLast)) {
AreSamePointApprox( ptBr, ptLast) ||
OnWhichEdge( nId, ptLast,nEdge)) {
Point3d ptTStart, ptTEnd ;
plLoop.GetPrevPoint( ptTEnd) ;
plLoop.GetPrevPoint( ptTStart) ;
@@ -1733,6 +1735,12 @@ Tree::TraceLoopLabelCell( void)
m_mTree[nFirstCell].m_vInters[nPass].nIn = 5 ;
else if (AreSamePointApprox( ptBr, ptFirst))
m_mTree[nFirstCell].m_vInters[nPass].nIn = 6 ;
// sono su un lato e non su un vertice
else {
int nEdge ;
OnWhichEdge( nFirstCell, ptFirst, nEdge) ;
m_mTree[nFirstCell].m_vInters[nPass].nIn = nEdge ;
}
}
}
}
@@ -2619,7 +2627,7 @@ Tree::CreateIslandAndHoles( int nLeafId, std::vector<POLYLINEVECTOR>& vPolygons,
for( int c = 0 ; c < nInters ; ++ c){
inB = m_mTree[nId].m_vInters[c] ;
if ( inB.nIn == -1) {
if ( inB != inA && inB.nChunk == inA.nChunk) {
if ( inB != inA && inB.nChunk == inA.nChunk && inB.bCCW) {
bContained = true ;
break ;
}
@@ -3416,3 +3424,25 @@ Tree::GetLeaves( std::vector<Cell>& vLeaves) const
return true ;
}
//----------------------------------------------------------------------------
bool
Tree::OnWhichEdge( int nId, Point3d& ptToAssign, int& nEdge) const
{
Point3d ptTR = m_mTree.at(nId).GetTopRight() ;
Point3d ptBL = m_mTree.at(nId).GetBottomLeft() ;
Point3d ptTl ( ptBL.x, ptTR.y) ;
Point3d ptBr ( ptTR.x, ptBL.y) ;
if ( ptToAssign.x >= ptBL.x && ptToAssign.x <= ptTR.x && abs( ptToAssign.y - ptTR.y) < EPS_SMALL)
nEdge = 0 ;
else if ( ptToAssign.y >= ptBL.y && ptToAssign.y <= ptTR.y && abs( ptToAssign.x - ptBL.x) < EPS_SMALL)
nEdge = 1 ;
else if ( ptToAssign.x >= ptBL.x && ptToAssign.x <= ptTR.x && abs( ptToAssign.y - ptBL.y) < EPS_SMALL)
nEdge = 2 ;
else if ( ptToAssign.y >= ptBL.y && ptToAssign.y <= ptTR.y && abs( ptToAssign.x - ptTR.x) < EPS_SMALL)
nEdge = 3 ;
else
return false ;
return true ;
}