EgtGeomKernel :
- ulteriore miglioramento alle rigate con le bezier.
This commit is contained in:
+54
-26
@@ -42,6 +42,7 @@
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#define EIGEN_NO_IO
|
||||
#include "/EgtDev/Extern/Eigen/Dense"
|
||||
#include "/EgtDev/Include/EGkGeoObjSave.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -4843,6 +4844,20 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
int nFlag = 0 ;
|
||||
double dParam ; dpc.GetParamAtMinDistPoint( 0, dParam, nFlag) ;
|
||||
Point3d ptJoint ; dpc.GetMinDistPoint( 0, ptJoint, nFlag) ;
|
||||
// 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)
|
||||
CrvU0.GetCurve( nParam - 1)->GetEndPoint( ptNearestJoint) ;
|
||||
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) {
|
||||
dParam = round( dParam) ;
|
||||
}
|
||||
|
||||
vMatch1.push_back( pair<Point3d,double>( ptJoint, dParam)) ;
|
||||
}
|
||||
Point3d ptP0 ; plU0.GetFirstPoint( ptP0) ;
|
||||
@@ -4852,6 +4867,19 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
int nFlag = 0 ;
|
||||
double dParam ; dpc.GetParamAtMinDistPoint( 0, dParam, nFlag) ;
|
||||
Point3d ptJoint ; dpc.GetMinDistPoint( 0, ptJoint, nFlag) ;
|
||||
// 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)
|
||||
CrvU1.GetCurve( nParam - 1)->GetEndPoint( ptNearestJoint) ;
|
||||
else if( dParam - nParam > 0.5)
|
||||
CrvU1.GetCurve( nParam)->GetEndPoint( ptNearestJoint) ;
|
||||
else
|
||||
CrvU1.GetCurve( nParam)->GetStartPoint( ptNearestJoint) ;
|
||||
// se sono già troppo vicino ad un split esistente allora non faccio nulla
|
||||
if ( abs(dParam - round( dParam)) < 100 * EPS_PARAM || Dist( ptJoint, ptNearestJoint) < 50 * EPS_SMALL) {
|
||||
dParam = round( dParam) ;
|
||||
}
|
||||
vMatch0.push_back( pair<Point3d,double>( ptJoint, dParam)) ;
|
||||
}
|
||||
|
||||
@@ -4874,12 +4902,14 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
if( bIsClosed1 && dParam > nSpanU1 - EPS_SMALL)
|
||||
dParam = 0 ;
|
||||
vMatch0[c].second = dParam ;
|
||||
// ho match con lo start
|
||||
if ( dParam < EPS_SMALL) {
|
||||
++nAtStart1 ;
|
||||
vbRep0[c] = true ;
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
// ho un match con l'end
|
||||
else if ( dParam > nSpanU1 - EPS_SMALL ) {
|
||||
vbRep0[c] = nAtEnd1 == 0 ? false : true ;
|
||||
vbRep0.back() = true ;
|
||||
@@ -4887,6 +4917,11 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
// ho un match con una joint esistente
|
||||
else if( dParam - int( dParam) < EPS_SMALL) {
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
if ( dParam <= dLastParamMatch || AreSamePointApprox( ptJoint, ptLastPointMatch)) {
|
||||
dParam = dLastParamMatch ;
|
||||
vbRep0[c] = true ;
|
||||
@@ -4897,19 +4932,6 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
else {
|
||||
dLastParamMatch = dParam ;
|
||||
ptLastPointMatch = ptJoint ;
|
||||
int nParam = int( dParam) ;
|
||||
Point3d ptNearestJoint ; // punto più vicino di joint già esistente sulla curva U1
|
||||
if( nParam == nSpanU1)
|
||||
CrvU1.GetCurve( nParam - 1)->GetEndPoint( ptNearestJoint) ;
|
||||
else if( dParam - nParam > 0.5)
|
||||
CrvU1.GetCurve( nParam)->GetEndPoint( ptNearestJoint) ;
|
||||
else
|
||||
CrvU1.GetCurve( nParam)->GetStartPoint( ptNearestJoint) ;
|
||||
// se sono già troppo vicino ad un split esistente allora non faccio nulla
|
||||
if ( abs(dParam - round( dParam)) < 100 * EPS_PARAM || Dist( ptJoint, ptNearestJoint) < 50 * EPS_SMALL) {
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
vdSplit0.push_back( dParam) ;
|
||||
// verifico se ho un match per questo punto
|
||||
// in tal caso vuol dire che sto creando una ripetizione nRep1
|
||||
@@ -4955,12 +4977,14 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
Point3d ptJoint = vMatch1[c].first ;
|
||||
if ( bIsClosed0 && dParam > nSpanU0 - EPS_SMALL)
|
||||
dParam = 0 ;
|
||||
// ho un match con lo start
|
||||
if ( dParam < EPS_SMALL) {
|
||||
++nAtStart0 ;
|
||||
vbRep1[c] = true ;
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
// ho un match con l'end
|
||||
else if ( dParam > nSpanU0 - EPS_SMALL ) {
|
||||
vbRep1[c] = nAtEnd0 == 0 ? false : true ;
|
||||
vbRep1.back() = true ;
|
||||
@@ -4968,6 +4992,11 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
// ho un match con una joint esistente
|
||||
else if( dParam - int( dParam) < EPS_SMALL) {
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
if ( dParam <= dLastParamMatch || AreSamePointApprox( ptJoint, ptLastPointMatch)) {
|
||||
dParam = dLastParamMatch ;
|
||||
vbRep1[c] = true ;
|
||||
@@ -4978,19 +5007,7 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
else {
|
||||
dLastParamMatch = dParam ;
|
||||
ptLastPointMatch = ptJoint ;
|
||||
int nParam = int( dParam) ;
|
||||
Point3d ptNearestJoint ; // punto più vicino di joint già esistente sulla curva U0
|
||||
if( nParam == nSpanU0)
|
||||
CrvU0.GetCurve( nParam - 1)->GetEndPoint( ptNearestJoint) ;
|
||||
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) {
|
||||
++c ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
vdSplit1.push_back( dParam) ;
|
||||
// verifico se ho un match per questo punto
|
||||
// in tal caso vuol dire che sto creando una ripetizione nRep0
|
||||
@@ -5173,6 +5190,17 @@ SurfBezier::CreateByTwoCurves( const ICurve* pCurve0, const ICurve* pCurve1, int
|
||||
++ nAddedSpan ;
|
||||
}
|
||||
|
||||
//debug
|
||||
ICURVEPOVECTOR vCrv ;
|
||||
GetAllPatchesIsocurves( false, vCrv) ;
|
||||
vector<IGeoObj*> vGeo ;
|
||||
for( int i = 0 ; i < int(vCrv.size()); ++i)
|
||||
vGeo.push_back( vCrv[i]) ;
|
||||
vector<Color> vCol( vGeo.size()) ;
|
||||
fill( vCol.begin(), vCol.end(), Color( 255, 0 ,128)) ;
|
||||
SaveGeoObj( vGeo, vCol, "D:/Temp/bezier/ruled/isoCurves.nge") ;
|
||||
//debug
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
else if ( RLT_B_LENPAR ) {
|
||||
|
||||
Reference in New Issue
Block a user