EgtGeomKernel :
- pulizia codice.
This commit is contained in:
+208
-209
@@ -3885,41 +3885,70 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
|
||||
// se sto usando la ISOPARM o la MINDIST semplice allora collego più span di una curva allo 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
|
||||
PNTIVECTOR vPnt0Match, vPnt1Match ;
|
||||
bool bCommonPoint = false ;
|
||||
AssociatePolyLinesMinDistPoints( plU0, plU1, vPnt0Match, vPnt1Match, bCommonPoint) ;
|
||||
if ( nRuledType == RLT_B_MINDIST) {
|
||||
// creo le liste di punti per le isoparametriche in U
|
||||
PNTIVECTOR vPnt0Match, vPnt1Match ;
|
||||
bool bCommonPoint = false ;
|
||||
AssociatePolyLinesMinDistPoints( plU0, plU1, vPnt0Match, vPnt1Match, bCommonPoint) ;
|
||||
|
||||
// devo contare il numero di ripetizioni dei match nel mezzo delle curve, perché aumentano il numero di span della superficie!!
|
||||
int nRep0 = 0 ;
|
||||
int nIndMatch = 0 ;
|
||||
int nIndMatchNext = 0 ;
|
||||
for ( int i = 0 ; i < int( vPnt0Match.size() - 1) ; ++i) {
|
||||
nIndMatch = vPnt0Match[i].second ;
|
||||
nIndMatchNext = vPnt0Match[i+1].second ;
|
||||
if ( nIndMatch != nIndMatchNext)
|
||||
nRep0 += nIndMatchNext - nIndMatch - 1;
|
||||
}
|
||||
int nRep1 = int( vPnt1Match.size() - 1) - vPnt0Match.back().second ;
|
||||
// reinizializzo la superficie con il nuovo numero di span in U
|
||||
nSpanU = nSpanU0 + nRep0 + nRep1 ;
|
||||
if ( nSpanU < max(nSpanU0, nSpanU1))
|
||||
nSpanU = max(nSpanU0, nSpanU1) ;
|
||||
nSecondRowInd = nDegU * nSpanU + 1 ;
|
||||
Init( nDegU, nDegV, nSpanU, nSpanV, bRat) ;
|
||||
// devo contare il numero di ripetizioni dei match nel mezzo delle curve, perché aumentano il numero di span della superficie!!
|
||||
int nRep0 = 0 ;
|
||||
int nIndMatch = 0 ;
|
||||
int nIndMatchNext = 0 ;
|
||||
for ( int i = 0 ; i < int( vPnt0Match.size() - 1) ; ++i) {
|
||||
nIndMatch = vPnt0Match[i].second ;
|
||||
nIndMatchNext = vPnt0Match[i+1].second ;
|
||||
if ( nIndMatch != nIndMatchNext)
|
||||
nRep0 += nIndMatchNext - nIndMatch - 1;
|
||||
}
|
||||
int nRep1 = int( vPnt1Match.size() - 1) - vPnt0Match.back().second ;
|
||||
// reinizializzo la superficie con il nuovo numero di span in U
|
||||
nSpanU = nSpanU0 + nRep0 + nRep1 ;
|
||||
if ( nSpanU < max(nSpanU0, nSpanU1))
|
||||
nSpanU = max(nSpanU0, nSpanU1) ;
|
||||
nSecondRowInd = nDegU * nSpanU + 1 ;
|
||||
Init( nDegU, nDegV, nSpanU, nSpanV, bRat) ;
|
||||
|
||||
// numero di span aggiunte su U0 e U1
|
||||
nCount0 = 0 ;
|
||||
nCount1 = 0 ;
|
||||
// numero di span aggiunte su U0 e U1
|
||||
nCount0 = 0 ;
|
||||
nCount1 = 0 ;
|
||||
|
||||
// scorro gli estremi delle sottocurve della curva 1
|
||||
for ( int i = 0 ; i < int( vPnt0Match.size() - 1) ; ++i) {
|
||||
nIndMatch = vPnt0Match[i].second ;
|
||||
nIndMatchNext = vPnt0Match[i+1].second ;
|
||||
const ICurveBezier* pSubCrv0 ;
|
||||
if ( nIndMatch == nIndMatchNext) {
|
||||
// scorro gli estremi delle sottocurve della curva 1
|
||||
for ( int i = 0 ; i < int( vPnt0Match.size() - 1) ; ++i) {
|
||||
nIndMatch = vPnt0Match[i].second ;
|
||||
nIndMatchNext = vPnt0Match[i+1].second ;
|
||||
const ICurveBezier* pSubCrv0 ;
|
||||
if ( nIndMatch == nIndMatchNext) {
|
||||
pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( i)) ;
|
||||
for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) {
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount0 ;
|
||||
// ripeto l'ultimo punto aggiunto alla riga 2
|
||||
int nInd = nIndMatch - 1 ;
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU1->GetCurve( nInd)) ;
|
||||
for ( int j = nCount1 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) {
|
||||
int nPoint = nCount1 == 0 ? 0 : nDegU ;
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( nPoint), pSubCrv0->GetControlWeight( nPoint)) ;
|
||||
}
|
||||
++nCount1 ;
|
||||
}
|
||||
else {
|
||||
// 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 = 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)
|
||||
@@ -3928,84 +3957,13 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount0 ;
|
||||
// ripeto l'ultimo punto aggiunto alla riga 2
|
||||
int nInd = nIndMatch - 1 ;
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU1->GetCurve( nInd)) ;
|
||||
for ( int j = nCount1 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) {
|
||||
int nPoint = nCount1 == 0 ? 0 : nDegU ;
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( nPoint), pSubCrv0->GetControlWeight( nPoint)) ;
|
||||
}
|
||||
++nCount1 ;
|
||||
}
|
||||
else {
|
||||
// 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 = 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)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount0 ;
|
||||
}
|
||||
|
||||
// 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 = i == 0 && ! bSubCurveAddedFirst ? 0 : nDegU ;
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ;
|
||||
else
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint), pSubCrv0->GetControlWeight( nPoint)) ;
|
||||
}
|
||||
++ nCount0 ;
|
||||
}
|
||||
// se non l'ho già aggiunta prima aggiungo una sottocurva della U0
|
||||
if( ! bSubCurveAddedFirst) {
|
||||
pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( i)) ;
|
||||
for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) {
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount0 ;
|
||||
}
|
||||
|
||||
|
||||
// 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 ) {
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//controllo se ho aggiunto tutti i punti della curva U1
|
||||
if ( vPnt0Match.back().second != nSpanU1) {
|
||||
// riaggiungo l'ultimo punto della U0
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nSpanU0 - 1)) ;
|
||||
int nPoint = nDegU ;
|
||||
while( nCount0 < nSpanU) {
|
||||
for ( int j = 1 ; j < nLastPoint ; ++j) {
|
||||
// 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 = i == 0 && ! bSubCurveAddedFirst ? 0 : nDegU ;
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ;
|
||||
else
|
||||
@@ -4013,113 +3971,95 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
}
|
||||
++ nCount0 ;
|
||||
}
|
||||
|
||||
// aggiungo le restanti sottocurve della curva U1
|
||||
int nCrv1 = vPnt0Match.back().second ;
|
||||
while( nCrv1 < nSpanU1) {
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nCrv1)) ;
|
||||
for ( int j = 1 ; j < nLastPoint ; ++j) {
|
||||
if ( ! bRat1)
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv1->GetControlPoint( j)) ;
|
||||
// se non l'ho già aggiunta prima aggiungo una sottocurva della U0
|
||||
if( ! bSubCurveAddedFirst) {
|
||||
pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( i)) ;
|
||||
for ( int j = nCount0 == 0 ? 0 : 1 ; j < nLastPoint ; ++j) {
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv1->GetControlPoint( j), pSubCrv1->GetControlWeight( j)) ;
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount0 ;
|
||||
}
|
||||
|
||||
|
||||
// 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 ) {
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv0->GetControlPoint( j), pSubCrv0->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount1 ;
|
||||
++ nCrv1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( nRuledType == RLT_B_ISOPAR) {
|
||||
// inizializzo la superficie
|
||||
Init( nDegU, nDegV, nSpanU, nSpanV, bRat) ;
|
||||
Point3d ptP0Start ; pCrvU0->GetStartPoint( ptP0Start) ;
|
||||
Point3d ptP1Start ; pCrvU1->GetStartPoint( ptP1Start) ;
|
||||
// setto i primi due punti delle righe
|
||||
nCount0 = 0 ; // sottocurva su pCrvU0
|
||||
if ( ! bRat)
|
||||
SetControlPoint( 0, ptP0Start) ;
|
||||
else
|
||||
SetControlPoint( 0, ptP0Start, vdW0[0]) ;
|
||||
nCount1 = 0 ; // sottocurva su pCrvU1
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd, ptP1Start) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd, ptP1Start, vdW1[0]) ;
|
||||
|
||||
INTVECTOR vMatch ;
|
||||
int nLong = 0 ;
|
||||
// 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) {
|
||||
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
|
||||
// allora devo aggiungere la sottocurva della curva più lunga e ripetere l'ultimo punto aggiunto dell'altra polyline
|
||||
// se il corrente e il successivo sono associati a punti successivi
|
||||
// allora devo aggiungere una sottocurva per ognuna delle due curve
|
||||
if ( vMatch[i] == vMatch[i+1]) {
|
||||
// se la curva più lunga è la prima
|
||||
if ( nLong == 0) {
|
||||
// aggiungo la curva sulla prima riga
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nCount0)) ;
|
||||
Point3d ptCtrl = pSubCrv0->GetControlPoint( i) ;
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv0->GetControlWeight( i) ;
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
++ nCount0 ;
|
||||
// riaggungo lo start point sulla seconda riga
|
||||
// o end point se ho già aggiunto tutte le curve
|
||||
int nInd = nCount1 < nSpanU1 ? 0 : nDegU ;
|
||||
int nSubCrv = nCount1 < nSpanU1 ? nCount1 : nSpanU1 - 1 ;
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nSubCrv)) ;
|
||||
Point3d ptCtrl = pSubCrv1->GetControlPoint( nInd) ;
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv1->GetControlWeight( i) ;
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// aggiungo la curva sulla seconda riga
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nCount1)) ;
|
||||
Point3d ptCtrl = pSubCrv1->GetControlPoint( i) ;
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv1->GetControlWeight( i) ;
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
++ nCount1 ;
|
||||
// riaggungo lo start point sulla prima riga
|
||||
// o end point se ho già aggiunto tutte le curve
|
||||
int nInd = nCount0 < nSpanU0 ? 0 : nDegU ;
|
||||
int nSubCrv = nCount0 < nSpanU0 ? nCount0 : nSpanU0 - 1 ;
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nSubCrv)) ;
|
||||
Point3d ptCtrl = pSubCrv0->GetControlPoint( nInd) ;
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv0->GetControlWeight( i) ;
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
//controllo se ho aggiunto tutti i punti della curva U1
|
||||
if ( vPnt0Match.back().second != nSpanU1) {
|
||||
// riaggiungo l'ultimo punto della U0
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nSpanU0 - 1)) ;
|
||||
int nPoint = nDegU ;
|
||||
while( nCount0 < nSpanU) {
|
||||
for ( int j = 1 ; j < nLastPoint ; ++j) {
|
||||
if ( ! bRat0)
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint)) ;
|
||||
else
|
||||
SetControlPoint( nCount0 * nDegU + j, pSubCrv0->GetControlPoint( nPoint), pSubCrv0->GetControlWeight( nPoint)) ;
|
||||
}
|
||||
// altrimenti aggiungo una sottocurva da entrambe le curve
|
||||
else {
|
||||
++ nCount0 ;
|
||||
}
|
||||
|
||||
// aggiungo le restanti sottocurve della curva U1
|
||||
int nCrv1 = vPnt0Match.back().second ;
|
||||
while( nCrv1 < nSpanU1) {
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nCrv1)) ;
|
||||
for ( int j = 1 ; j < nLastPoint ; ++j) {
|
||||
if ( ! bRat1)
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv1->GetControlPoint( j)) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd + nCount1 * nDegU + j, pSubCrv1->GetControlPoint( j), pSubCrv1->GetControlWeight( j)) ;
|
||||
}
|
||||
++ nCount1 ;
|
||||
++ nCrv1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( nRuledType == RLT_B_ISOPAR) {
|
||||
// inizializzo la superficie
|
||||
Init( nDegU, nDegV, nSpanU, nSpanV, bRat) ;
|
||||
Point3d ptP0Start ; pCrvU0->GetStartPoint( ptP0Start) ;
|
||||
Point3d ptP1Start ; pCrvU1->GetStartPoint( ptP1Start) ;
|
||||
// setto i primi due punti delle righe
|
||||
nCount0 = 0 ; // sottocurva su pCrvU0
|
||||
if ( ! bRat)
|
||||
SetControlPoint( 0, ptP0Start) ;
|
||||
else
|
||||
SetControlPoint( 0, ptP0Start, vdW0[0]) ;
|
||||
nCount1 = 0 ; // sottocurva su pCrvU1
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd, ptP1Start) ;
|
||||
else
|
||||
SetControlPoint( nSecondRowInd, ptP1Start, vdW1[0]) ;
|
||||
|
||||
INTVECTOR vMatch ;
|
||||
int nLong = 0 ;
|
||||
// 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) {
|
||||
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
|
||||
// allora devo aggiungere la sottocurva della curva più lunga e ripetere l'ultimo punto aggiunto dell'altra polyline
|
||||
// se il corrente e il successivo sono associati a punti successivi
|
||||
// allora devo aggiungere una sottocurva per ognuna delle due curve
|
||||
if ( vMatch[i] == vMatch[i+1]) {
|
||||
// se la curva più lunga è la prima
|
||||
if ( nLong == 0) {
|
||||
// aggiungo la curva sulla prima riga
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nCount0)) ;
|
||||
@@ -4132,6 +4072,22 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
}
|
||||
}
|
||||
++ nCount0 ;
|
||||
// riaggungo lo start point sulla seconda riga
|
||||
// o end point se ho già aggiunto tutte le curve
|
||||
int nInd = nCount1 < nSpanU1 ? 0 : nDegU ;
|
||||
int nSubCrv = nCount1 < nSpanU1 ? nCount1 : nSpanU1 - 1 ;
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nSubCrv)) ;
|
||||
Point3d ptCtrl = pSubCrv1->GetControlPoint( nInd) ;
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv1->GetControlWeight( i) ;
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// aggiungo la curva sulla seconda riga
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nCount1)) ;
|
||||
@@ -4144,10 +4100,50 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
}
|
||||
}
|
||||
++ nCount1 ;
|
||||
// riaggungo lo start point sulla prima riga
|
||||
// o end point se ho già aggiunto tutte le curve
|
||||
int nInd = nCount0 < nSpanU0 ? 0 : nDegU ;
|
||||
int nSubCrv = nCount0 < nSpanU0 ? nCount0 : nSpanU0 - 1 ;
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nSubCrv)) ;
|
||||
Point3d ptCtrl = pSubCrv0->GetControlPoint( nInd) ;
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv0->GetControlWeight( i) ;
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// altrimenti aggiungo una sottocurva da entrambe le curve
|
||||
else {
|
||||
// aggiungo la curva sulla prima riga
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
const ICurveBezier* pSubCrv0 = GetCurveBezier( pCrvU0->GetCurve( nCount0)) ;
|
||||
Point3d ptCtrl = pSubCrv0->GetControlPoint( i) ;
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv0->GetControlWeight( i) ;
|
||||
SetControlPoint( nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
++ nCount0 ;
|
||||
// aggiungo la curva sulla seconda riga
|
||||
for ( int i = 1 ; i < nLastPoint ; ++i) {
|
||||
const ICurveBezier* pSubCrv1 = GetCurveBezier( pCrvU1->GetCurve( nCount1)) ;
|
||||
Point3d ptCtrl = pSubCrv1->GetControlPoint( i) ;
|
||||
if ( ! bRat)
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl) ;
|
||||
else {
|
||||
double dW = pSubCrv1->GetControlWeight( i) ;
|
||||
SetControlPoint( nSecondRowInd + nCount * nDegU + i, ptCtrl, dW) ;
|
||||
}
|
||||
}
|
||||
++ nCount1 ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// spezzo le curve di bezier dove è necessario aggiungere dei punti
|
||||
else if ( nRuledType == RLT_B_MINDIST_PLUS ) { // probabilmente se questo funziona bene non serve la modilità ISOPARM_SMOOTH
|
||||
@@ -4371,7 +4367,6 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nSpanU0 = pCrvU0->GetCurveCount() ;
|
||||
nSpanU1 = pCrvU1->GetCurveCount() ;
|
||||
//aggiusto i vettori delle ripetizioni in modo in modo che non arrivino mai ad essere contemporaneamente true
|
||||
@@ -4454,6 +4449,10 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
++ nAddedSpan ;
|
||||
}
|
||||
}
|
||||
else if ( RLT_B_LENPAR ) {
|
||||
// da implementare
|
||||
return false ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user