From c7035305e2d20af1ccc5f4b3a247c8a099d0d941 Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Tue, 9 Jul 2024 15:47:47 +0200 Subject: [PATCH] =?UTF-8?q?EgtGeomKernel=20:=20-=20correzione=20alle=20rig?= =?UTF-8?q?ate=20Bezier=20nella=20modalit=C3=A0=20MinDist.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SurfBezier.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/SurfBezier.cpp b/SurfBezier.cpp index d145113..fde7db5 100644 --- a/SurfBezier.cpp +++ b/SurfBezier.cpp @@ -3884,7 +3884,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int int nSecondRowInd = nDegU * nSpanU + 1 ; // se sto usando la ISOPARM o la MINDIST semplice allora collego più span di una curva allo stesso punto - // ( aggiungo virtualmente delle span alla curva che localmente ne ha di meno, semplicemente riprendo più volte lo stesso punto) + // ( aggiungo delle span alla curva che localmente ne ha di meno, semplicemente riprendo più volte lo stesso punto) if ( nRuledType != RLT_B_MINDIST_PLUS){ if ( nRuledType == RLT_B_MINDIST) { // creo le liste di punti per le isoparametriche in U @@ -3929,7 +3929,6 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } ++ nCount0 ; // ripeto l'ultimo punto aggiunto alla riga 2 - //int nInd = nIndMatch == nSpanU1 ? nIndMatch - 1 : nIndMatch ; int nInd = nIndMatch - 1 ; const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU1->GetCurve( nInd)) ; for ( int j = nCount1 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { @@ -3945,10 +3944,12 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int // qui devo capire se aggiungere la nuova sottocurva prima o dopo la ripetizione dei punti // se il match del punto della U1 è uguale al punto a cui ero arrivato sulla U0 allora prima aggiungo la ripetizione di punti // se invece il match è più avanti allora aggiuno prima la curva e poi la ripetzione di punti - bool bSubCurveAddedFirst = false ; - if ( vPnt1Match[vPnt0Match[i+1].second].second != i+1 ) { - bSubCurveAddedFirst = true ; - // aggiungo una sottocurva dalla prima curva + bool bSubCurveAddedFirst = true ; + for ( int z = vPnt0Match[i].second ; z <= vPnt0Match[i+1].second ; ++z) + bSubCurveAddedFirst = bSubCurveAddedFirst && vPnt1Match[z].second != i ; + + if( bSubCurveAddedFirst) { + // aggiungo una sottocurva dalla curva U0 pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( i)) ; for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { if ( ! bRat0) @@ -3959,11 +3960,11 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ++ nCount0 ; } - // ripeto l'ultimo punto aggiunto per il numero di curve balzate della seconda curva - 1 + // ripeto l'ultimo punto aggiunto per il numero di curve balzate - 1 della curva U1 for( int k = 0 ; k < nIndMatchNext - nIndMatch - 1 ; ++k) { pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( i != 0 ? i - 1 : i)) ; for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { - int nPoint = nCount0 == 0 && ! bSubCurveAddedFirst ? 0 : nDegU ; + int nPoint = i == 0 && ! bSubCurveAddedFirst ? 0 : nDegU ; if ( ! bRat0) SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ; else @@ -3971,9 +3972,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } ++ nCount0 ; } - // se non l'ho già aggiunta prima aggiungo una sottocurva della prima curva + // se non l'ho già aggiunta prima aggiungo una sottocurva della U0 if( ! bSubCurveAddedFirst) { - // aggiungo una sottocurva dalla prima curva pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( i)) ; for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) { if ( ! bRat0) @@ -3985,7 +3985,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } - // aggiungo tutte le sottocurve che ho balzato della seconda + // aggiungo tutte le sottocurve che ho balzato della curva U1 for( int k = 0 ; k < nIndMatchNext - nIndMatch ; ++k) { pSubCrv0 = GetCurveBezier( pCrvU1->GetCurve( nIndMatch + k)) ; for ( int j = nCount1 == 0 ? 0 : 1 ; j < nLastPoint ; ++j ) { @@ -3999,12 +3999,12 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int } } - //controllo se ho aggiunto tutti i punti della seconda curva + //controllo se ho aggiunto tutti i punti della curva U1 if ( vPnt0Match.back().second != nSpanU1) { - // riaggiungo l'ultimo punto + // riaggiungo l'ultimo punto della U0 const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nSpanU0 - 1)) ; int nPoint = nDegU ; - while( nCount0 - 1 < nSpanU1) { + while( nCount0 < nSpanU) { for ( int j = 1 ; j < nLastPoint ; ++j) { if ( ! bRat0) SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ; @@ -4014,7 +4014,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int ++ nCount0 ; } - // aggiungo le restanti sottocurve della curva 2 + // aggiungo le restanti sottocurve della curva U1 int nCrv1 = vPnt0Match.back().second ; while( nCrv1 < nSpanU1) { const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nCrv1)) ;