EgtGeomKernel :
- correzioni e migliorie a offset3d - creato enum per angoli di una curva proiettata su superficie. - aggiunta funzione per l'estensione delle superfici.
This commit is contained in:
+31
-23
@@ -61,7 +61,7 @@ OffsetCurve3d::Reset( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
OffsetCurve3d::Make( const PolyLine& PL, const VCT3DVECTOR& vOffDir, double dOffDist, int nType)
|
||||
OffsetCurve3d::Make( const PNT5AXVECTOR& vPnt5Ax, double dOffDist, int nType)
|
||||
{
|
||||
// la funzione è pensata per lavorare con il risultato dell'operazione ProjectCurveOnSurf
|
||||
|
||||
@@ -70,6 +70,18 @@ OffsetCurve3d::Make( const PolyLine& PL, const VCT3DVECTOR& vOffDir, double dOff
|
||||
|
||||
// pulisco tutto
|
||||
Reset() ;
|
||||
|
||||
INTVECTOR vFlag ;
|
||||
VCT3DVECTOR vOffDir ;
|
||||
PolyLine PL ;
|
||||
for ( int i = 0 ; i < ssize( vPnt5Ax) ; ++i) {
|
||||
PL.AddUPoint( i, vPnt5Ax[i].ptP) ;
|
||||
vOffDir.push_back( vPnt5Ax[i].vtDir1) ;
|
||||
if ( vPnt5Ax[i].nFlag > 0)
|
||||
vFlag.push_back( vPnt5Ax[i].nFlag) ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
PtrOwner<CurveComposite> pCrv( CreateBasicCurveComposite()) ;
|
||||
if ( ! pCrv->FromPolyLine( PL))
|
||||
return false ;
|
||||
@@ -116,25 +128,6 @@ OffsetCurve3d::Make( const PolyLine& PL, const VCT3DVECTOR& vOffDir, double dOff
|
||||
|
||||
bool bClosed = pCrv->IsClosed() ;
|
||||
|
||||
INTVECTOR vFlag ;
|
||||
vFlag.push_back( OffsetCurve3d::AngType::ANG_STR) ;
|
||||
const ICurve* pSubCrv = pCrv->GetFirstCurve() ;
|
||||
const double dSinAngSmall = sin( 1 * DEGTORAD) ;
|
||||
for ( int i = 1 ; i < pCrv->GetCurveCount() ; ++i) {
|
||||
pSubCrv = pCrv->GetNextCurve() ;
|
||||
Vector3d vtDirCurr ; pSubCrv->GetStartDir( vtDirCurr) ;
|
||||
vtDirCurr.Normalize() ;
|
||||
int nFlag ;
|
||||
double dProj = vtDirCurr * vOffDir[i-1] ;
|
||||
if ( dProj > dSinAngSmall)
|
||||
nFlag = OffsetCurve3d::AngType::ANG_SMOOTH_CONC ;
|
||||
else if ( dProj > - dSinAngSmall)
|
||||
nFlag = OffsetCurve3d::AngType::ANG_STR ;
|
||||
else
|
||||
nFlag = OffsetCurve3d::AngType::ANG_CVEX ;
|
||||
vFlag.push_back( nFlag) ;
|
||||
}
|
||||
|
||||
for ( int i = 1 ; i < ssize( vFlag) - 1 ; ++i) {
|
||||
if ( vFlag[i-1] == OffsetCurve3d::AngType::ANG_SMOOTH_CONC &&
|
||||
vFlag[i+1] == OffsetCurve3d::AngType::ANG_SMOOTH_CONC &&
|
||||
@@ -148,12 +141,23 @@ OffsetCurve3d::Make( const PolyLine& PL, const VCT3DVECTOR& vOffDir, double dOff
|
||||
Vector3d vtCorrPrev ;
|
||||
Vector3d vtTangPrev ;
|
||||
Vector3d vtDirPrev ; pCrv->GetStartDir( vtDirPrev) ;
|
||||
if ( bClosed) {
|
||||
Vector3d vtDirLast ; pCrv->GetEndDir( vtDirLast) ;
|
||||
if ( vFlag[0] != OffsetCurve3d::AngType::ANG_CVEX)
|
||||
vtTangPrev = Media( vtDirLast, vtDirPrev) ;
|
||||
else if ( vFlag[0] == OffsetCurve3d::AngType::ANG_CVEX && vFlag.back() != OffsetCurve3d::AngType::ANG_CVEX)
|
||||
vtTangPrev = vtDirLast ;
|
||||
else
|
||||
vtTangPrev = vtDirPrev ;
|
||||
}
|
||||
const ICurve* pCrvPrev = pCrv->GetFirstCurve() ;
|
||||
const ICurve* pCrvCurr ;
|
||||
OFFSETSEGVEC vOffsetCrvs ;
|
||||
Vector3d vtDirPrevOff = V_INVALID ;
|
||||
for ( int i = 1 ; i < pCrv->GetCurveCount() ; ++i) {
|
||||
for ( int i = 1 ; i <= pCrv->GetCurveCount() ; ++i) {
|
||||
pCrvCurr = pCrv->GetNextCurve() ;
|
||||
if ( pCrvCurr == nullptr && bClosed && vFlag[i] == OffsetCurve3d::AngType::ANG_CVEX)
|
||||
pCrvCurr = pCrv->GetFirstCurve() ;
|
||||
Vector3d vtOffDir = vOffDir[i] ;
|
||||
Vector3d vtDirCurr ; pCrvCurr->GetStartDir( vtDirCurr) ;
|
||||
pCrvPrev->GetStartDir( vtDirPrev) ;
|
||||
@@ -239,7 +243,8 @@ OffsetCurve3d::Make( const PolyLine& PL, const VCT3DVECTOR& vOffDir, double dOff
|
||||
Point3d ptP ; vOffsetCrvs.front().pCrv->GetStartPoint( ptP) ;
|
||||
ICurveLine* pCL = CreateBasicCurveLine() ;
|
||||
pCL->Set( ptPrev, ptP) ;
|
||||
vOffsetCrvs.emplace_back( pCL, OffsetCurve3d::AngType::ANG_STR, -1) ;
|
||||
if ( pCL->IsValid())
|
||||
vOffsetCrvs.emplace_back( pCL, OffsetCurve3d::AngType::ANG_STR, -1) ;
|
||||
}
|
||||
|
||||
// qui faccio la correzione per gli angoli interni
|
||||
@@ -400,7 +405,10 @@ CalcAdjustConcavePartsInPath( const ICurveComposite* pCrv, const OFFSETSEGVEC& v
|
||||
while ( nFlag == OffsetCurve3d::AngType::ANG_SMOOTH_CONC) {
|
||||
vLines.push_back( i) ;
|
||||
++i ;
|
||||
nFlag = vOffsetCrvs[i].nFlag ;
|
||||
if ( i < ssize( vOffsetCrvs))
|
||||
nFlag = vOffsetCrvs[i].nFlag ;
|
||||
else
|
||||
nFlag = OffsetCurve3d::AngType::ANG_STR ;
|
||||
}
|
||||
CYLVECT vCyl ;
|
||||
// creo un cilindro della dimensione del raggio
|
||||
|
||||
Reference in New Issue
Block a user