From cd48e2de3b47ed38b1172529c739e6cb12d11021 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 15 Nov 2025 11:00:21 +0100 Subject: [PATCH] EgtGeomKernel : - varie correzioni ortografiche. --- Color.cpp | 2 +- CurveAux.cpp | 40 ++--- CurveBezier.cpp | 20 +-- IntersCurvePlane.cpp | 35 +++-- IntersLineSurfBez.cpp | 58 +++---- IntersLineSurfStd.cpp | 2 +- PolyLine.cpp | 2 +- SbzFromCurves.cpp | 40 ++--- StmFromCurves.cpp | 4 +- SubtractProjectedFacesOnStmFace.cpp | 2 +- SurfAux.cpp | 8 +- SurfBezier.cpp | 228 ++++++++++++++-------------- Tree.cpp | 116 +++++++------- VolZmapCalculus.cpp | 2 +- VolZmapVolume.cpp | 12 +- 15 files changed, 284 insertions(+), 287 deletions(-) diff --git a/Color.cpp b/Color.cpp index 4a1121a..0d21e19 100644 --- a/Color.cpp +++ b/Color.cpp @@ -127,7 +127,7 @@ GetHSVFromColor( const Color& cCol) hsv.dSat = dDelta / dMax ; if ( cCol.GetRed() >= dMax) // tra giallo e magenta hsv.dHue = ( cCol.GetGreen() - cCol.GetBlue()) / dDelta ; - else if( cCol.GetGreen() >= dMax) // tra ciano e giallo + else if ( cCol.GetGreen() >= dMax) // tra ciano e giallo hsv.dHue = 2.0 + ( cCol.GetBlue() - cCol.GetRed()) / dDelta ; else // tra magenta e ciano hsv.dHue = 4.0 + ( cCol.GetRed() - cCol.GetGreen()) / dDelta ; diff --git a/CurveAux.cpp b/CurveAux.cpp index c4ba761..d75372b 100644 --- a/CurveAux.cpp +++ b/CurveAux.cpp @@ -687,7 +687,7 @@ EditBezierCurve( const ICurveBezier* pCrvBezier, int nDeg, bool bMakeRatOrNot, d // adatto ogni sottocurva cubica PtrOwner pCCEdited( CreateCurveComposite()) ; for ( int i = 0 ; i < pBezCubics->GetCurveCount() ; ++i) { - if( ! pCCEdited->AddCurve( EditBezierCurve( GetCurveBezier( pBezCubics->GetCurve( i)), nDeg, bMakeRatOrNot, dTol)) ) + if ( ! pCCEdited->AddCurve( EditBezierCurve( GetCurveBezier( pBezCubics->GetCurve( i)), nDeg, bMakeRatOrNot, dTol)) ) return nullptr ; } return Release( pCCEdited) ; @@ -1149,7 +1149,7 @@ FindSpan( double dU, int nDeg, const DBLVECTOR& vKnots, int& nSpan) else nLow = nMid ; nMid = ( nLow + nHigh) / 2 ; - if( nMid == nDeg - 1) + if ( nMid == nDeg - 1) break ; } nSpan = nMid ; @@ -1174,7 +1174,7 @@ CalcBasisFunc( double dU, int nSpan, int nDeg, const DBLVECTOR& vKnots, DBLVECTO for ( int r = 0 ; r < j ; ++r) { double dSum = vRight[r+1] + vLeft[j-r] ; double dTemp = 0 ; - if( dSum > EPS_ZERO) + if ( dSum > EPS_ZERO) dTemp = vBasis[r] / dSum ; vBasis[r] = dSaved + vRight[r+1] * dTemp ; dSaved = vLeft[j-r] * dTemp ; @@ -1198,7 +1198,7 @@ InterpolatePointSetWithBezierNoIntermedLines( const PNTVECTOR& vPnt, int nStart, // se ho solo due punti restituisco una linea CurveLine cl ; cl.Set( vPnt[nStart], vPnt[nEnd]) ; pCrvInt.Set( LineToBezierCurve( &cl, nDeg, false)) ; - if( ! IsNull( pCrvInt) && pCrvInt->IsValid()) + if ( ! IsNull( pCrvInt) && pCrvInt->IsValid()) return Release( pCrvInt) ; else return nullptr ; @@ -1206,10 +1206,10 @@ InterpolatePointSetWithBezierNoIntermedLines( const PNTVECTOR& vPnt, int nStart, else if (nPoints == 3) { // se ho solo tre punti uso un altro algoritmo CurveByInterp cbi ; - for( int i = nStart ; i <= nEnd ; ++i) + for ( int i = nStart ; i <= nEnd ; ++i) cbi.AddPoint( vPnt[i]) ; pCrvInt.Set( cbi.GetCurve( CurveByInterp::AKIMA_CORNER, CurveByInterp::CUBIC_BEZIERS)) ; - if( ! IsNull( pCrvInt) && pCrvInt->IsValid()) + if ( ! IsNull( pCrvInt) && pCrvInt->IsValid()) return Release( pCrvInt) ; else return nullptr ; @@ -1248,7 +1248,7 @@ InterpolatePointSetWithBezierNoIntermedLines( const PNTVECTOR& vPnt, int nStart, int nSpan = 0 ; FindSpan( vPntParam[i], nDeg, vKnots, nSpan) ; DBLVECTOR vBasis ; vBasis.resize( nDeg + 1) ; CalcBasisFunc( vPntParam[i], nSpan, nDeg, vKnots, vBasis) ; - for( int j = nSpan - nDeg + 1 ; j <= nSpan + 1 ; ++j) + for ( int j = nSpan - nDeg + 1 ; j <= nSpan + 1 ; ++j) mA.row(i).col(j) << vBasis[j - nSpan + nDeg - 1] ; } } @@ -1273,7 +1273,7 @@ InterpolatePointSetWithBezierNoIntermedLines( const PNTVECTOR& vPnt, int nStart, pCrvInt.Set( NurbsToBezierCurve( cNurbs)) ; - if( ! IsNull(pCrvInt) && pCrvInt->IsValid()) + if ( ! IsNull(pCrvInt) && pCrvInt->IsValid()) return Release( pCrvInt) ; else return nullptr ; @@ -1292,7 +1292,7 @@ InterpolatePointSetWithBezier( const PNTVECTOR& vPnt, double dLinTol, double dMa // scelgo il parametro associato ad ogni punto in modo che rispecchi la distanza tra i punti double dErr = INFINITO ; int nItCount = 0 ; - while( dErr > dLinTol && nItCount < 10) { + while ( dErr > dLinTol && nItCount < 10) { pCrvInt->Clear() ; int nPoints = int( vPnt.size()) ; int nDeg = 3 ; @@ -1302,7 +1302,7 @@ InterpolatePointSetWithBezier( const PNTVECTOR& vPnt, double dLinTol, double dMa // se ho solo due punti restituisco una linea CurveLine cl ; cl.Set( vPnt[0], vPnt[1]) ; pCrvInt->AddCurve( LineToBezierCurve( &cl, nDeg, false)) ; - if( ! IsNull( pCrvInt) && pCrvInt->IsValid()) + if ( ! IsNull( pCrvInt) && pCrvInt->IsValid()) return Release( pCrvInt) ; else return nullptr ; @@ -1310,10 +1310,10 @@ InterpolatePointSetWithBezier( const PNTVECTOR& vPnt, double dLinTol, double dMa else if ( nPoints == 3) { // se ho solo tre punti uso un altro algoritmo CurveByInterp cbi ; - for( int i = 0 ; i < int( vPnt.size()) ; ++i) + for ( int i = 0 ; i < int( vPnt.size()) ; ++i) cbi.AddPoint( vPnt[i]) ; pCrvInt->AddCurve( cbi.GetCurve( CurveByInterp::AKIMA_CORNER, CurveByInterp::CUBIC_BEZIERS)) ; - if( ! IsNull( pCrvInt) && pCrvInt->IsValid()) + if ( ! IsNull( pCrvInt) && pCrvInt->IsValid()) return Release( pCrvInt) ; else return nullptr ; @@ -1324,14 +1324,14 @@ InterpolatePointSetWithBezier( const PNTVECTOR& vPnt, double dLinTol, double dMa int nStart = 0, nEnd = 0 ; bool bOk = true ; bool bFoundLine = false ; - while( nStart < nPoints - 1 && bOk) { + while ( nStart < nPoints - 1 && bOk) { bFoundLine = false ; nEnd = 0 ; DBLVECTOR vLen ; double dLenTot = 0 ; for ( int i = nStart ; i < nPoints - 1 ; ++i) { double dLen = Dist( vPnt[i], vPnt[i+1]) ; - if( dLen < dMaxLen) { + if ( dLen < dMaxLen) { vLen.push_back( dLen) ; dLenTot += dLen ; } @@ -1342,8 +1342,8 @@ InterpolatePointSetWithBezier( const PNTVECTOR& vPnt, double dLinTol, double dMa } } - if( vLen.size() != 0) { - if( nEnd == 0) + if ( vLen.size() != 0) { + if ( nEnd == 0) nEnd = nPoints - 1 ; pCrvInt->AddCurve( InterpolatePointSetWithBezierNoIntermedLines( vPnt, nStart, nEnd, nDeg, vLen, dLenTot)) ; } @@ -1358,13 +1358,13 @@ InterpolatePointSetWithBezier( const PNTVECTOR& vPnt, double dLinTol, double dMa } CalcApproxError( pCrvOri, pCrvInt, dErr) ; - if( dErr > dLinTol && dMaxLen > 200 * EPS_SMALL) + if ( dErr > dLinTol && dMaxLen > 200 * EPS_SMALL) dMaxLen /= 2 ; ++ nItCount ; } - if( ! IsNull( pCrvInt) && pCrvInt->IsValid() && dErr < dLinTol) + if ( ! IsNull( pCrvInt) && pCrvInt->IsValid() && dErr < dLinTol) return Release( pCrvInt) ; else return nullptr ; @@ -1382,12 +1382,12 @@ ApproxCurveWithBezier( const ICurve* pCrv , double dTol, int nType) Point3d pt ; plApprox.GetFirstPoint( pt) ; do { vPnt.push_back( pt) ; - }while( plApprox.GetNextPoint( pt)) ; + } while ( plApprox.GetNextPoint( pt)) ; // campiono punti lungo la curva e poi li interpolo PtrOwner pCC( InterpolatePointSetWithBezier( vPnt, dTol, 100)) ; - if( ! IsNull( pCC) && pCC->IsValid()) + if ( ! IsNull( pCC) && pCC->IsValid()) return Release( pCC) ; else return nullptr ; diff --git a/CurveBezier.cpp b/CurveBezier.cpp index 77e592a..b22bc43 100644 --- a/CurveBezier.cpp +++ b/CurveBezier.cpp @@ -373,7 +373,7 @@ CurveBezier::CopyFrom( const CurveBezier& cbSrc) { if ( &cbSrc == this) return true ; - if( ! cbSrc.IsValid()) + if ( ! cbSrc.IsValid()) return false ; if ( ! Init( cbSrc.m_nDeg, cbSrc.m_bRat)) return false ; @@ -1825,19 +1825,19 @@ CurveBezier::TrimStartEndAtParam( double dUStartTrim, double dUEndTrim) return false ; // se razionale devo trovare il punto di trim iniziale per ricalcolare il parametro di trim Point3d ptStart ; - if( m_bRat) + if ( m_bRat) GetPointD1D2( dUStartTrim, ptStart) ; // trim finale if ( ! TrimEndAtParam( dUEndTrim)) return false ; // trim iniziale con il parametro opportunamente ricalcolato double dNewUStartTrim ; - if( m_bRat) + if ( m_bRat) GetParamAtPoint( ptStart, dNewUStartTrim) ; else dNewUStartTrim = dUStartTrim / dUEndTrim ; //trim iniziale - if( ! TrimStartAtParam( dNewUStartTrim)) + if ( ! TrimStartAtParam( dNewUStartTrim)) return false ; return true ; @@ -1860,7 +1860,7 @@ CurveBezier::TrimStartAtLen( double dLenTrim) return false ; // utilizzo il trim sui parametri - if( ! TrimStartAtParam( dUTrim)) + if ( ! TrimStartAtParam( dUTrim)) return false ; return true ; @@ -1883,7 +1883,7 @@ CurveBezier::TrimEndAtLen( double dLenTrim) return false ; // utilizzo il trim sui parametri - if( ! TrimEndAtParam( dUTrim)) + if ( ! TrimEndAtParam( dUTrim)) return false ; return true ; @@ -2377,10 +2377,10 @@ CurveBezier::MakeNonRational( double dTol) Point3d ptCen = iccInfo.IciA[0].ptI ; // se sia l'inizio che la fine della curva distano uguale dal punto di intersezione tra i due assi trovati allora la curva è un arco di circonferenza - if( abs(Dist( pt0, ptCen) - Dist( pt3, ptCen)) < EPS_SMALL) { + if ( abs(Dist( pt0, ptCen) - Dist( pt3, ptCen)) < EPS_SMALL) { PtrOwner pNew ( ApproxArcCurveBezierWithSingleCubic( this, ptCen, vtN)) ; - if( IsNull( pNew) || ! pNew->IsValid()) + if ( IsNull( pNew) || ! pNew->IsValid()) return false ; Init( 3, false) ; for ( int i = 0 ; i < 3 ; ++i) @@ -2412,7 +2412,7 @@ CurveBezier::MakeNonRational( double dTol) Point3d pt ; pNewBez->GetPointD1D2( double( p) / nDeg, pt) ; Vector3d vDiff = vPntSampling[p] - pt ; double dErrLoc = vDiff.Len() ; - if( dErrLoc > dErrMax) + if ( dErrLoc > dErrMax) dErrMax = dErrLoc ; // aggiorno il vettore dei punti di controllo della nuova curva vPntCtrl[p] += vDiff ; @@ -2456,7 +2456,7 @@ CurveBezier::IsALine( void) const Point3d ptCtrl = GetControlPoint( i) ; DistPointLine dpl( ptCtrl, ptStart, ptEnd) ; double dDist = 0 ; dpl.GetDist( dDist) ; - if( dDist > EPS_SMALL) + if ( dDist > EPS_SMALL) return false ; } return true ; diff --git a/IntersCurvePlane.cpp b/IntersCurvePlane.cpp index 756c753..8ca95fb 100644 --- a/IntersCurvePlane.cpp +++ b/IntersCurvePlane.cpp @@ -63,11 +63,11 @@ IntersCurvePlane::IntersCurvePlane( const ICurve& Curve, const Point3d& ptOrig, pCalcCrv = m_pCurve ; m_Info.clear() ; - if( pCalcCrv->GetType() == CRV_LINE) { + if ( pCalcCrv->GetType() == CRV_LINE) { CalcIntersLinePlane( m_plPlane, *pCalcCrv) ; } - else if( pCalcCrv->GetType() == CRV_COMPO){ - for( int i = 0 ; i < GetBasicCurveComposite( pCalcCrv)->GetCurveCount(); ++i) { + else if ( pCalcCrv->GetType() == CRV_COMPO){ + for ( int i = 0 ; i < GetBasicCurveComposite( pCalcCrv)->GetCurveCount(); ++i) { const ICurve& subCurve = *GetBasicCurveComposite( pCalcCrv)->GetCurve( i) ; CalcIntersLinePlane( m_plPlane, subCurve, i) ; } @@ -82,7 +82,7 @@ IntersCurvePlane::IntersCurvePlane( const ICurve& Curve, const Point3d& ptOrig, bool IntersCurvePlane::CalcIntersLinePlane( const Plane3d& plPlane, const ICurve& Curve, int nCrv) { - if( Curve.GetType() != CRV_LINE) + if ( Curve.GetType() != CRV_LINE) return false ; Point3d ptStart ; Curve.GetStartPoint( ptStart) ; Point3d ptEnd ; Curve.GetEndPoint( ptEnd) ; @@ -90,7 +90,7 @@ IntersCurvePlane::CalcIntersLinePlane( const Plane3d& plPlane, const ICurve& Cur double dLen = 0 ; Curve.GetLength( dLen) ; int nIntersType = IntersLinePlane( ptStart, ptEnd, m_plPlane, ptInt, true) ; // intersezione con attraversamento - if( nIntersType == ILPT_YES) { + if ( nIntersType == ILPT_YES) { IntCrvPlnInfo icpi ; icpi.Ici[0].ptI = ptInt ; icpi.Ici[0].dU = Dist( ptInt, ptStart) / dLen + nCrv ; @@ -100,17 +100,17 @@ IntersCurvePlane::CalcIntersLinePlane( const Plane3d& plPlane, const ICurve& Cur m_Info.push_back( icpi) ; } // intersezione con tocco - else if( nIntersType == ILPT_START || nIntersType == ILPT_END) { + else if ( nIntersType == ILPT_START || nIntersType == ILPT_END) { IntCrvPlnInfo icpi ; icpi.Ici[0].ptI = ptInt ; icpi.Ici[0].dU = nIntersType == ILPT_START ? 0 : 1 + nCrv ; - if( nIntersType == ILPT_START) { + if ( nIntersType == ILPT_START) { Vector3d vtPos = ptEnd - m_plPlane.GetPoint() ; icpi.Ici[0].nNextTy = vtPos * m_plPlane.GetVersN() > 0 ? ICPT_OUT : ICPT_IN ; icpi.Ici[0].nPrevTy = ICPT_NULL ; } - else{ + else { Vector3d vtPos = ptStart - m_plPlane.GetPoint() ; icpi.Ici[0].nPrevTy = vtPos * m_plPlane.GetVersN() > 0 ? ICPT_OUT : ICPT_IN ; icpi.Ici[0].nNextTy = ICPT_NULL ; @@ -118,7 +118,7 @@ IntersCurvePlane::CalcIntersLinePlane( const Plane3d& plPlane, const ICurve& Cur m_Info.push_back( icpi) ; } // intersezione con sovrapposizione - else if( nIntersType == ILPT_INPLANE) { + else if ( nIntersType == ILPT_INPLANE) { IntCrvPlnInfo icpi ; icpi.bOverlap = true ; icpi.Ici[0].ptI = ptStart ; @@ -139,22 +139,22 @@ IntersCurvePlane::CalcIntersLinePlane( const Plane3d& plPlane, const ICurve& Cur void IntersCurvePlane::OrderAndCompleteIntersections() { - if( m_Info.size() < 2) + if ( m_Info.size() < 2) return ; // cancello le interesezioni puntuali adiacenti a tratti di sovrapposizione // riempio le info PrevTy e NexyTy sort( m_Info.begin(), m_Info.end(), []( IntCrvPlnInfo& icpA, IntCrvPlnInfo& icpB) { return icpA.Ici[0].dU < icpA.Ici[0].dU ;}) ; - for( int curr = m_Info.size() - 1 ; curr > - 1 ; --curr) { + for ( int curr = m_Info.size() - 1 ; curr > - 1 ; --curr) { int prev = curr == 0 ? m_Info.size() - 1 : curr - 1 ; int next = curr == m_Info.size() - 1 ? 0 : curr + 1 ; bool bErasedCurr = false ; // solo le intersezioni di sovrapposizione o puntuali sullo start o end delle curve possono avere il PrevTy o NextTy non definito - if( ! m_Info[curr].bOverlap) { + if ( ! m_Info[curr].bOverlap) { if ( m_Info[curr].Ici[0].nPrevTy == ICPT_NULL) { - if( ! m_Info[prev].bOverlap) { + if ( ! m_Info[prev].bOverlap) { m_Info[curr].Ici[0].nPrevTy = m_Info[prev].Ici[0].nNextTy ; // se ho due puntuali che coincidono cancello il successivo tra i due ( corrente) - if( AreSamePointApprox( m_Info[curr].Ici[0].ptI, m_Info[prev].Ici[0].ptI)) { + if ( AreSamePointApprox( m_Info[curr].Ici[0].ptI, m_Info[prev].Ici[0].ptI)) { m_Info.erase(m_Info.begin() + curr) ; bErasedCurr = true ; } @@ -167,7 +167,7 @@ IntersCurvePlane::OrderAndCompleteIntersections() } } if ( ! bErasedCurr && m_Info[curr].Ici[0].nNextTy == ICPT_NULL){ - if( ! m_Info[prev].bOverlap) + if ( ! m_Info[prev].bOverlap) m_Info[curr].Ici[0].nNextTy = m_Info[next].Ici[0].nPrevTy ; // se ho un'intersezione puntuale che in realtà è la fine di un tratto di sovrapposizione, la cancello else { @@ -178,13 +178,13 @@ IntersCurvePlane::OrderAndCompleteIntersections() } else { if ( m_Info[curr].Ici[0].nPrevTy == ICPT_NULL) { - if( ! m_Info[prev].bOverlap) + if ( ! m_Info[prev].bOverlap) m_Info[curr].Ici[0].nPrevTy = m_Info[prev].Ici[0].nNextTy ; else m_Info[curr].Ici[0].nPrevTy = m_Info[prev].Ici[1].nNextTy ; } if ( m_Info[curr].Ici[1].nNextTy == ICPT_NULL) { - if( ! m_Info[next].bOverlap) + if ( ! m_Info[next].bOverlap) m_Info[curr].Ici[0].nNextTy = m_Info[prev].Ici[0].nPrevTy ; else m_Info[curr].Ici[0].nNextTy = m_Info[prev].Ici[1].nPrevTy ; @@ -194,7 +194,6 @@ IntersCurvePlane::OrderAndCompleteIntersections() m_nIntersCount = m_Info.size() ; } - //---------------------------------------------------------------------------- bool IntersCurvePlane::IsArcToApprox( const ICurve& Curve) diff --git a/IntersLineSurfBez.cpp b/IntersLineSurfBez.cpp index 346613e..d6dce45 100644 --- a/IntersLineSurfBez.cpp +++ b/IntersLineSurfBez.cpp @@ -251,13 +251,13 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, pSurfBz->GetInfo( nDegU, nDegV, nSpanU, nSpanV, bRat, bTrimmed) ; // funzione pensata per funzionare solo con una monopatch bilineare - if( nDegU > 1 || nDegV > 1 || nSpanU > 1 || nSpanV > 1 || bRat) + if ( nDegU > 1 || nDegV > 1 || nSpanU > 1 || nSpanV > 1 || bRat) return false ; int nInters = int( vInfo.size()) ; PNTVECTOR vPntCtrl ; - for( int p = 0 ; p < 4 ; ++p) { + for ( int p = 0 ; p < 4 ; ++p) { bool bOk = false ; vPntCtrl.push_back( pSurfBz->GetControlPoint( p, &bOk)) ; } @@ -281,14 +281,14 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, vdCoeff = { (B2 * D1 - B1 * D2), ( A2 * D1 - A1 * D2 + B2 * C1 - B1 * C2), ( A2 * C1 - A1 * C2)} ; int nRoots = PolynomialRoots( 2, vdCoeff, vdRoots) ; bool bFound = false ; - for( int w = 0 ; w < nRoots ; ++w) { + for ( int w = 0 ; w < nRoots ; ++w) { if ( vdRoots[w] > 0 - EPS_ZERO && vdRoots[w] < 1 + EPS_ZERO ) { double dU = 0, dV = vdRoots[w] ; // verifico che non sia una soluzione con molteplicità > 1 bool bAlreadyFound = false ; for ( int k = w - 1 ; k >= 0 && ! bAlreadyFound ; --k) bAlreadyFound = abs( dV - vdRoots[k]) < EPS_PARAM ; - if( ! bAlreadyFound) { + if ( ! bAlreadyFound) { dU = (dV * (C1 - C2) + ( D1 - D2)) / ( dV * ( A2 - A1) + ( B2 - B1)) ; if ( dU > - EPS_ZERO && dU < 1 + EPS_ZERO) { Point3d ptIBez, ptIBez2 ; @@ -305,14 +305,14 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, // se tutti i coefficienti sono zero allora potrei avere una linea che giace sulla superficie // per trovare i punti di inizio e fine sovrapposizione trovo i punti a minima distanza tra la linea e gli edge della superficie - if( ! bFound && abs( vdCoeff[0]) < EPS_ZERO && abs( vdCoeff[1]) < EPS_ZERO && abs( vdCoeff[2]) < EPS_ZERO) { + if ( ! bFound && abs( vdCoeff[0]) < EPS_ZERO && abs( vdCoeff[1]) < EPS_ZERO && abs( vdCoeff[2]) < EPS_ZERO) { ICRVCOMPOPOVECTOR vCrvEdge( 4) ; vCrvEdge[0].Set(pSurfBz->GetCurveOnU( 0)) ; vCrvEdge[1].Set(pSurfBz->GetCurveOnV( 1)) ; vCrvEdge[2].Set(pSurfBz->GetCurveOnU( 1)) ; vCrvEdge[3].Set(pSurfBz->GetCurveOnV( 0)) ; double dAngTolDeg = 5 ; - for( int i = 0 ; i < 4 ; ++i) { + for ( int i = 0 ; i < 4 ; ++i) { PolyLine plApprox ; vCrvEdge[0]->ApproxWithLines( EPS_SMALL, dAngTolDeg, ICurve::ApprLineType::APL_STD, plApprox) ; //CurveComposite cCC ; //cCC.FromPolyLine( plApprox) ; @@ -322,7 +322,7 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, Point3d ptClosest ; int c = 0 ; int nTot = plApprox.GetPointNbr() ; - for( int j = 0 ; j < nTot ; ++j) { + for ( int j = 0 ; j < nTot ; ++j) { DistPointLine dpl( pt, ptL, vtL, dLen, bFinite) ; double dDist = INFINITO ; dpl.GetDist( dDist) ; @@ -339,7 +339,7 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, // tra i due tratti dell'approssimazione che arrivano al punto selezionato come più vicino, devo trovare quale si avvicina di più Point3d ptStart ; plApprox.GetFirstPoint( ptStart) ; Point3d ptEnd ; - for( int z = 1 ; z < nClosestLine - 1 ; ++z) + for ( int z = 1 ; z < nClosestLine - 1 ; ++z) plApprox.GetNextPoint( ptStart) ; plApprox.GetNextPoint( ptEnd) ; // linea precedente al punto @@ -357,12 +357,12 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, double dDistCurr = INFINITO ; dllCurr.GetDist( dDistCurr) ; - if( dDistPre < dDistCurr) + if ( dDistPre < dDistCurr) dllPre.GetMinDistPoints( ptInt1, ptInt2) ; else dllCurr.GetMinDistPoints( ptInt1, ptInt2) ; } - else if ( nClosestLine == 0){ + else if ( nClosestLine == 0) { // il punto più vicino è sulla prima linea Point3d ptStart ; plApprox.GetFirstPoint( ptStart) ; Point3d ptEnd ; plApprox.GetNextPoint( ptEnd) ; @@ -375,7 +375,7 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, // il punto più vicino è sull'ultima linea Point3d ptStart ; plApprox.GetFirstPoint( ptStart) ; Point3d ptEnd ; - for( int z = 1 ; z < nClosestLine - 1 ; ++z) + for ( int z = 1 ; z < nClosestLine - 1 ; ++z) plApprox.GetNextPoint( ptStart) ; plApprox.GetNextPoint( ptEnd) ; Vector3d vtLinePre = ptEnd - ptStart ; @@ -386,23 +386,23 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, double dU1 = 0, dV1 = 0, dU2 = 0, dV2 = 0 ; // se ho trovato due punti vuol dire che la linea coincide con un edge e ho trovato tutto quello che serve - if( ! AreSamePointExact( ptInt2, ORIG)) { - if( i == 0) { + if ( ! AreSamePointExact( ptInt2, ORIG)) { + if ( i == 0) { //dV1 = 0 ; dV2 = 0 ; vCrvEdge[0]->GetParamAtPoint( ptInt1, dU1) ; vCrvEdge[0]->GetParamAtPoint( ptInt2, dU2) ; } - else if( i == 1) { + else if ( i == 1) { //dU1 = 1 ; dU2 = 1 ; vCrvEdge[1]->GetParamAtPoint( ptInt1, dV1) ; vCrvEdge[1]->GetParamAtPoint( ptInt2, dV2) ; } - else if( i == 2){ + else if ( i == 2){ //dV1 = 1 ; dV2 = 1 ; vCrvEdge[2]->GetParamAtPoint( ptInt1, dU1) ; vCrvEdge[2]->GetParamAtPoint( ptInt2, dU2) ; } - else if( i == 3){ + else if ( i == 3){ //dU1 = 0 ; dU2 = 0 ; vCrvEdge[3]->GetParamAtPoint( ptInt1, dV1) ; vCrvEdge[3]->GetParamAtPoint( ptInt2, dV2) ; @@ -417,11 +417,11 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, double dCos2 = vtN2 * vtL ; // se avevo già trovato un punto singolo che coincide col primo punto di questa intersezione sovrapposta, allora cancello l'intersezione singola che // avevo salvato e aggiungo quella sovrapposto che ho trovato ora - if( bFound) { + if ( bFound) { int nNewTot = int(vInfo.size()) ; int nNewInters = nNewTot - nInters ; bool bAlreadyFound = false ; - for( int i = 0 ; i < nNewInters ; ++i) { + for ( int i = 0 ; i < nNewInters ; ++i) { bAlreadyFound = AreSamePointApprox(vInfo[nNewTot - i].ptUV, ptSP1) || AreSamePointApprox(vInfo[nNewTot - i].ptUV, ptSP2) ; if ( bAlreadyFound) { vInfo.erase( vInfo.begin() + nNewTot - i) ; @@ -434,32 +434,32 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, break ; } // se ho trovato un punto a distanza zero dalla linea allora ho trovato l'intersezione - else if( dMinDist < EPS_SMALL) { - if( i == 0) { + else if ( dMinDist < EPS_SMALL) { + if ( i == 0) { //dV1 = 0 ; vCrvEdge[0]->GetParamAtPoint( ptInt1, dU1) ; } - else if( i == 1) { + else if ( i == 1) { //dU1 = 1 ; vCrvEdge[1]->GetParamAtPoint( ptInt1, dV1) ; } - else if( i == 2){ + else if ( i == 2) { //dV1 = 1 ; vCrvEdge[2]->GetParamAtPoint( ptInt1, dU1) ; } - else if( i == 3){ + else if ( i == 3) { //dU1 = 0 ; vCrvEdge[3]->GetParamAtPoint( ptInt1, dV1) ; } Point3d ptSP1( dU1, dV1, 0), ptSP2 ; // se avevo trovato già altri punti controllo di non essere esattamente su una diagonale ( e quindi avere un'intersezione con ogni edge, ma due sono doppie) - if( bFound) { + if ( bFound) { int nNewTot = int(vInfo.size()) ; int nNewInters = nNewTot - nInters ; bool bAlreadyFound = false ; - for( int i = 0 ; i < nNewInters ; ++i) + for ( int i = 0 ; i < nNewInters ; ++i) bAlreadyFound = AreSamePointApprox(vInfo[nNewTot - i].ptUV, ptSP1) ; - if( bAlreadyFound) + if ( bAlreadyFound) continue ; } @@ -474,16 +474,16 @@ IntersLineSurfBzBilinear( const Point3d& ptL, const Vector3d& vtL, double dLen, } // se la superficie è trimmed verifico che i punti trovati siano all'interno del parametrico trimmato - if( bTrimmed && bFound) { + if ( bTrimmed && bFound) { int nNewTot = int(vInfo.size()) ; int nNewInters = nNewTot - nInters ; const ISurfFlatRegion* pFRTrim = pSurfBz->GetTrimRegion() ; - for( int i = 0 ; i < nNewInters ; ++i) { + for ( int i = 0 ; i < nNewInters ; ++i) { Point3d ptTest = vInfo[nNewTot - i].ptUV * SBZ_TREG_COEFF ; bool bInside = false ; double dDist = INFINITO ; IsPointInsideSurfFr( ptTest, pFRTrim, dDist, bInside) ; - if( ! bInside) + if ( ! bInside) vInfo.erase( vInfo.begin() + nNewTot - i) ; } } diff --git a/IntersLineSurfStd.cpp b/IntersLineSurfStd.cpp index 8123316..3fab574 100644 --- a/IntersLineSurfStd.cpp +++ b/IntersLineSurfStd.cpp @@ -1662,7 +1662,7 @@ LineTorus( const Point3d& ptLine, const Vector3d& vtLine, // Riordino le soluzioni for ( int ni = 0 ; ni < int( vdPar.size()) - 1 ; ++ ni) { for ( int nj = ni ; nj < int( vdPar.size()) ; ++ nj) { - if( vdPar[ni] > vdPar[nj]) { + if ( vdPar[ni] > vdPar[nj]) { swap( vdPar[ni], vdPar[nj]) ; } } diff --git a/PolyLine.cpp b/PolyLine.cpp index 19a8027..f52f459 100644 --- a/PolyLine.cpp +++ b/PolyLine.cpp @@ -1974,7 +1974,7 @@ MatchPolyLinesAddingPoints( const PolyLine& PL1, const PolyLine& PL2, int nType, for ( int z = int( vbRep2.size()) - 1 ; z >= nCrv2 ; --z) vbRep2[z] = true ; } - if( nCrv1 < nPnt1) { + if ( nCrv1 < nPnt1) { nRep1 += nPnt1 - nCrv1 ; for ( int z = int( vbRep1.size()) - 1 ; z >= nCrv1 ; --z) vbRep1[z] = true ; diff --git a/SbzFromCurves.cpp b/SbzFromCurves.cpp index 163eec3..da24792 100644 --- a/SbzFromCurves.cpp +++ b/SbzFromCurves.cpp @@ -78,7 +78,7 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol) for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) { for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){ vPLOrd.push_back(vPL[vnPLIndMat[i][j]]) ; - if( vbInvert[vnPLIndMat[i][j]]) + if ( vbInvert[vnPLIndMat[i][j]]) vPLOrd.back().Invert() ; } } @@ -221,7 +221,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect const ICurveComposite* pCC = GetCurveComposite( pGuide) ; for ( int i = 0 ; i < pCC->GetCurveCount() && bGuideIsPolyLine ; ++i) { const ICurve* pCrv = pCC->GetCurve( i) ; - if( pCrv->GetType() != CRV_LINE) { + if ( pCrv->GetType() != CRV_LINE) { if ( pCrv->GetType() == CRV_BEZIER) { const ICurveBezier* pCrvBez = GetCurveBezier( pCrv) ; bGuideIsPolyLine = pCrvBez->IsALine() ; @@ -249,7 +249,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect int nSpanV = 0 ; PtrOwner pCrvV( CreateCurveComposite()) ; if ( bGuideIsPolyLine ) { - if( pGuide->GetType() == CRV_LINE) + if ( pGuide->GetType() == CRV_LINE) nSpanV = 1 ; else if ( pGuide->GetType() == CRV_COMPO) nSpanV = GetCurveComposite( pGuide)->GetCurveCount() ; @@ -260,7 +260,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect pCrvV->AddCurve( CurveToBezierCurve( pGuide, 3, false)) ; else { const ICurveBezier* pGuideBez = GetCurveBezier( pGuide) ; - if( ! pGuideBez->IsRational()) + if ( ! pGuideBez->IsRational()) pCrvV->AddCurve( pGuide->Clone()) ; else pCrvV->AddCurve( EditBezierCurve( pGuideBez, 3, false)) ; @@ -297,7 +297,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect ICRVCOMPOPOVECTOR vCC ; INTMATRIX mRep ; mRep.resize( nSpanU * nDegU + 1) ; int nMaxSpanV = nSpanV ; - for( int i = 0 ; i < nSpanU ; ++i) { + for ( int i = 0 ; i < nSpanU ; ++i) { const ICurveBezier* pSubCrv = GetCurveBezier( pCrvU->GetCurve( i)) ; for ( int j = i==0 ? 0 : 1 ; j < nDegU + 1 ; ++j ) { Point3d ptCtrl = pSubCrv->GetControlPoint( j) ; @@ -327,7 +327,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect for ( int w = 0 ; w < int( vCC.size()) ; ++w) { const ICurveComposite* pCCOther = vCC[w] ; int nPropCheck = -1 ; pCCOther->GetCurveTempProp( z, nPropCheck) ; - if( nPropCheck != 0) + if ( nPropCheck != 0) mRep[w][z] = 1 ; } } @@ -337,11 +337,11 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect // conto in quante colonne di mRep la somma degli elementi è != 0 // questo numero va aggiunto all'attuale nSpanV int nSpanPlus = 0 ; - for( int z = 0 ; z < nMaxSpanV ; ++z) { + for ( int z = 0 ; z < nMaxSpanV ; ++z) { int nPosTot = 0 ; for ( int k = 0 ; k < int( mRep.size()) ; ++k ) nPosTot += mRep[k][z] ; - if( nPosTot != 0) + if ( nPosTot != 0) nSpanPlus += 1 ; } nMaxSpanV = max( nMaxSpanV, nSpanV + nSpanPlus) ; @@ -349,14 +349,14 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect pSurfBez->Init( nDegU,nDegV, nSpanU, nSpanV, bRat) ; //// aggiungo i punti di controllo alla superficie - //for( int i = 0 ; i < nSpanU ; ++i) { + //for ( int i = 0 ; i < nSpanU ; ++i) { // for ( int j = i==0 ? 0 : 1 ; j < nDegU + 1 ; ++j ) { // const ICurveComposite* pOffsetCrv = vCC[i*nDegU + j] ; // for ( int z = 0 ; z < pOffsetCrv->GetCurveCount() ; ++z) { // const ICurveLine* pCL = GetCurveLine( pOffsetCrv->GetCurve( z)) ; - // if( pCL == nullptr) + // if ( pCL == nullptr) // return nullptr ; - // if( z == 0) { + // if ( z == 0) { // Point3d ptSubStart ; pCL->GetStartPoint( ptSubStart) ; // pSurfBez->SetControlPoint( i * nDegU + j, 0, ptSubStart) ; // } @@ -367,13 +367,13 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect //} //// aggiungo i punti di controllo alla superficie /// DA CORREGGERE L'AGGIUNTA DEI PUNTI DI CONTROLLO - //for( int i = 0 ; i < int( vCC.size()) ; ++i) { + //for ( int i = 0 ; i < int( vCC.size()) ; ++i) { // const ICurveComposite* pOffsetCrv = vCC[i] ; // for ( int z = 0 ; z < pOffsetCrv->GetCurveCount() ; ++z) { // const ICurveLine* pCL = GetCurveLine( pOffsetCrv->GetCurve( z)) ; - // if( pCL == nullptr) + // if ( pCL == nullptr) // return nullptr ; - // if( z == 0) { + // if ( z == 0) { // Point3d ptSubStart ; pCL->GetStartPoint( ptSubStart) ; // pSurfBez->SetControlPoint( i * nDegU + j, 0, ptSubStart) ; // } @@ -422,7 +422,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect //frStart.Set( ptStart, -vtStart, vtStart ^ vtNorm) ; //// porto la sezione nel sistema di riferimento del piano in cui giace //pCrvU->ToLoc( frStart) ; - //for( int i = 0 ; i < nSpanU ; ++i) { + //for ( int i = 0 ; i < nSpanU ; ++i) { // const ICurveBezier* pSubCrv = GetCurveBezier( pCrvU->GetCurve( i)) ; // for ( int j = i==0 ? 0 : 1 ; j < nDegU + 1 ; ++j ) { // Point3d ptCtrl = pSubCrv->GetControlPoint( j) ; @@ -458,7 +458,7 @@ GetSurfBezierSweptInPlane( const ICurve* pSect, const ICurve* pGuide, const Vect // // aggiungo i punti di controllo alla superficie // for ( int z = 0 ; z < nSpanV ; ++z) { // const ICurveBezier* pCrvBez = GetCurveBezier( pCrvV->GetCurve( z)) ; - // if( pCrvBez == nullptr) + // if ( pCrvBez == nullptr) // return nullptr ; // for ( int k = z == 0 ? 0 : 1 ; k < nDegV ; ++k) { // Point3d ptCtrl = pCrvBez->GetControlPoint( k) ; @@ -572,7 +572,7 @@ GetSurfBezierSwept3d( const ICurve* pSect, const ICurve* pGuide, const Vector3d& pCrvU->AddCurve( CurveToBezierCurve( pSect, 3, false)) ; else { const ICurveBezier* pSectBez = GetCurveBezier( pSect) ; - if( ! pSectBez->IsRational()) + if ( ! pSectBez->IsRational()) pCrvU->AddCurve( pSect->Clone()) ; ///// questa curva potrebbe non essere di grado 3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else pCrvU->AddCurve( EditBezierCurve( pSectBez, 3, false)) ; @@ -775,12 +775,12 @@ GetSurfBezierSkinned( const CICURVEPVECTOR& vCrv, double dLinTol) { // verifico che le curve siano valide for ( int i = 0 ; i < int( vCrv.size()) ; ++i) { - if( vCrv[i] == nullptr || ! vCrv[i]->IsValid()) + if ( vCrv[i] == nullptr || ! vCrv[i]->IsValid()) return nullptr ; } // se ho solo due curve allora faccio la rigata - if( vCrv.size() == 2) + if ( vCrv.size() == 2) return GetSurfBezierRuled( vCrv[0], vCrv[1], ISurfBezier::RLT_B_MINDIST_PLUS, dLinTol) ; //trasformo le curve in curve di bezier, pareggio il numero di sottocurve e il grado @@ -788,7 +788,7 @@ GetSurfBezierSkinned( const CICURVEPVECTOR& vCrv, double dLinTol) // dLinTol servirà quando ci sarà la funzione ApproxWithCurveBezier // se la curva è già una bezier singola la tengo, sennò la converto ICURVEPOVECTOR vCrvBez ; - for( int c = 0 ; c < int( vCrv.size()) ; ++c){ + for ( int c = 0 ; c < int( vCrv.size()) ; ++c){ PtrOwner pCC( CreateCurveComposite()) ; if ( vCrv[c]->GetType() != CRV_BEZIER ) pCC->AddCurve( CurveToBezierCurve( vCrv[c])) ; diff --git a/StmFromCurves.cpp b/StmFromCurves.cpp index c2d3097..8ccb23d 100644 --- a/StmFromCurves.cpp +++ b/StmFromCurves.cpp @@ -73,7 +73,7 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol) return nullptr ; for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) { for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j){ - if( vbInvert[vnPLIndMat[i][j]]) + if ( vbInvert[vnPLIndMat[i][j]]) vPL[vnPLIndMat[i][j]].Invert() ; } } @@ -165,7 +165,7 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d& if ( ! CalcRegionPolyLines( vPL, vtN, vnPLIndMat, vbInvert)) return nullptr ; for ( int i = 0 ; i < int( vPL.size()) ; ++i) { - if( vbInvert[i]) + if ( vbInvert[i]) vPL[i].Invert() ; } // verifico la direzione di estrusione diff --git a/SubtractProjectedFacesOnStmFace.cpp b/SubtractProjectedFacesOnStmFace.cpp index cc290c0..39538b5 100644 --- a/SubtractProjectedFacesOnStmFace.cpp +++ b/SubtractProjectedFacesOnStmFace.cpp @@ -302,7 +302,7 @@ SetTmpPropByOverlap( ICurveComposite* pCrvCheck, const int nInd, const ICurveCom // ultimo tratto di curva della Composita iniziale PtrOwner pCrvB( GetBasicCurveComposite( pCrvCheck->CopyParamRange( nInd + 1, pCrvCheck->GetCurveCount()))) ; if ( ! IsNull( pCrvB) && pCrvB->GetCurveCount() > 0 && pCrvB->IsValid()) - if( ! pCrvToReturn->AddCurve( Release( pCrvB))) { + if ( ! pCrvToReturn->AddCurve( Release( pCrvB))) { nStat = 2 ; return true ; } diff --git a/SurfAux.cpp b/SurfAux.cpp index bcdd829..ada55d4 100644 --- a/SurfAux.cpp +++ b/SurfAux.cpp @@ -42,7 +42,7 @@ NurbsSurfaceCanonicalize( SNurbsSurfData& snData) double dKnot = snData.vU[k] ; vU.push_back( dKnot) ; } - for( int j = 0 ; j < snData.nCPV ; ++j) { + for ( int j = 0 ; j < snData.nCPV ; ++j) { CNurbsData nuCurve ; nuCurve.bPeriodic = true ; nuCurve.bRat = snData.bRat ; @@ -66,12 +66,12 @@ NurbsSurfaceCanonicalize( SNurbsSurfData& snData) if ( NurbsCurveCanonicalize( nuCurve)) { // se NurbsCurveCanonicalize ha restituito false (la curva potrebbe esserre un punto di polo) allora non modifico i punti e il vettore dei nodi della superficie if ( snData.mCP.size() != nuCurve.vCP.size() ) { snData.mCP.resize( nuCurve.vCP.size()) ; - if( snData.bRat) + if ( snData.bRat) snData.mW.resize( nuCurve.vW.size()) ; } for ( int i = 0 ; i < snData.nCPU ; ++i) { snData.mCP[i][j] = nuCurve.vCP[i] ; - if( snData.bRat) { + if ( snData.bRat) { snData.mW[i][j] = nuCurve.vW[i] ; snData.mCP[i][j] *= nuCurve.vW[i] ; } @@ -91,7 +91,7 @@ NurbsSurfaceCanonicalize( SNurbsSurfData& snData) double dKnot = snData.vV[k] ; vV.push_back( dKnot) ; } - for( int i = 0 ; i < snData.nCPU ; ++i) { + for ( int i = 0 ; i < snData.nCPU ; ++i) { CNurbsData nuCurve ; nuCurve.bPeriodic = true ; nuCurve.bRat = snData.bRat ; diff --git a/SurfBezier.cpp b/SurfBezier.cpp index fe62831..a2562ef 100644 --- a/SurfBezier.cpp +++ b/SurfBezier.cpp @@ -356,16 +356,16 @@ SurfBezier::IsClosed( void) const m_bClosedU = AreSamePointApprox( m_vPtCtrl[GetInd(0,j)], m_vPtCtrl[GetInd(m_nDegU * m_nSpanU,j)]) ; // se ho la chiusura su entrambi i parametri ho la chiusura "in stile toro" - if( m_bClosedU && m_bClosedV) + if ( m_bClosedU && m_bClosedV) return true ; //verifico se ci sono dei poli che chiudono la superficie, per vedere se ho la chiusura "in stile sfera, da polo a polo" ( classica superficie di rivoluzione) CalcPoles() ; // chiusa in U e con poli sugli altri 2 lati - if( m_bClosedU && ! m_bClosedV && m_vbPole[0] && m_vbPole[2]) + if ( m_bClosedU && ! m_bClosedV && m_vbPole[0] && m_vbPole[2]) return true ; // chiusa in V e con poli sugli altri due lati - if( m_bClosedV && ! m_bClosedU && m_vbPole[1] && m_vbPole[3]) + if ( m_bClosedV && ! m_bClosedU && m_vbPole[1] && m_vbPole[3]) return true ; // se ho due lati opposti che sono dei poli e sono anche coincidenti allora la superficie potrebbe essere chiusa "in stile sfera a saccoccia" @@ -1388,7 +1388,7 @@ SurfBezier::GetCurveOnU( double dV) const for ( int s = 0 ; s < m_nSpanU ; ++ s) { PtrOwner pCbz( CreateBasicCurveBezier()) ; pCbz->Init( m_nDegU, m_bRat) ; - for( int j = 0 ; j < m_nDegU ; ++j) + for ( int j = 0 ; j < m_nDegU ; ++j) pCbz->SetControlPoint( s * m_nDegU + j, GetControlPoint( GetInd( s * m_nDegU + j , nV * m_nDegV), &bOk), GetControlWeight( GetInd( s * m_nDegU + j , nV * m_nDegV), &bOk)) ; pCrvCo->AddCurve( Release( pCbz)) ; } @@ -1398,7 +1398,7 @@ SurfBezier::GetCurveOnU( double dV) const for ( int s = 0 ; s < m_nSpanU ; ++ s) { PtrOwner pCbz( CreateBasicCurveBezier()) ; pCbz->Init( m_nDegU, m_bRat) ; - for( int j = 0 ; j < m_nDegU ; ++j) + for ( int j = 0 ; j < m_nDegU ; ++j) pCbz->SetControlPoint( s * m_nDegU + j, GetControlPoint( GetInd( s * m_nDegU + j , nV * m_nDegV), &bOk)) ; pCrvCo->AddCurve( Release( pCbz)) ; } @@ -1500,7 +1500,7 @@ SurfBezier::GetCurveOnV( double dU) const for ( int s = 0 ; s < m_nSpanV ; ++ s) { PtrOwner pCbz( CreateBasicCurveBezier()) ; pCbz->Init( m_nDegV, m_bRat) ; - for( int j = 0 ; j < m_nDegV ; ++j) + for ( int j = 0 ; j < m_nDegV ; ++j) pCbz->SetControlPoint( s * m_nDegV + j, GetControlPoint( GetInd( s * m_nDegV + j , nU * m_nDegU), &bOk), GetControlWeight( GetInd( s * m_nDegV + j , nU * m_nDegU), &bOk)) ; pCrvCo->AddCurve( Release( pCbz)) ; } @@ -1510,7 +1510,7 @@ SurfBezier::GetCurveOnV( double dU) const for ( int s = 0 ; s < m_nSpanV ; ++ s) { PtrOwner pCbz( CreateBasicCurveBezier()) ; pCbz->Init( m_nDegV, m_bRat) ; - for( int j = 0 ; j < m_nDegV ; ++j) + for ( int j = 0 ; j < m_nDegV ; ++j) pCbz->SetControlPoint( s * m_nDegV + j, GetControlPoint( GetInd( s * m_nDegV + j , nU * m_nDegU), &bOk)) ; pCrvCo->AddCurve( Release( pCbz)) ; } @@ -1960,7 +1960,7 @@ SurfBezier::GetApproxSurf( double dTol, double dSideMin, bool bUpdateEdges) cons // riordino il vettore dei punti su cui non ho fatto la triangolazione if ( vPL.size() == 2) { - //if( vPnt.size() != vPnt3d.size()) + //if ( vPnt.size() != vPnt3d.size()) // return nullptr ; PNTVECTOR vPntOrd ; if ( bTriangulatedIn3D) { @@ -1977,7 +1977,7 @@ SurfBezier::GetApproxSurf( double dTol, double dSideMin, bool bUpdateEdges) cons if ( vPL.size() == 1) { vPnt3d = vPnt ; PNTVECTOR vPnt2d ; - for( int i = 0 ; i < int( vPL.size()) ; ++i) { + for ( int i = 0 ; i < int( vPL.size()) ; ++i) { PolyLine& pl = vPL[i] ; Point3d pt ; pl.GetFirstPoint( pt) ; //vPnt2D.push_back( pt) ; @@ -2038,37 +2038,37 @@ SurfBezier::ReorderPntVector( const POLYLINEVECTOR& vPL, bool bTriangulatedIn3D, int nPoints = 0 ; bool bInverted = false ; for ( int poly = 0 ; poly < int( vPL.size()) ; ++poly ) { - if( vbPolyChecked[poly]) + if ( vbPolyChecked[poly]) continue ; PolyLine pl = vPL[poly] ; nInd = 0 ; Point3d ptPoly ; pl.GetFirstPoint( ptPoly) ; bool bFound = false ; - if( AreSamePointExact( pt, ptPoly)){ + if ( AreSamePointExact( pt, ptPoly)){ nPoints = pl.GetPointNbr() ; nPoly = poly ; bFound = true ; pl.GetNextPoint( ptPoly) ; - if( ! AreSamePointExact( vPnt[p+1], ptPoly)) + if ( ! AreSamePointExact( vPnt[p+1], ptPoly)) bInverted = true ; break ; } while ( pl.GetNextPoint( ptPoly) && ! bFound) { ++ nInd ; - if( AreSamePointExact( pt, ptPoly)) { + if ( AreSamePointExact( pt, ptPoly)) { nPoints = pl.GetPointNbr() ; nPoly = poly ; bFound = true ; pl.GetNextPoint( ptPoly) ; - if( ! AreSamePointExact( vPnt[p+1], ptPoly)) + if ( ! AreSamePointExact( vPnt[p+1], ptPoly)) bInverted = true ; break ; } } - if( bFound) + if ( bFound) break ; } - if( nInd == 0) { + if ( nInd == 0) { Point3d ptPoly ; vPLToOrd[nPoly].GetFirstPoint( ptPoly) ; vPntOrd.push_back( ptPoly) ; @@ -2085,7 +2085,7 @@ SurfBezier::ReorderPntVector( const POLYLINEVECTOR& vPL, bool bTriangulatedIn3D, else { PNTVECTOR vPntToRotate ; Point3d ptPoly ; - if( ! bInverted) { + if ( ! bInverted) { vPLToOrd[nPoly].GetFirstPoint( ptPoly) ; vPntToRotate.push_back( ptPoly) ; while ( vPLToOrd[nPoly].GetNextPoint( ptPoly)) @@ -2118,7 +2118,7 @@ SurfBezier::ReorderPntEnhancedVector( const POLYLINEVECTOR& vPL, bool bTriangula for ( int i = 0 ; i < int( vPLToOrd.size()) ; ++i) { Point3d pt ; vPLToOrd[i].GetFirstPoint( pt) ; vPntPolyToOrd.push_back( pt) ; - while( vPLToOrd[i].GetNextPoint( pt)) + while ( vPLToOrd[i].GetNextPoint( pt)) vPntPolyToOrd.push_back( pt) ; } // costruisco il vettore con i punti delle polyline in ordine @@ -2126,7 +2126,7 @@ SurfBezier::ReorderPntEnhancedVector( const POLYLINEVECTOR& vPL, bool bTriangula for ( int i = 0 ; i < int( vPL.size()) ; ++i) { Point3d pt ; vPL[i].GetFirstPoint( pt) ; vPntPoly.push_back( pt) ; - while( vPL[i].GetNextPoint( pt)) + while ( vPL[i].GetNextPoint( pt)) vPntPoly.push_back( pt) ; } BOOLVECTOR vbPntChecked( vPnt.size()) ; @@ -2135,7 +2135,7 @@ SurfBezier::ReorderPntEnhancedVector( const POLYLINEVECTOR& vPL, bool bTriangula for ( int p = 0 ; p < int( vPntPoly.size()) ; ++p) { Point3d pt = vPntPoly[p] ; for ( int t = 0 ; t < int( vPnt.size()) ; ++t) { - if( vbPntChecked[t]) + if ( vbPntChecked[t]) continue ; Point3d ptToCheck = vPnt[t] ; if ( AreSamePointExact( pt, ptToCheck)) { @@ -2984,7 +2984,7 @@ SurfBezier::UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, in int nEdge = -1 ; // do per scontato che al più un vertice possa essere in un polo if ( m_vbPole[0] || m_vbPole[2]) { - for( int p = 0 ; p < 3 ; ++p) { + for ( int p = 0 ; p < 3 ; ++p) { if ( ( m_vbPole[0] && vPtPa[p].y > m_nSpanV * SBZ_TREG_COEFF - EPS_SMALL ) ) { bNearPole = true ; nVertOnPole = p ; @@ -2998,7 +2998,7 @@ SurfBezier::UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, in } } else if ( m_vbPole[1] || m_vbPole[3]) { - for( int p = 0 ; p < 3 ; ++p) { + for ( int p = 0 ; p < 3 ; ++p) { if ( ( m_vbPole[3] && vPtPa[p].x > m_nSpanU * SBZ_TREG_COEFF - EPS_SMALL)) { bNearPole = true ; nVertOnPole = p ; @@ -3089,7 +3089,7 @@ SurfBezier::UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, in for (int ed : vEdgesClosed) { // scorro sui tratti che compongono l'edge for ( int i = 0 ; i < int( m_mCCEdge[ed].size()) ; ++i) { - if( m_mCCEdge[ed][i]->IsPointOn( vPT[p]) && vOn[p] == -1) + if ( m_mCCEdge[ed][i]->IsPointOn( vPT[p]) && vOn[p] == -1) vOn[p] = ed ; } } @@ -3127,7 +3127,7 @@ SurfBezier::UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, in for (int ed = 0 ; ed < 4 ; ++ed) { // scorro sui tratti che compongono l'edge for ( int i = 0 ; i < int( m_mCCEdge[ed].size()) ; ++i) { - if( m_mCCEdge[ed][i]->IsPointOn( vPT[p]) && vOn[p] == -1) + if ( m_mCCEdge[ed][i]->IsPointOn( vPT[p]) && vOn[p] == -1) vOn[p] = ed ; } } @@ -3155,7 +3155,7 @@ SurfBezier::UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, in if ( vPtPa[p].x > dRightX ) dRightX= vPtPa[p].x ; // se un vertice è su un lato di chiusura, visto che sono vicino ad un polo, mi accerto che un lato del triangolo sia SUL lato di chiusura - if( m_bClosedU && bOneVertexOnClosureButNotPole) { + if ( m_bClosedU && bOneVertexOnClosureButNotPole) { dRightX = ( dParamL - vPtPa[p].x > vPtPa[p].x ? 0 : dParamL) ; break ; } @@ -3165,7 +3165,7 @@ SurfBezier::UnprojectPointFromStm( int nT, const Point3d& ptI, Point3d& ptSP, in dRightX = nEdge == 1 ? 0 : dParamL ; if ( vPtPa[p].y > dRightY ) dRightY = vPtPa[p].y ; - if( m_bClosedV && bOneVertexOnClosureButNotPole) { + if ( m_bClosedV && bOneVertexOnClosureButNotPole) { dRightY = ( dParamH - vPtPa[p].y > vPtPa[p].y ? 0 : dParamH) ; break ; } @@ -3295,7 +3295,7 @@ SurfBezier::UnprojectPoint( const Point3d& pt3D, Point3d& ptParam, const Point3d vtDir.Set( - dfdU, - dfdV, 0) ; if ( ! vtDir.Normalize() ) vtDir.Set( - dfdU / dSSum, - dfdV / dSSum, 0) ; - if( ! vtDir.IsValid()) + if ( ! vtDir.IsValid()) return false ; dr = dDistPre / dASum ; // in modalità Retry riduco lo spostamento @@ -3428,7 +3428,7 @@ SurfBezier::GetLoops( ICRVCOMPOPOVECTOR& vCC, bool bLineOrBezier) const if ( ! m_bClosedV ) { if ( ! m_vbPole[2]) { // se superficie è chiusa lungo il parametro U, ma non lo è lungo il parametro V allora avrò due curve separate( un cilindro) - if( m_bClosedU) + if ( m_bClosedU) vCC.emplace_back( CreateCurveComposite()) ; vCC.back()->AddCurve( GetSingleEdge3D( bLineOrBezier, 2)) ; } @@ -3436,7 +3436,7 @@ SurfBezier::GetLoops( ICRVCOMPOPOVECTOR& vCC, bool bLineOrBezier) const if ( ! m_bClosedU ) { if ( ! m_vbPole[3]) { // se superficie è chiusa lungo il parametro V, ma non lo è lungo il parametro U allora avrò due curve separate( un cilindro) - if( m_bClosedV) + if ( m_bClosedV) vCC.emplace_back( CreateCurveComposite()) ; vCC.back()->AddCurve( GetSingleEdge3D( bLineOrBezier, 3)) ; } @@ -3707,7 +3707,7 @@ SurfBezier::GetLoops( ICRVCOMPOPOVECTOR& vCC, bool bLineOrBezier) const // qui portei estrarre una funzione che proietta curve dal parametrico al 3D // scorro i gruppi di loop 2D formati da loop che partecipano alla formazione dello stesso loop nel 3D ICRVCOMPOPOVECTOR vpCCOpen ; - for( int i = 0 ; i < int( m_vCCLoop.size()); ++i) { + for ( int i = 0 ; i < int( m_vCCLoop.size()); ++i) { vpCCOpen.emplace_back(CreateBasicCurveComposite()) ; PolyLine pl3D ; // la composita è una spezzata composta da linee, quindi la ricostruisco come polyline in 3D @@ -3735,7 +3735,7 @@ SurfBezier::GetLoops( ICRVCOMPOPOVECTOR& vCC, bool bLineOrBezier) const PtrOwner pCC( vpCCOpen[k]->Clone()) ; vbAdded[k] = true ; bool bAddedOne = true ; - while( bAddedOne) { + while ( bAddedOne) { bAddedOne = false ; for ( int t = k ; t < int(vpCCOpen.size()); ++t ) { if ( vbAdded[t]) @@ -3870,7 +3870,7 @@ SurfBezier::IsPlanar( void) const PolyLine plApprox ; Plane3d plPlane ; - if( ! m_bTrimmed) { + if ( ! m_bTrimmed) { // costruisco il contorno della superficie unendo gli edge e chiedo se la polyline è piana. PtrOwner pCCEdge( GetSingleEdge3D( false, 0)) ; pCCEdge->AddCurve( GetSingleEdge3D( false, 1)) ; @@ -3993,7 +3993,7 @@ SurfBezier::CreateByRegion( const POLYLINEVECTOR& vPL) // creo una superficie piana grande come il box della curva nel suo piano e poi la trimmo POLYLINEVECTOR vPLFlat = vPL ; BBox3d bboxContour ; - for( int i = 0 ; i < int( vPLFlat.size()) ; ++i) { + for ( int i = 0 ; i < int( vPLFlat.size()) ; ++i) { // porto le polilinee nel riferimento del loro piano e ne recupero il box vPLFlat[i].ToLoc(frContour) ; BBox3d bboxLoop ; @@ -4026,7 +4026,7 @@ SurfBezier::CreateByRegion( const POLYLINEVECTOR& vPL) ICRVCOMPOPOVECTOR vCCClosed ; for ( int i = 0 ; i < int( vPL.size()) ; ++i) { ICurveComposite* pCC( CreateBasicCurveComposite()) ; - if( pCC == nullptr || ! pCC->FromPolyLine( vPL[i]) || ! pCC->IsValid()) + if ( pCC == nullptr || ! pCC->FromPolyLine( vPL[i]) || ! pCC->IsValid()) return false ; if ( ! AddCurveCompoToCuts( pCC, vCCOpen, vCCClosed)) return false ; // o metto un continue? @@ -4368,7 +4368,7 @@ ChangeStartForClosed( PolyLine& plU0, PolyLine& plU1, ICurveComposite* pCrvU0, I int nMin = 0 ; dMinDist = INFINITO ; for ( int i = 0 ; i < int( vDistVert.size()) ; ++i) { - if( get<0>(vDistVert[i]) < dMinDist) { + if ( get<0>(vDistVert[i]) < dMinDist) { dMinDist = get<0>(vDistVert[i]) ; nMin = i ; } @@ -4424,7 +4424,7 @@ GetEdgeSplitByAngTol( const PolyLine& PL, double dAngTol, INTVECTOR& vEdgeSplit) vEdgeSplit[nP] = true ; } - if( ! bClosed) + if ( ! bClosed) vEdgeSplit[0] = false ; return true ; @@ -4496,14 +4496,14 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int if ( nDegU0 != nDegU1) { while ( nDegU0 < nDegU1) { CurveComposite CC ; - for( int k = 0 ; k < nSpanU0 ; ++k) + for ( int k = 0 ; k < nSpanU0 ; ++k) CC.AddCurve( BezierIncreaseDegree( GetCurveBezier( CrvU0.GetCurve( k)))) ; ++nDegU0 ; CrvU0 = CC ; } while ( nDegU0 > nDegU1) { CurveComposite CC ; - for( int k = 0 ; k < nSpanU0 ; ++k) + for ( int k = 0 ; k < nSpanU0 ; ++k) CC.AddCurve( BezierIncreaseDegree( GetCurveBezier( CrvU1.GetCurve( k)))) ; ++nDegU1 ; CrvU1 = CC ; @@ -4549,7 +4549,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int for ( int k = 0 ; k < nSpanU0 ; ++k ) { const ICurveBezier* pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( k)) ; for ( int i = 0 ; i < nDegU + 1 ; ++i ) { - if( i != nDegU && !( i == 0 && k == 0)) + if ( i != nDegU && !( i == 0 && k == 0)) continue ; Point3d ptCtrl = pSubCrv0->GetControlPoint( i) ; if ( bRat0) @@ -4564,7 +4564,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int for ( int k = 0 ; k < nSpanU1 ; ++k ) { const ICurveBezier* pSubCrv1 = GetCurveBezier( CrvU1.GetCurve( k)) ; for ( int i = 0 ; i < nDegU1 + 1 ; ++i ) { - if( i != nDegU && !( i == 0 && k == 0)) + if ( i != nDegU && !( i == 0 && k == 0)) continue ; Point3d ptCtrl = pSubCrv1->GetControlPoint( i) ; if ( bRat1) @@ -4613,7 +4613,7 @@ 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) + 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) ; @@ -4658,7 +4658,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int for ( int z = vPnt0Match[i].second ; z <= vPnt0Match[i+1].second ; ++z) bSubCurveAddedFirst = bSubCurveAddedFirst && vPnt1Match[z].second != i ; - if( bSubCurveAddedFirst) { + if ( bSubCurveAddedFirst) { // aggiungo una sottocurva dalla curva U0 pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( i)) ; for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { @@ -4671,7 +4671,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } // ripeto l'ultimo punto aggiunto per il numero di curve balzate - 1 della curva U1 - for( int k = 0 ; k < nIndMatchNext - nIndMatch - 1 ; ++k) { + for ( int k = 0 ; k < nIndMatchNext - nIndMatch - 1 ; ++k) { pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( i != 0 ? i - 1 : i)) ; for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { int nPoint = i == 0 && ! bSubCurveAddedFirst ? 0 : nDegU ; @@ -4683,7 +4683,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ++ nCount0 ; } // se non l'ho già aggiunta prima aggiungo una sottocurva della U0 - if( ! bSubCurveAddedFirst) { + if ( ! bSubCurveAddedFirst) { pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( i)) ; for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { if ( ! bRat0) @@ -4696,7 +4696,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // aggiungo tutte le sottocurve che ho balzato della curva U1 - for( int k = 0 ; k < nIndMatchNext - nIndMatch ; ++k) { + for ( int k = 0 ; k < nIndMatchNext - nIndMatch ; ++k) { pSubCrv0 = GetCurveBezier( CrvU1.GetCurve( nIndMatch + k)) ; for ( int j = nCount1 == 0 ? 0 : 1 ; j < nLastPoint ; ++j ) { if ( ! bRat) @@ -4714,7 +4714,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // riaggiungo l'ultimo punto della U0 const ICurveBezier* pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( nSpanU0 - 1)) ; int nPoint = nDegU ; - while( nCount0 < nSpanU) { + while ( nCount0 < nSpanU) { for ( int j = 1 ; j < nLastPoint ; ++j) { if ( ! bRat0) SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ; @@ -4726,7 +4726,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // aggiungo le restanti sottocurve della curva U1 int nCrv1 = vPnt0Match.back().second ; - while( nCrv1 < nSpanU1) { + while ( nCrv1 < nSpanU1) { const ICurveBezier* pSubCrv1 = GetCurveBezier( CrvU1.GetCurve( nCrv1)) ; for ( int j = 1 ; j < nLastPoint ; ++j) { if ( ! bRat1) @@ -4761,7 +4761,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // prendo la polyline con più punti e scelgo a quali punti dell'altra polyline vanno associati FindMatchByParam( plU0, plU1, vMatch,nLong) ; - for( int i = 0 ; i < int( vMatch.size() - 1) ; ++i) { + for ( int i = 0 ; i < int( vMatch.size() - 1) ; ++i) { int nCount = i ; // span in U aggiunte // scorro i punti della polyline più lunga // se il punto corrente e il successivo sono associati allo stesso punto dell'altra polyline @@ -4874,7 +4874,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int IntersCurvePlane icp( ccPoly0, ptP1, vtDir) ; double dParam ; Point3d ptJoint ; - if( icp.GetIntersCount() > 0) + if ( icp.GetIntersCount() > 0) icp.GetIntersPointNearTo( ptP1, ptJoint, dParam) ; else { DistPointCurve dpc( ptP1, CrvU0, false) ; @@ -4885,14 +4885,14 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // capisco se il punto avrà bisogno di aggiungere uno split sull'altra curva o no int nParam = int( dParam) ; Point3d ptNearestJoint ; // punto più vicino di joint già esistente sulla curva U0 - if( nParam == nSpanU0) + if ( nParam == nSpanU0) CrvU0.GetCurve( nParam - 1)->GetEndPoint( ptNearestJoint) ; - else if( dParam - nParam > 0.5) + else if ( dParam - nParam > 0.5) CrvU0.GetCurve( nParam)->GetEndPoint( ptNearestJoint) ; else CrvU0.GetCurve( nParam)->GetStartPoint( ptNearestJoint) ; //se sono troppo vicino ad uno split esistente allora non faccio nulla - if( abs(dParam - round( dParam)) < 100 * EPS_PARAM || Dist( ptJoint, ptNearestJoint) < 50 * EPS_SMALL) { + if ( abs(dParam - round( dParam)) < 100 * EPS_PARAM || Dist( ptJoint, ptNearestJoint) < 50 * EPS_SMALL) { dParam = round( dParam) ; } @@ -4911,7 +4911,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int Point3d ptJoint ; Vector3d vtDir ; CrvU0.GetCurve( vPnt0.size() - 1)->GetEndDir( vtDir) ; IntersCurvePlane icp( ccPoly1, ptP0, vtDir) ; - if( icp.GetIntersCount() > 0) { + if ( icp.GetIntersCount() > 0) { icp.GetIntersPointNearTo( ptP0, ptJoint, dParam) ; } else { @@ -4923,9 +4923,9 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // capisco se il punto avrà bisogno di aggiungere uno split sull'altra curva o no int nParam = int( dParam) ; Point3d ptNearestJoint ; // punto più vicino di joint già esistente sulla curva U1 - if( nParam == nSpanU1) + if ( nParam == nSpanU1) CrvU1.GetCurve( nParam - 1)->GetEndPoint( ptNearestJoint) ; - else if( dParam - nParam > 0.5) + else if ( dParam - nParam > 0.5) CrvU1.GetCurve( nParam)->GetEndPoint( ptNearestJoint) ; else CrvU1.GetCurve( nParam)->GetStartPoint( ptNearestJoint) ; @@ -4961,8 +4961,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int vPairs.emplace_back( 0, 0) ; bool bAdvance = true ; // verifico i match effettivi tra le polyline - while( bAdvance) { - if( c > ssize(vMatch0) - 1 || j > ssize( vMatch1) - 1) { + while ( bAdvance) { + if ( c > ssize(vMatch0) - 1 || j > ssize( vMatch1) - 1) { LOG_DBG_ERR( GetEGkLogger(), "RLT_B_MINDIST_PLUS: le due curve potrebbero non avere forme coerenti") ; return false ; } @@ -4970,11 +4970,11 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int Point3d ptJoint0 = vMatch0[c].first ; double dParam1 = vMatch1[j].second ; Point3d ptJoint1 = vMatch1[j].first ; - if( bIsClosed1 && dParam0 > nSpanU1 - EPS_SMALL && c < ssize( vMatch0) / 2) { + if ( bIsClosed1 && dParam0 > nSpanU1 - EPS_SMALL && c < ssize( vMatch0) / 2) { dParam0 = 0 ; vMatch0[c].second = dParam0 ; } - if( bIsClosed0 && dParam1 > nSpanU0 - EPS_SMALL && j < ssize( vMatch1) / 2) { + if ( bIsClosed0 && dParam1 > nSpanU0 - EPS_SMALL && j < ssize( vMatch1) / 2) { dParam1 = 0 ; vMatch1[j].second = dParam1 ; } @@ -4987,18 +4987,18 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int int nSplit1 = vdSplit1.size() ; int nSplit0 = vdSplit0.size() ; // se con una polyline sono arrivato alla fine non posso più avanzare - if( c == vMatch0.size()) + if ( c == vMatch0.size()) bAdvance0 = false ; - if( j == vMatch1.size()) + if ( j == vMatch1.size()) bAdvance1 = false ; // se trovo che ho uno spigolo allora procedo con la gestione spigoli - if( vEdgeSplit0[c+1] || vEdgeSplit1[j+1]) { + if ( vEdgeSplit0[c+1] || vEdgeSplit1[j+1]) { bAdvance0 = false ; bAdvance1 = false ; } if ( bAdvance0) { - if( c < dLastParamMatch1 + EPS_SMALL) + if ( c < dLastParamMatch1 + EPS_SMALL) ++c ; // ho match con lo start if ( dParam0 < EPS_SMALL) { @@ -5014,8 +5014,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } else { // ho un match con una joint esistente - if( dParam0 - int( dParam0) < EPS_SMALL) { - if( dParam0 > dLastParamMatch0) + if ( dParam0 - int( dParam0) < EPS_SMALL) { + if ( dParam0 > dLastParamMatch0) vPairs.emplace_back( c + nSplit0, j + nSplit1 + 1) ; else vPairs.emplace_back( c + nSplit0, j + nSplit1) ; @@ -5031,11 +5031,11 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ptLastPointMatch0 = ptJoint0 ; dLastParamMatch1 = c ; ptLastPointMatch1 = vPnt0[c] ; - if( bPerfectMatch) + if ( bPerfectMatch) ++j ; } if ( bAdvance1 && ! bPerfectMatch) { - if( j < dLastParamMatch0 + EPS_SMALL) + if ( j < dLastParamMatch0 + EPS_SMALL) ++j ; // ho un match con lo start if ( dParam1 < EPS_SMALL) { @@ -5051,8 +5051,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } else { // ho un match con una joint esistente - if( dParam1 - int( dParam1) < EPS_SMALL) { - if( dParam1 > dLastParamMatch1) + if ( dParam1 - int( dParam1) < EPS_SMALL) { + if ( dParam1 > dLastParamMatch1) vPairs.emplace_back( c + nSplit0 + 1, j + nSplit1) ; else vPairs.emplace_back( c + nSplit0, j + nSplit1) ; @@ -5069,23 +5069,23 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int dLastParamMatch0 = j ; ptLastPointMatch0 = vPnt1[j] ; } - if( ! bAdvance0 && ! bAdvance1) { + if ( ! bAdvance0 && ! bAdvance1) { // sono arrivato ad un caso di incrocio!! //1. se sono vicino ad uno spigolo su entrambe le curve allora aggiungo dei rep //2. sennò accoppio comunque bool bEdgeFoundOnSecond = false ; - if( vEdgeSplit0[c+1] && vEdgeSplit1[j+1]) { + if ( vEdgeSplit0[c+1] && vEdgeSplit1[j+1]) { // questo caso non è previsto !!!!! e non mi aspetto che avvenga LOG_DBG_ERR( GetEGkLogger(), "RLT_B_MINDIST_PLUS: a not handled mismatch was found") ; } - if( vEdgeSplit0[c+1]) { + if ( vEdgeSplit0[c+1]) { ++c ; ++j ; //cerco se ho uno split anche su U1 entro una distanza che sia al massimo il doppio di quella che c'è col punto a mindist double dDist = 0 ; double dMaxDist = Dist( vPnt0[c], vMatch0[c-1].first) * 2 ; int j_temp = j ; - while( dDist < dMaxDist) { + while ( dDist < dMaxDist) { if ( vEdgeSplit1[j_temp]) { bEdgeFoundOnSecond = true ; break ; @@ -5093,7 +5093,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ++j_temp ; dDist = Dist( vPnt0[c], vPnt1[j_temp]) ; } - if( bEdgeFoundOnSecond) { + if ( bEdgeFoundOnSecond) { // collego i due punti in cui ho il passaggio di un edge e tutti i punti che restano non accoppiati li metto come Rep for ( int i = 0 ; i < j_temp - j + 1 ; ++i) vPairs.emplace_back( c + nSplit0, j + i + nSplit1) ; @@ -5102,14 +5102,14 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ptLastPointMatch0 = vPnt1[j] ; } } - else if( vEdgeSplit1[j+1]) { + else if ( vEdgeSplit1[j+1]) { ++c ; ++j ; //cerco se ho uno split anche su U1 entro una distanza che sia al massimo il doppio di quella che c'è col punto a mindist double dDist = 0 ; double dMaxDist = Dist( vPnt1[j], vMatch1[j-1].first) * 2 ; int c_temp = c ; - while( dDist < dMaxDist) { + while ( dDist < dMaxDist) { if ( vEdgeSplit0[c_temp]) { bEdgeFoundOnSecond = true ; break ; @@ -5117,9 +5117,9 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ++c_temp ; dDist = Dist( vPnt1[j], vPnt0[c_temp]) ; } - if( bEdgeFoundOnSecond) { + if ( bEdgeFoundOnSecond) { // collego i due punti in cui ho il passaggio di un edge e tutti i punti che restano non accoppiati li metto come Rep - for( int i = 0 ; i < c_temp - c + 1 ; ++i) + for ( int i = 0 ; i < c_temp - c + 1 ; ++i) vPairs.emplace_back( c + i + nSplit0, j + nSplit1) ; c = c_temp ; dLastParamMatch1 = c - 1 ; @@ -5156,7 +5156,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int nUnit = nSplit ; CrvU1.AddJoint( dSplit) ; } - if( ! vdSplit0.empty()) + if ( ! vdSplit0.empty()) nUnit = int( vdSplit0.back()) ; for ( int z = int( vdSplit0.size() - 1) ; z >= 0 ; --z) { double dSplit = vdSplit0[z] ; @@ -5204,7 +5204,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int bLast1 = true ; } const ICurveBezier* pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( nCrv0)) ; - for( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { + for ( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { int nInd = i ; // se ho una ripetizione allora riaggiungo l'ultimo punto. Se sono ancora alla curva 0 invece devo aggiungere lo start della curva U0 if ( bRep0 || bLast0) @@ -5215,7 +5215,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int bOk = SetControlPoint( nAddedSpan * nDegU + i, pSubCrv0->GetControlPoint( nInd), pSubCrv0->GetControlWeight( nInd)) ; } const ICurveBezier* pSubCrv1 = GetCurveBezier( CrvU1.GetCurve( nCrv1)) ; - for( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { + for ( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { int nInd = i ; // se ho una ripetizione allora riaggiungo l'ultimo punto. Se sono ancora alla curva 0 invece devo aggiungere lo start della curva U1 if ( bRep1 || bLast1) @@ -5279,7 +5279,7 @@ ParametrizeByLen( const ICurveComposite* pCurve, DBLVECTOR& vParam) DBLVECTOR vLen ; double dLenTot = 0 ; vParam.push_back( 0) ; - for( int i = 0 ; i < nSpanU ; ++i) { + for ( int i = 0 ; i < nSpanU ; ++i) { const ICurve* pSubCrv = pCurve->GetCurve( i) ; double dLen ; pSubCrv->GetLength( dLen) ; dLenTot += dLen ; @@ -5304,7 +5304,7 @@ BuildCommonParam( const DBLMATRIX& mParam, DBLVECTOR& vCommonParam) //riordino ed elimino i doppioni entro una certa tolleranza sort( vCommonParam.begin(), vCommonParam.end()) ; for ( int i = 0 ; i < int(vCommonParam.size()) - 1 ; ++i) { - for( int j = i + 1 ; j < int(vCommonParam.size()) ; ++j) { + for ( int j = i + 1 ; j < int(vCommonParam.size()) ; ++j) { if ( vCommonParam[j] - vCommonParam[i] < EPS_SMALL){ vCommonParam.erase(vCommonParam.begin() + j) ; --j ; @@ -5325,11 +5325,11 @@ SplitByCommonParam( ICURVEPOVECTOR& vCrvBezUnif, DBLVECTOR& vCommonParam, DBLMAT ICurveComposite* pCC = GetCurveComposite(vCrvBezUnif[i]) ; int c = mParam[i].size() - 1 ; DBLVECTOR vParam = mParam[i] ; - for( int j = vCommonParam.size() - 1 ; j >= 0 ; --j) { + for ( int j = vCommonParam.size() - 1 ; j >= 0 ; --j) { // capisco su quale sottocurva devo fare lo split e riconverto il parametro rispetto al numero di sottocurve while ( vCommonParam[j] < vParam[c]) --c ; - if( vCommonParam[j] - vParam[c] > EPS_SMALL) { + if ( vCommonParam[j] - vParam[c] > EPS_SMALL) { double dSplit = (vCommonParam[j] - vParam[c]) / (vParam[c+1] - vParam[c]) + c ; pCC->AddJoint( dSplit) ; vParam.insert( vParam.begin() + c + 1, vCommonParam[j]) ; @@ -5368,14 +5368,14 @@ SurfBezier::CreateBySetOfCurves( const ICURVEPOVECTOR& vCrvBez, bool bReduceToDe // scorro le curve e uniformo tutte in curve di grado 3 non razionale for ( int i = 0 ; i < int( vCrvBez.size()) ; ++i) { const ICurveComposite* pCCFromSet = GetCurveComposite( vCrvBez[i]) ; - if( pCCFromSet == nullptr) + if ( pCCFromSet == nullptr) return false ; PtrOwner pCC( CreateCurveComposite()) ; - for( int j = 0 ; j < int( pCCFromSet->GetCurveCount()) ; ++j) { + for ( int j = 0 ; j < int( pCCFromSet->GetCurveCount()) ; ++j) { const ICurveBezier* pCrvBez = GetCurveBezier( pCCFromSet->GetCurve( j)) ; - if( pCrvBez == nullptr) + if ( pCrvBez == nullptr) return false ; - if( ! pCC->AddCurve( EditBezierCurve( pCrvBez, nDegU, bRat))) + if ( ! pCC->AddCurve( EditBezierCurve( pCrvBez, nDegU, bRat))) return false ; } mParam.emplace_back() ; @@ -5405,14 +5405,14 @@ SurfBezier::CreateBySetOfCurves( const ICURVEPOVECTOR& vCrvBez, bool bReduceToDe vPntCtrl0.push_back( pCrvBez->GetControlPoint( 0)) ; vPntCtrl1.push_back( pCrvBez->GetControlPoint( nDegU)) ; } - if( j==0 ) + if ( j==0 ) vPntCrvs.push_back( vPntCtrl0) ; vPntCrvs.push_back( vPntCtrl1) ; } ////versione nuova //for ( int j = 0 ; j < nSpanU ; ++j ) { - // for( int z = j== 0 ? 0 : 1 ; z < nDegU + 1 ; ++z) { + // for ( int z = j== 0 ? 0 : 1 ; z < nDegU + 1 ; ++z) { // PNTVECTOR vPntCtrl ; // for ( int i = 0 ; i < int( vCrvBezUnif.size()) ; ++i) { // const ICurveComposite* pCC = GetCurveComposite( vCrvBezUnif[i]) ; @@ -5510,7 +5510,7 @@ SurfBezier::CreateBySetOfCurves( const ICURVEPOVECTOR& vCrvBez, bool bReduceToDe mA.col(0) << pt0.x * pt0.x, pt1.x * pt1.x, pt2.x * pt2.x ; mA.col(1) << pt0.x, pt1.x , pt2.x ; mA.col(2) << 1, 1, 1 ; - if( abs( mA.determinant()) < EPS_SMALL) + if ( abs( mA.determinant()) < EPS_SMALL) return false ; Eigen::Vector3d b ( pt0.y, pt1.y, pt2.y) ; Eigen::Vector3d coeff = mA.fullPivLu().solve(b) ; @@ -5562,7 +5562,7 @@ bool SurfBezier::GetAllPatchesIsocurves( bool bUOrV, ICURVEPOVECTOR& vCrv) const { // restituisce tutte le isocurve di separazione tra patch in un parametro o nell'altro - if( bUOrV) { + if ( bUOrV) { for ( int v = 0 ; v < m_nSpanV ; ++v) vCrv.emplace_back( GetCurveOnU( v)) ; } @@ -5592,10 +5592,10 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c { // converto in bezier la curva iniziale CurveComposite CrvU0 ; CrvU0.AddCurve( CurveToBezierCurve(pCurve0)) ; - if( ! CrvU0.IsValid()) + if ( ! CrvU0.IsValid()) return false ; CurveComposite CrvU1 ; CrvU1.AddCurve( CurveToBezierCurve(pCurve1)) ; - if( ! CrvU1.IsValid()) + if ( ! CrvU1.IsValid()) return false ; int nDegU = 3 ; int nDegV = 1 ; @@ -5606,13 +5606,13 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c PNTVECTOR vPnt0, vPnt1 ; Point3d pt ; CrvU0.GetStartPoint( pt) ; vPnt0.push_back( pt) ; - for( int i = 0 ; i < CrvU0.GetCurveCount() ; ++i) { + for ( int i = 0 ; i < CrvU0.GetCurveCount() ; ++i) { CrvU0.GetCurve(i)->GetEndPoint( pt) ; vPnt0.push_back( pt) ; } CrvU1.GetStartPoint( pt) ; vPnt1.push_back( pt) ; - for( int i = 0 ; i < CrvU1.GetCurveCount() ; ++i) { + for ( int i = 0 ; i < CrvU1.GetCurveCount() ; ++i) { CrvU1.GetCurve(i)->GetEndPoint( pt) ; vPnt1.push_back( pt) ; } @@ -5659,7 +5659,7 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c double dLenCurr0 ; CrvU0.GetLengthAtParam( dParam0, dLenCurr0) ; double dLenCurr1 ; CrvU1.GetLengthAtParam( dParam1, dLenCurr1) ; int nPointsBetween0 = 0 ; - if( dParam0 - nLastParam0 > 1) { + if ( dParam0 - nLastParam0 > 1) { if ( ! bIntParam0) nPointsBetween0 = int( dParam0 - nLastParam0) ; else @@ -5668,7 +5668,7 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c else nPointsBetween0 = 0 ; int nPointsBetween1 = 0 ; - if( dParam1 - nLastParam1 > 1) { + if ( dParam1 - nLastParam1 > 1) { if ( ! bIntParam1) nPointsBetween1 = int( dParam1 - nLastParam1) ; else @@ -5676,20 +5676,20 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c } else nPointsBetween1 = 0 ; - if( nPointsBetween0 > 0 || nPointsBetween1 > 0) { + if ( nPointsBetween0 > 0 || nPointsBetween1 > 0) { // calcolo la parametrizzazione locale dei punti compresi tra le due isoparametriche double dLen0 = dLenCurr0 - dLenPrev0 ; double dLen1 = dLenCurr1 - dLenPrev1 ; DBLVECTOR vdParamPos0 ; vdParamPos0.reserve( nPointsBetween0) ; DBLVECTOR vdParamPos1 ; vdParamPos1.reserve( nPointsBetween1) ; - for( int k = 0 ; k < nPointsBetween0 ; ++k) { + for ( int k = 0 ; k < nPointsBetween0 ; ++k) { double dParamIntermed = 0 ; CrvU0.GetParamAtPoint( vPnt0[ nLastParam0 + 1 + k], dParamIntermed) ; double dLen = 0 ; CrvU0.GetLengthAtParam( dParamIntermed, dLen) ; dLen -= dLenPrev0 ; vdParamPos0.push_back( dLen / dLen0) ; } vdParamPos0.push_back( 1) ; - for( int k = 0 ; k < nPointsBetween1 ; ++k) { + for ( int k = 0 ; k < nPointsBetween1 ; ++k) { double dParamIntermed = 0 ; CrvU1.GetParamAtPoint( vPnt1[ nLastParam1 + 1 + k], dParamIntermed) ; double dLen = 0 ; CrvU1.GetLengthAtParam( dParamIntermed, dLen) ; dLen -= dLenPrev1 ; @@ -5699,13 +5699,13 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c bool bSplitToAdd = true ; int c0 = 0, c1 = 0 ; - while( bSplitToAdd) { - if( c0 > ssize( vdParamPos0) - 1 && c1 > ssize( vdParamPos1) - 1) { + while ( bSplitToAdd) { + if ( c0 > ssize( vdParamPos0) - 1 && c1 > ssize( vdParamPos1) - 1) { LOG_DBG_ERR( GetEGkLogger(), "Surf Bez Ruled Guided: error while reparametrizing some section") ; return false ; } // se ho una corrispondenza tra punti ( e non sono alla fine del tratto) allora non aggiungo split - if( abs( vdParamPos0[c0] - vdParamPos1[c1]) < EPS_PARAM && vdParamPos0[c0] < 1) { + if ( abs( vdParamPos0[c0] - vdParamPos1[c1]) < EPS_PARAM && vdParamPos0[c0] < 1) { ++c0 ; ++c1 ; ++nLastParam0 ; @@ -5713,27 +5713,27 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c vPairs.emplace_back( nLastParam0 + nSplit0, nLastParam1 + nSplit1) ; } // se non ho corrispondenza allora aggiungo uno split sulla curva a cui manca il punto corrispondente - else if( vdParamPos0[c0] < vdParamPos1[c1]) { + else if ( vdParamPos0[c0] < vdParamPos1[c1]) { double dPar ; CrvU1.GetParamAtLength( dLenPrev1 + dLen1 * vdParamPos0[c0], dPar) ; if ( abs( dPar - round( dPar)) > EPS_SMALL) { vdSplit1.push_back( dPar) ; nSplit1 = vdSplit1.size() ; } - else if( dPar = round( dPar) ; dPar > nLastParam1){ + else if ( dPar = round( dPar) ; dPar > nLastParam1){ ++ nLastParam1 ; } ++nLastParam0 ; vPairs.emplace_back( nLastParam0 + nSplit0, nLastParam1 + nSplit1) ; ++c0 ; } - else if( vdParamPos0[c0] > vdParamPos1[c1]) { + else if ( vdParamPos0[c0] > vdParamPos1[c1]) { double dPar ; CrvU0.GetParamAtLength( dLenPrev0 + dLen0 * vdParamPos1[c1], dPar) ; // se lo split non è in prossimità di una joint già esistente allora lo aggiungo if ( abs( dPar - round( dPar)) > EPS_SMALL) { vdSplit0.push_back( dPar) ; nSplit0 = vdSplit0.size() ; } - else if( dPar = round( dPar) ; dPar > nLastParam0){ + else if ( dPar = round( dPar) ; dPar > nLastParam0){ ++ nLastParam0 ; } ++nLastParam1 ; @@ -5747,11 +5747,11 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c // salvo i dati di questo accoppiamento dLenPrev0 = dLenCurr0 ; dLenPrev1 = dLenCurr1 ; - if( ! bIntParam0 && dParam0 > dLastParam0) { + if ( ! bIntParam0 && dParam0 > dLastParam0) { vdSplit0.push_back( dParam0) ; nSplit0 = vdSplit0.size() ; } - if( ! bIntParam1 && dParam1 > dLastParam1) { + if ( ! bIntParam1 && dParam1 > dLastParam1) { vdSplit1.push_back( dParam1) ; nSplit1 = vdSplit1.size() ; } @@ -5777,7 +5777,7 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c nUnit = nSplit ; CrvU1.AddJoint( dSplit) ; } - if( ! vdSplit0.empty()) + if ( ! vdSplit0.empty()) nUnit = int( vdSplit0.back()) ; for ( int z = int( vdSplit0.size() - 1) ; z >= 0 ; --z) { double dSplit = vdSplit0[z] ; @@ -5825,7 +5825,7 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c bLast1 = true ; } const ICurveBezier* pSubCrv0 = GetCurveBezier( CrvU0.GetCurve( nCrv0)) ; - for( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { + for ( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { int nInd = i ; // se ho una ripetizione allora riaggiungo l'ultimo punto. Se sono ancora alla curva 0 invece devo aggiungere lo start della curva U0 if ( bRep0 || bLast0) @@ -5836,7 +5836,7 @@ SurfBezier::CreateByIsoParamSet( const ICurve* pCurve0, const ICurve* pCurve1, c bOk = SetControlPoint( nAddedSpan * nDegU + i, pSubCrv0->GetControlPoint( nInd), pSubCrv0->GetControlWeight( nInd)) ; } const ICurveBezier* pSubCrv1 = GetCurveBezier( CrvU1.GetCurve( nCrv1)) ; - for( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { + for ( int i = nAddedSpan == 0 ? 0 : 1 ; i < nLastPoint ; ++ i) { int nInd = i ; // se ho una ripetizione allora riaggiungo l'ultimo punto. Se sono ancora alla curva 0 invece devo aggiungere lo start della curva U1 if ( bRep1 || bLast1) diff --git a/Tree.cpp b/Tree.cpp index 86df55b..5e73b0f 100644 --- a/Tree.cpp +++ b/Tree.cpp @@ -728,7 +728,7 @@ Tree::BuildTree( double dLinTol, double dSideMin, double dSideMax) // ( dSideMinVal è zero se entrambi i lati da splittare sono collassati in un punto, controllo dLengMinVal) bool bSplit = false ; bool bParamDimOk = false ; - if( bVert) + if ( bVert) bParamDimOk = ( pcToSplit->GetTopRight().x - pcToSplit->GetBottomLeft().x) / 2 > 100 * EPS_PARAM ; else bParamDimOk = ( pcToSplit->GetTopRight().y - pcToSplit->GetBottomLeft().y) / 2 > 100 * EPS_PARAM ; @@ -755,9 +755,9 @@ Tree::BuildTree( double dLinTol, double dSideMin, double dSideMax) // sono arrivato ad una cella Leaf, quindi salvo la cella m_vnLeaves.push_back( nCToSplit) ; pcToSplit->SetProcessed() ; - if( AreSamePointApprox( ptP00, ptP01) && AreSamePointApprox( ptP10, ptP11)) + if ( AreSamePointApprox( ptP00, ptP01) && AreSamePointApprox( ptP10, ptP11)) pcToSplit->m_nCollapsed = Cell::Collapsed::VERT_EDGES ; - else if( AreSamePointApprox( ptP00, ptP10) && AreSamePointApprox( ptP01, ptP11)) + else if ( AreSamePointApprox( ptP00, ptP10) && AreSamePointApprox( ptP01, ptP11)) pcToSplit->m_nCollapsed = Cell::Collapsed::HORIZ_EDGES ; else pcToSplit->m_nCollapsed = Cell::Collapsed::NO_COLLAPSE ; @@ -868,9 +868,9 @@ Tree::BuildTree( double dLinTol, double dSideMin, double dSideMax) // sono arrivato ad una cella Leaf, quindi salvo la cella m_vnLeaves.push_back( nCToSplit) ; pcToSplit->SetProcessed() ; - if( AreSamePointApprox( ptP00, ptP01) && AreSamePointApprox( ptP10, ptP11)) + if ( AreSamePointApprox( ptP00, ptP01) && AreSamePointApprox( ptP10, ptP11)) pcToSplit->m_nCollapsed = Cell::Collapsed::VERT_EDGES ; - else if( AreSamePointApprox( ptP00, ptP10) && AreSamePointApprox( ptP01, ptP11)) + else if ( AreSamePointApprox( ptP00, ptP10) && AreSamePointApprox( ptP01, ptP11)) pcToSplit->m_nCollapsed = Cell::Collapsed::HORIZ_EDGES ; else pcToSplit->m_nCollapsed = Cell::Collapsed::NO_COLLAPSE ; @@ -1473,7 +1473,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon int c = 0 ; for ( int nId : m_vnLeaves) { Cell& cell = m_mTree.at( nId) ; - if( cell.m_nCollapsed != Cell::Collapsed::NO_COLLAPSE) + if ( cell.m_nCollapsed != Cell::Collapsed::NO_COLLAPSE) continue ; vVertices.clear() ; vVertices3d.clear() ; @@ -1486,7 +1486,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon std::fill( vbBonusVert.begin(), vbBonusVert.end(), false) ; vnVert.push_back( int(vVertices.size()) - 1) ; GetBottomNeigh( nId, vNeigh) ; - if( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::VERT_EDGES) + if ( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::VERT_EDGES) GetBottomNeigh( vNeigh[0], vNeigh, DBLDBL( cell.GetBottomLeft().x, cell.GetTopRight().x)) ; Point3d ptP00, ptP10, ptP11, ptP01 ; GetPoint( cell.GetBottomLeft().x, cell.GetBottomLeft().y, ptP00) ; @@ -1522,7 +1522,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon bBottomRight = false ; vNeigh.clear() ; GetRightNeigh ( nId, vNeigh) ; - if( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::HORIZ_EDGES) + if ( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::HORIZ_EDGES) GetRightNeigh( vNeigh[0], vNeigh, DBLDBL( cell.GetBottomLeft().y, cell.GetTopRight().y)) ; // aggiungo i vertici che sono sul lato right, solo se ho più di un vicino right if ( vNeigh.size() > 1){ @@ -1564,7 +1564,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon vVertices3d.push_back( pt3d) ; vnVert.push_back( int(vVertices.size()) - 1) ; GetTopNeigh ( nId, vNeigh) ; - if( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::VERT_EDGES) + if ( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::VERT_EDGES) GetTopNeigh( vNeigh[0], vNeigh, DBLDBL( cell.GetBottomLeft().x, cell.GetTopRight().x)) ; std::reverse( vNeigh.begin(), vNeigh.end()) ; // aggiungo i vertici che sono sul lato top, solo se ho più di un vicino top @@ -1596,7 +1596,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon bTopLeft = false ; vNeigh.clear() ; GetLeftNeigh ( nId, vNeigh) ; - if( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::HORIZ_EDGES) + if ( ! vNeigh.empty() && m_mTree.at(vNeigh[0]).m_nCollapsed == Cell::Collapsed::HORIZ_EDGES) GetLeftNeigh( vNeigh[0], vNeigh, DBLDBL( cell.GetBottomLeft().y, cell.GetTopRight().y)) ; std::reverse( vNeigh.begin(), vNeigh.end()) ; // aggiungo i vertici che sono sul lato left, solo se ho più di un vicino left @@ -1679,7 +1679,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon bAlreadyCropped = true ; } if ( AreSamePointApprox(ptP10, ptP11)) { - if( bAlreadyCropped) + if ( bAlreadyCropped) continue ; // sennò devo togliere l'estremo del lato su cui NON ho punti bonus if ( vbBonusVert[0] && ! vbBonusVert[2]){ // lati contati a partire da quello sopra in senso CCW @@ -1707,7 +1707,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon bAlreadyCropped = true ; } if ( AreSamePointApprox(ptP11, ptP01)) { - if( bAlreadyCropped) + if ( bAlreadyCropped) continue ; // sennò devo togliere l'estremo del lato su cui NON ho punti bonus if ( vbBonusVert[1] && ! vbBonusVert[3]){ // lati contati a partire da quello sopra in senso CCW @@ -1735,7 +1735,7 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon bAlreadyCropped = true ; } if ( AreSamePointApprox(ptP01, ptP00)) { - if( bAlreadyCropped) + if ( bAlreadyCropped) continue ; // sennò devo togliere l'estremo del lato su cui NON ho punti bonus if ( vbBonusVert[0] && ! vbBonusVert[2]) { // lati contati a partire da quello sopra in senso CCW @@ -1801,10 +1801,10 @@ Tree::GetPolygonsBasic( POLYLINEVECTOR& vPolygonsBasic, POLYLINEVECTOR& vPolygon int nVertCorr = int(vVerticesCorr.size()); for ( int i = 0 ; i < (int) vVertices.size() ; ++i) { int dPar = i ; - if( ! vbKeepPoint[i]) + if ( ! vbKeepPoint[i]) dPar = -1 ; vPolygonsBasic.back().AddUPoint( dPar, vVertices.at( i)) ; - if( i < nVertCorr){ + if ( i < nVertCorr){ vPolygonsCorrected.back().AddUPoint( dPar, vVerticesCorr.at( i)) ; vPolygons3d.back().AddUPoint( dPar, vVertices3d.at( i)) ; } @@ -2000,7 +2000,7 @@ Tree::UpdateSplitLoop( ICurveComposite* pCC, Point3d& pt) } bAdded = true ; } - if( pCC->IsValid()) { + if ( pCC->IsValid()) { if ( ! bAdded) pCC->AddLine( pt) ; Vector3d vtDir = pt - ptLast ; @@ -2131,7 +2131,7 @@ Tree::TraceLoopLabelCell( const POLYLINEVECTOR& vplPolygons) UpdateSplitLoop( pCCLoopSplit, vptInters.back()) ; } // controllo di aggiungere un punto abbastanza distante dal precedente - if( ! AreSamePointXYEpsilon( vptInters.back(), ptCurr, 10 * EPS_SMALL)) { + if ( ! AreSamePointXYEpsilon( vptInters.back(), ptCurr, 10 * EPS_SMALL)) { // aggiungo la fine del segmento nel vettore delle intersezioni vptInters.push_back( ptCurr) ; // aggiorno la compo splittata @@ -2370,7 +2370,7 @@ Tree::FindInters( int& nId, const CurveLine& clTrim, const PolyLine& plPolygon, if ( icc.GetOverlaps()) { for ( int i = 0 ; i < icc.GetIntersCount() ; ++i) { icc.GetIntCrvCrvInfo( i, iccInfo) ; - if( iccInfo.bOverlap){ + if ( iccInfo.bOverlap){ ptInters = iccInfo.IciA[1].ptI ; break ; } @@ -2378,14 +2378,14 @@ Tree::FindInters( int& nId, const CurveLine& clTrim, const PolyLine& plPolygon, } else { int nLastInters = icc.GetIntersCount() -1 ; - if( nLastInters < 0) + if ( nLastInters < 0) return false ; icc.GetIntCrvCrvInfo( nLastInters, iccInfo) ; ptInters = iccInfo.IciA[0].ptI ; } // determino il lato/vertice di uscita - if( ! OnWhichEdge( nId, ptInters, nEdge)) + if ( ! OnWhichEdge( nId, ptInters, nEdge)) return false ; pCell->m_vInters.back().nOut = nEdge ; // se è risultato che sono abbastanza vicino( di EPS_SMALL) ad un vertice allora il punto aggiunto sarà il vertice vero e proprio @@ -2746,10 +2746,10 @@ Tree::FindInters( int& nId, const CurveLine& clTrim, const PolyLine& plPolygon, //---------------------------------------------------------------------------- bool -Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX& vPolygons3d, INTVECTOR& vToCheck, int& nPoly, INTVECTOR& vnParentChunk, - const PolyLine& plCell, const PolyLine& plCell3d) +Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX& vPolygons3d, INTVECTOR& vToCheck, int& nPoly, + INTVECTOR& vnParentChunk, const PolyLine& plCell, const PolyLine& plCell3d) { - // conto quanti vertici in più ho per lato e creo un vettore dei vertici per lato + // conto quanti vertici in più ho per lato e creo un vettore dei vertici per lato int nId = m_vnLeaves[nLeafId] ; Cell& cCell = m_mTree[nId] ; PNTMATRIX vEdgeVertex(4) ; @@ -2759,38 +2759,36 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX Point3d ptTl = cCell.GetTopLeft() ; Point3d ptBr = cCell.GetBottomRight() ; int nVertToErase = m_mTree.at(nId).m_nVertToErase ; - if( nVertToErase != 2) + if ( nVertToErase != 2) vEdgeVertex[0].push_back( ptTR) ; - if( nVertToErase != 3) + if ( nVertToErase != 3) vEdgeVertex[1].push_back( ptTl) ; - if( nVertToErase != 0) + if ( nVertToErase != 0) vEdgeVertex[2].push_back( ptBL) ; - if( nVertToErase != 1) + if ( nVertToErase != 1) vEdgeVertex[3].push_back( ptBr) ; // capisco se sono in modalità ForTriangulation bool bForTriangulation = plCell3d.GetPointNbr() != 0 ; if ( bForTriangulation) { - if( nVertToErase != 2) { + if ( nVertToErase != 2) { Point3d pt3d ; GetPoint( cCell.GetTopRight().x, cCell.GetTopRight().y, pt3d) ; vEdgeVertex3d[0].push_back( pt3d) ; } - if( nVertToErase != 3){ + if ( nVertToErase != 3) { Point3d pt3d ; GetPoint( cCell.GetBottomLeft().x, cCell.GetTopRight().y, pt3d) ; vEdgeVertex3d[1].push_back( pt3d) ; } - if( nVertToErase != 0) { + if ( nVertToErase != 0) { Point3d pt3d ; GetPoint( cCell.GetBottomLeft().x, cCell.GetBottomLeft().y, pt3d) ; vEdgeVertex3d[2].push_back( pt3d) ; } - if( nVertToErase != 1) { + if ( nVertToErase != 1) { Point3d pt3d ; GetPoint( cCell.GetTopRight().x, cCell.GetBottomLeft().y, pt3d) ; vEdgeVertex3d[3].push_back( pt3d) ; } } - - - // la PolyLine è riempita a partire dal lato bottom + // la PolyLine è riempita a partire dal lato bottom Point3d ptStart, pt3d ; plCell.GetFirstPoint( ptStart) ; if ( bForTriangulation) @@ -3052,7 +3050,7 @@ Tree::CreateCellPolygons( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATRIX if ( dArea > 0) { vPolygons.emplace_back() ; vPolygons.back().push_back(std::move(plTrimmedPoly)) ; - if( bForTriangulation) { + if ( bForTriangulation) { vPolygons3d.emplace_back() ; vPolygons3d.back().push_back(std::move(plTrimmedPoly3d)) ; } @@ -3108,7 +3106,7 @@ Tree::CreateIslandAndHoles( int nLeafId, POLYLINEMATRIX& vPolygons, POLYLINEMATR nChunkBiggestCW = inA.nChunk ; bContained = false ; Inters inB = cCell.m_vInters[0] ; - for( int c = 0 ; c < nInters ; ++ c){ + for ( int c = 0 ; c < nInters ; ++ c){ inB = cCell.m_vInters[c] ; if ( inB.nIn == -1) { if ( inB != inA && inB.nChunk == inA.nChunk && inB.bCCW) { @@ -3367,12 +3365,12 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe int nVertToSkip = m_mTree.at(nId).m_nVertToErase ; // se è il primo punto della PolyLine lo aggiungo if ( plTrimmedPoly.GetPointNbr() == 0) { - // se cerco di aggiungere il vertice che devo saltare, non faccio nulla - if( ( nVertToSkip == 0 && AreSamePointXYApprox( ptToAdd, ptBL)) || + // se cerco di aggiungere il vertice che devo saltare, non faccio nulla + if (( nVertToSkip == 0 && AreSamePointXYApprox( ptToAdd, ptBL)) || ( nVertToSkip == 1 && AreSamePointXYApprox( ptToAdd, ptBr)) || ( nVertToSkip == 2 && AreSamePointXYApprox( ptToAdd, ptTR)) || ( nVertToSkip == 3 && AreSamePointXYApprox( ptToAdd, ptTl))) { - // aggiorno l'ultimo punto aggiunto + // aggiorno l'ultimo punto aggiunto ptLast.Set( ptToAdd.x, ptToAdd.y, 0) ; return true ; } @@ -3421,7 +3419,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe ptVert = ptToAdd ; if ( nVert != nVertToSkip) { plTrimmedPoly.AddUPoint( c, ptVert) ; - if( bForTriangulation){ + if ( bForTriangulation){ Point3d pt3d ; GetPoint( ptVert.x, ptVert.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -3439,7 +3437,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe Point3d ptIntermed = vEdgeVertex[0][t] ; if ( ptIntermed.x > ptToAdd.x && ptIntermed.x < ptLast.x) { plTrimmedPoly.AddUPoint( c, ptIntermed) ; - if( bForTriangulation) + if ( bForTriangulation) plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[0][t]) ; ++ c ; } @@ -3447,7 +3445,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe bool bVert = AreSamePointXYApprox( ptToAdd, ptTl) ; if ( ! ( nVertToSkip == 3 && bVert)) { plTrimmedPoly.AddUPoint( c, ptToAdd) ; - if( bForTriangulation){ + if ( bForTriangulation){ Point3d pt3d ; GetPoint( ptToAdd.x, ptToAdd.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -3460,7 +3458,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe Point3d ptIntermed = vEdgeVertex[1][t] ; if ( ptIntermed.y > ptToAdd.y && ptIntermed.y < ptLast.y) { plTrimmedPoly.AddUPoint( c, ptIntermed) ; - if( bForTriangulation) + if ( bForTriangulation) plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[1][t]) ; ++ c ; } @@ -3468,7 +3466,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe bool bVert = AreSamePointXYApprox( ptToAdd, ptBL) ; if ( ! ( nVertToSkip == 0 && bVert)) { plTrimmedPoly.AddUPoint( c, ptToAdd) ; - if( bForTriangulation) { + if ( bForTriangulation) { Point3d pt3d ; GetPoint( ptToAdd.x, ptToAdd.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -3481,7 +3479,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe Point3d ptIntermed = vEdgeVertex[2][t] ; if ( ptIntermed.x < ptToAdd.x && ptIntermed.x > ptLast.x) { plTrimmedPoly.AddUPoint( c, ptIntermed) ; - if( bForTriangulation) + if ( bForTriangulation) plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[2][t]) ; ++ c ; } @@ -3489,7 +3487,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe bool bVert = AreSamePointXYApprox( ptToAdd, ptBr) ; if ( ! ( nVertToSkip == 1 && bVert)) { plTrimmedPoly.AddUPoint( c, ptToAdd) ; - if( bForTriangulation){ + if ( bForTriangulation){ Point3d pt3d ; GetPoint( ptToAdd.x, ptToAdd.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -3502,7 +3500,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe Point3d ptIntermed = vEdgeVertex[3][t] ; if ( ptIntermed.y < ptToAdd.y && ptIntermed.y > ptLast.y) { plTrimmedPoly.AddUPoint( c, ptIntermed) ; - if( bForTriangulation) + if ( bForTriangulation) plTrimmedPoly3d.AddUPoint( c, vEdgeVertex3d[3][t]) ; ++ c ; } @@ -3510,7 +3508,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe bool bVert = AreSamePointXYApprox( ptToAdd, ptTR) ; if ( ! ( nVertToSkip == 2 && bVert)) { plTrimmedPoly.AddUPoint( c, ptToAdd) ; - if( bForTriangulation) { + if ( bForTriangulation) { Point3d pt3d ; GetPoint( ptToAdd.x, ptToAdd.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -3521,7 +3519,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe // aggiungo e basta else { plTrimmedPoly.AddUPoint( c, ptToAdd) ; - if( bForTriangulation) { + if ( bForTriangulation) { Point3d pt3d ; GetPoint( ptToAdd.x, ptToAdd.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -3531,7 +3529,7 @@ Tree::AddVertex( int nId, const PNTMATRIX& vEdgeVertex, const PNTMATRIX& vEdgeVe // non su un edge, quindi aggiungo e basta else { plTrimmedPoly.AddUPoint( c, ptToAdd) ; - if( bForTriangulation) { + if ( bForTriangulation) { Point3d pt3d ; GetPoint( ptToAdd.x, ptToAdd.y, pt3d) ; plTrimmedPoly3d.AddUPoint( c, pt3d) ; } @@ -4010,14 +4008,14 @@ Tree::GetEdges3D( vector& mCCEdges, POLYLINEVECTOR& vPolygons // scorro sui poligoni delle celle di un lato for ( int c = 0 ; c < int( vEdges[i].size()) ; ++c) { Cell& cNeigh = m_mTree.at(vEdges[i][c]) ; - if( cNeigh.m_vnPolyId.empty()) + if ( cNeigh.m_vnPolyId.empty()) continue ; PolyLine& plCell = vPolygons[cNeigh.m_vnPolyId[0]] ; Point3d pt ; plCell.GetFirstPoint( pt) ; Point3d pt3d ; // a seconda del lato controllo di stare scorrendo il poligono prendendo solo i punti su quel lato if ( i == 0) { - while ( ! AreSamePointXYApprox(pt, cNeigh.GetTopRight()) && plCell.GetNextPoint(pt) ) { + while ( ! AreSamePointXYApprox(pt, cNeigh.GetTopRight()) && plCell.GetNextPoint(pt)) { continue ; } Point3d pt3d ; GetPoint( cNeigh.GetTopRight().x, cNeigh.GetTopRight().y, pt3d) ; @@ -4090,13 +4088,13 @@ Tree::GetEdges3D( vector& mCCEdges, POLYLINEVECTOR& vPolygons mCCEdges.emplace_back() ; INTVECTOR vId ; Point3d ptNear = m_mTree.at(-1).GetBottomLeft() ; - while( m_vCEdge2D[i].second.GetChainFromNear(ptNear, false, vId) ) { + while ( m_vCEdge2D[i].second.GetChainFromNear(ptNear, false, vId)) { PtrOwner pCC3D( CreateCurveComposite()) ; int nInd = abs( vId[0]) - 1 ; Point3d pt2D = m_vCEdge2D[i].first[nInd].first ; Point3d pt3D ; GetPoint( pt2D.x, pt2D.y, pt3D) ; pCC3D->AddPoint( pt3D) ; - for ( int j = 1 ; j < int( vId.size()) ; ++j) { + for ( int j = 1 ; j < ssize( vId) ; ++j) { nInd = abs( vId[j]) - 1 ; pt2D = m_vCEdge2D[i].first[nInd].second ; GetPoint( pt2D.x, pt2D.y, pt3D) ; @@ -4105,7 +4103,7 @@ Tree::GetEdges3D( vector& mCCEdges, POLYLINEVECTOR& vPolygons if ( ! pCC3D->IsValid()) pCC3D->AddPoint( pt3D) ; // qui devo fare dei controlli prima di aggiungere questa polyline? - mCCEdges[i].emplace_back( Release(pCC3D)) ; + mCCEdges[i].emplace_back( Release( pCC3D)) ; } } } @@ -4225,11 +4223,11 @@ Tree::AdjustCuts( void) bool Tree::CreateCellContour( POLYLINEMATRIX& vPolygons) { - // questa funzione è pensata per essere chiamata dopo la AddCutsToRoot, per creare il poligono di un'unica cella a cui sono stati aggiunti dei tagli + // questa funzione è pensata per essere chiamata dopo la AddCutsToRoot, per creare il poligono di un'unica cella a cui sono stati aggiunti dei tagli if ( m_mTree.size() > 1) return false ; int nRoot = -1 ; - // preparo tutto per poter chiamare la createCellPolygon + // preparo tutto per poter chiamare la createCellPolygon m_vnLeaves.push_back( nRoot) ; INTVECTOR vToCheck( m_mTree.at(nRoot).m_vInters.size()) ; iota( vToCheck.begin(), vToCheck.end(), 0) ; @@ -4254,7 +4252,7 @@ Tree::CreateCellContour( POLYLINEMATRIX& vPolygons) pl3d.Close() ; // ora posso creare il poligono della cella con i tagli POLYLINEMATRIX vPolygons3d ; - while( ! vToCheck.empty()) { + while ( ! vToCheck.empty()) { int nPolyBefore = nPoly ; CreateCellPolygons( 0, vPolygons, vPolygons3d, vToCheck, nPoly, vnParentChunk, pl, pl3d) ; // l'aggiunta di vPolygons3d forse è un problema in questo punto. @@ -4264,4 +4262,4 @@ Tree::CreateCellContour( POLYLINEMATRIX& vPolygons) break ; } return true ; -} \ No newline at end of file +} diff --git a/VolZmapCalculus.cpp b/VolZmapCalculus.cpp index 4786ba9..408593a 100644 --- a/VolZmapCalculus.cpp +++ b/VolZmapCalculus.cpp @@ -2294,7 +2294,7 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir, vtN1.Normalize() ; } // altrimenti piano inferiore - else if( nBasInt == 1) { + else if ( nBasInt == 1) { // Punto di intersezione ptInt2 = ptP + vdRoots[0] * vtV ; // Normale alla superficie del cono verso l'interno diff --git a/VolZmapVolume.cpp b/VolZmapVolume.cpp index d0e3921..c15ca17 100644 --- a/VolZmapVolume.cpp +++ b/VolZmapVolume.cpp @@ -935,7 +935,7 @@ VolZmap::TestCompoBBox( int nGrid, const Point3d& ptP1, const Point3d& ptP2, con BBox3d b3Box ; if ( vtV.IsSmall()) b3Box = GetSphereMoveBBox( ptP1, ptP2, dRad) ; - else if( AreSameVectorExact( vtV2, V_NULL)) + else if ( AreSameVectorExact( vtV2, V_NULL)) b3Box = GetCylMoveBBox( ptP1, ptP2, vtV, dMaxRad, dHei) ; else b3Box = GetCylMoveRotBBox( ptP1, ptP2, vtV, vtV2, dRad, dHei) ; @@ -1385,7 +1385,7 @@ IntersLineBezierSurfSet( const Point3d& ptLineStart, const Vector3d& vtLineDir, if ( vInterv.size() == 0) bIntersVol = true ; - if( bIntersVol) { + if ( bIntersVol) { // interseco con le bezier for ( int s = 0 ; s < int( vSurfBez.size()) ; ++s) { // se ho già trovato l'intersezione con questa superficie vado avanti @@ -2699,7 +2699,7 @@ VolZmap::CylBall_ZDrilling( int nGrid, const Point3d & ptS, const Point3d & ptE, double dMaxStemZ = max( max( ptS.z, ptTStemS.z), max( ptE.z, ptTStemE.z)) ; for ( int i = nStartI ; i <= nEndI ; ++ i) { - for( int j = nStartJ ; j <= nEndJ ; ++ j) { + for ( int j = nStartJ ; j <= nEndJ ; ++ j) { double dX = ( i + 0.5) * m_dStep ; double dY = ( j + 0.5) * m_dStep ; Point3d ptC( dX, dY, 0) ; Vector3d vtC = ptC - ptSxy ; @@ -2769,7 +2769,7 @@ VolZmap::CylBall_ZPerp( int nGrid, const Point3d& ptS, const Point3d& ptE, const vtV2.Rotate( Z_AX, 0, 1) ; for ( int i = nStartI ; i <= nEndI ; ++ i) { - for( int j = nStartJ ; j <= nEndJ ; ++ j) { + for ( int j = nStartJ ; j <= nEndJ ; ++ j) { double dX = ( i + 0.5) * m_dStep ; double dY = ( j + 0.5) * m_dStep ; @@ -3189,7 +3189,7 @@ VolZmap::Conus_ZPerp( int nGrid, const Point3d & ptS, const Point3d & ptE, const Point3d ptVE = ptE - vtToolDir * ( dStemHeigth + dL) ; for ( int i = nStartI ; i <= nEndI ; ++ i) { - for( int j = nStartJ ; j <= nEndJ ; ++ j) { + for ( int j = nStartJ ; j <= nEndJ ; ++ j) { double dX = ( i + 0.5) * m_dStep ; double dY = ( j + 0.5) * m_dStep ; @@ -3316,7 +3316,7 @@ VolZmap::Conus_ZPerp( int nGrid, const Point3d & ptS, const Point3d & ptE, const Point3d ptVE = ptE - vtToolDir * ( CurrTool.GetHeigth() - dL) ; for ( int i = nStartI ; i <= nEndI ; ++ i) { - for( int j = nStartJ ; j <= nEndJ ; ++ j) { + for ( int j = nStartJ ; j <= nEndJ ; ++ j) { double dX = ( i + 0.5) * m_dStep ; double dY = ( j + 0.5) * m_dStep ;