EgtGeomKernel :
- miglioramento delle rigate con bezier.
This commit is contained in:
+36
-8
@@ -5054,6 +5054,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
PNTUVECTOR vMatch1 ;
|
||||
PNTUVECTOR vMatch1b ;
|
||||
PNTVECTOR vPnt1 ; vPnt1.emplace_back( ptP1) ;
|
||||
BOOLVECTOR vbMismatch1( plU1.GetPointNbr() - 1) ;
|
||||
fill( vbMismatch1.begin(), vbMismatch1.end(), false) ;
|
||||
while ( plU1.GetNextPoint( ptP1, true)) {
|
||||
Vector3d vtDirPrev ; CrvU1.GetCurve( vPnt1.size() - 1)->GetEndDir( vtDirPrev) ;
|
||||
Vector3d vtDirCurr ; CrvU1.GetCurve( vPnt1.size())->GetStartDir( vtDirCurr) ;
|
||||
@@ -5072,9 +5074,10 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
if ( icp.GetIntersCount() > 0) {
|
||||
icp.GetIntersPointNearTo( ptP1, ptJoint, dParam) ;
|
||||
AdjustParamFromApprox( plApproxU0, dParam) ;
|
||||
if ( Dist( ptP1, ptJoint) > 2 * Dist( ptP1, ptMinDist)) {
|
||||
if ( Dist( ptP1, ptJoint) > 1.5 * Dist( ptP1, ptMinDist)) {
|
||||
ptJoint = ptMinDist ;
|
||||
dParam = dParamMinDist ;
|
||||
vbMismatch1[ssize(vMatch1b) - 1] = true ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -5113,6 +5116,8 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
PNTUVECTOR vMatch0 ;
|
||||
PNTUVECTOR vMatch0b ;
|
||||
PNTVECTOR vPnt0 ; vPnt0.emplace_back( ptP0) ;
|
||||
BOOLVECTOR vbMismatch0( plU0.GetPointNbr() - 1) ;
|
||||
fill( vbMismatch0.begin(), vbMismatch0.end(), false) ;
|
||||
while ( plU0.GetNextPoint( ptP0, true)) {
|
||||
Vector3d vtDirPrev ; CrvU0.GetCurve( vPnt0.size() - 1)->GetEndDir( vtDirPrev) ;
|
||||
Vector3d vtDirCurr ; CrvU0.GetCurve( vPnt0.size())->GetStartDir( vtDirCurr) ;
|
||||
@@ -5131,9 +5136,10 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
if ( icp.GetIntersCount() > 0) {
|
||||
icp.GetIntersPointNearTo( ptP0, ptJoint, dParam) ;
|
||||
AdjustParamFromApprox( plApproxU1, dParam) ;
|
||||
if ( Dist( ptP0, ptJoint) > 2 * Dist( ptP0, ptMinDist)) {
|
||||
if ( Dist( ptP0, ptJoint) > 1.5 * Dist( ptP0, ptMinDist)) {
|
||||
ptJoint = ptMinDist ;
|
||||
dParam = dParamMinDist ;
|
||||
vbMismatch0[ssize(vMatch0b) - 1] = true ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -5184,14 +5190,25 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
// tramite due misure diverse della distanza
|
||||
INTINTVECTOR vMismatch0 ;
|
||||
INTINTVECTOR vMismatch1 ;
|
||||
//double dMaxDist = Dist( vPnt0[0], vPnt1[0]) / 20 ;
|
||||
DBLVECTOR vdDistMismatch0 ;
|
||||
double dMaxDist = Dist( vPnt0[0], vPnt1[0]) / 3 ;
|
||||
double dMinDist = Dist( vPnt0[0], vPnt1[0]) / 20 ;
|
||||
for ( int i = 0 ; i < ssize( vMatch0) ; ++i) {
|
||||
vdDistMismatch0.push_back( Dist( vMatch0[i].first, vMatch0b[i].first)) ;
|
||||
if ( ! AreSamePointEpsilon( vMatch0[i].first, vMatch0b[i].first, dMaxDist)) {
|
||||
int c = i + 1 ;
|
||||
while ( ! AreSamePointEpsilon( vMatch0[c].first, vMatch0b[c].first, dMaxDist))
|
||||
// scorro in avanti
|
||||
while ( ! AreSamePointEpsilon( vMatch0[c].first, vMatch0b[c].first, dMinDist) || vbMismatch0[c]) {
|
||||
vdDistMismatch0.push_back( Dist( vMatch0[c].first, vMatch0b[c].first)) ;
|
||||
++c ;
|
||||
vMismatch0.emplace_back( i, c) ;
|
||||
}
|
||||
vdDistMismatch0.push_back( Dist( vMatch0[c].first, vMatch0b[c].first)) ;
|
||||
//scorro indietro
|
||||
int p = i - 1 ;
|
||||
while ( p > 0 && ! AreSamePointEpsilon( vMatch0[p].first, vMatch0b[p].first, dMinDist) || vbMismatch0[p]) {
|
||||
--p ;
|
||||
}
|
||||
vMismatch0.emplace_back( p, c) ;
|
||||
i = c ;
|
||||
}
|
||||
}
|
||||
@@ -5209,12 +5226,23 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
}
|
||||
vMismatch0.resize( nCurr + 1) ;
|
||||
|
||||
DBLVECTOR vdDistMismatch1 ;
|
||||
for ( int i = 0 ; i < ssize( vMatch1) ; ++i) {
|
||||
vdDistMismatch1.push_back( Dist( vMatch1[i].first, vMatch1b[i].first)) ;
|
||||
if ( ! AreSamePointEpsilon( vMatch1[i].first, vMatch1b[i].first, dMaxDist)) {
|
||||
int c = i + 1 ;
|
||||
while ( ! AreSamePointEpsilon( vMatch1[c].first, vMatch1b[c].first, dMaxDist))
|
||||
// scorro in avanti
|
||||
while ( ! AreSamePointEpsilon( vMatch1[c].first, vMatch1b[c].first, dMinDist) || vbMismatch1[c]) {
|
||||
vdDistMismatch1.push_back( Dist( vMatch1[c].first, vMatch1b[c].first)) ;
|
||||
++c ;
|
||||
vMismatch1.emplace_back( i, c) ;
|
||||
}
|
||||
vdDistMismatch1.push_back( Dist( vMatch1[c].first, vMatch1b[c].first)) ;
|
||||
// scorro indietro
|
||||
int p = i - 1 ;
|
||||
while ( p > 0 && ! AreSamePointEpsilon( vMatch1[p].first, vMatch1b[p].first, dMinDist) || vbMismatch1[p]) {
|
||||
--p ;
|
||||
}
|
||||
vMismatch1.emplace_back( p, c) ;
|
||||
i = c ;
|
||||
}
|
||||
}
|
||||
@@ -5633,7 +5661,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
if ( c_temp + 1 > dLastParamMatch1)
|
||||
pCC0.Set( CrvU0.CopyParamRange( dLastParamMatch1, c_temp + 1)) ;
|
||||
if ( j_temp + 1 > dLastParamMatch0)
|
||||
pCC1.Set( CrvU1.CopyParamRange( dLastParamMatch0, j_temp + 1)) ;
|
||||
pCC1.Set( CrvU1.CopyParamRange( dLastParamMatch0, j_temp + 1)) ;
|
||||
nPointsBetween0 = int( c_temp + 1 - floor( dLastParamMatch1) - 1) ;
|
||||
nPointsBetween1 = int( j_temp + 1 - floor( dLastParamMatch0) - 1) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user