EgtGeomKernel :
- correzioni ad offset di curve per casi da stampa 3d - modifica a creazione superficie swept.
This commit is contained in:
+33
-5
@@ -270,6 +270,17 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
}
|
||||
}
|
||||
|
||||
// aggiorno lunghezza segmenti di retta (possono essere stati allungati)
|
||||
for ( auto iIter = m_CrvLst.begin() ; iIter != m_CrvLst.end() ; ++ iIter) {
|
||||
const ICurve* pCrv = *iIter ;
|
||||
if ( pCrv->GetType() == CRV_LINE) {
|
||||
double dLen ; pCrv->GetLength( dLen) ;
|
||||
int nInd = abs( pCrv->GetTempProp()) - 1 ;
|
||||
if ( nInd >= 0 && nInd < int( vLens.size()))
|
||||
vLens[nInd] = dLen ;
|
||||
}
|
||||
}
|
||||
|
||||
// secondo passo : eliminazione archi invertiti e rette impossibili
|
||||
for ( auto iIter = m_CrvLst.begin() ; iIter != m_CrvLst.end() ;) {
|
||||
ICurve* pCrv = *iIter ;
|
||||
@@ -438,7 +449,7 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
dLenPrev = vLen[i] ;
|
||||
}
|
||||
// se fatta almeno una suddivisione, trimmo l'ultima parte
|
||||
if ( dUPrev > EPS_PARAM) {}
|
||||
if ( dUPrev > EPS_PARAM)
|
||||
pCompo1->TrimStartAtParam( dUPrev) ;
|
||||
|
||||
// sesto passo : se curva aperta, elimino i tratti che stanno nella circonferenza di offset dei punti estremi
|
||||
@@ -661,6 +672,17 @@ OffsetCurve::Make( const ICurve* pCrv, double dDist, int nType)
|
||||
m_CrvLst.sort( []( const ICurve* pA, const ICurve* pB) { return ( pA->GetTempProp() > pB->GetTempProp()) ; }) ;
|
||||
}
|
||||
|
||||
// elimino eventuali curve non uniche molto corte e aperte
|
||||
while ( ( m_CrvLst.size() > 1)) {
|
||||
ICurve* pCrv = m_CrvLst.back() ;
|
||||
if ( ! pCrv->IsClosed() && pCrv->GetTempProp() < 1000 * 50 * EPS_SMALL) {
|
||||
delete( pCrv) ;
|
||||
m_CrvLst.pop_back() ;
|
||||
}
|
||||
else
|
||||
break ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -828,11 +850,14 @@ VerifyAndAdjustSamePoint( ICurve* pCrv1, ICurve* pCrv2, int& nRes)
|
||||
return true ;
|
||||
}
|
||||
// sono in tolleranza, ma devo ricongiungere gli estremi
|
||||
Point3d ptS1, ptE2 ;
|
||||
if ( ! pCrv1->GetStartPoint( ptS1) || ! pCrv2->GetEndPoint( ptE2))
|
||||
return false ;
|
||||
nRes = 0 ;
|
||||
Point3d ptMid = 0.5 * ( ptP1 + ptP2) ;
|
||||
if ( ! pCrv1->ModifyEnd( ptMid))
|
||||
if ( AreSamePointApprox( ptS1, ptMid) || ! pCrv1->ModifyEnd( ptMid))
|
||||
nRes += 1 ;
|
||||
if ( ! pCrv2->ModifyStart( ptMid))
|
||||
if ( AreSamePointApprox( ptMid, ptE2) || ! pCrv2->ModifyStart( ptMid))
|
||||
nRes += 2 ;
|
||||
return true ;
|
||||
}
|
||||
@@ -859,11 +884,14 @@ VerifyAndAdjustInternalAngle( ICurve* pCrv1, ICurve* pCrv2, int& nRes)
|
||||
! intCC.GetIntersPointNearTo( 1, ptMid, ptNew2))
|
||||
return false ;
|
||||
// modifico le due curve sul punto medio di intersezione
|
||||
Point3d ptS1, ptE2 ;
|
||||
if ( ! pCrv1->GetStartPoint( ptS1) || ! pCrv2->GetEndPoint( ptE2))
|
||||
return false ;
|
||||
nRes = 0 ;
|
||||
Point3d ptNew = 0.5 * ( ptNew1 + ptNew2) ;
|
||||
if ( ! pCrv1->ModifyEnd( ptNew))
|
||||
if ( AreSamePointApprox( ptS1, ptNew) || ! pCrv1->ModifyEnd( ptNew))
|
||||
nRes += 1 ;
|
||||
if ( ! pCrv2->ModifyStart( ptNew))
|
||||
if ( AreSamePointApprox( ptNew, ptE2) || ! pCrv2->ModifyStart( ptNew))
|
||||
nRes += 2 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
+1
-1
@@ -364,7 +364,7 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, bool bCapEnds, d
|
||||
while ( bPoint) {
|
||||
// nuova curva
|
||||
OffsetCurve OffsCrv ;
|
||||
if ( ! OffsCrv.Make( pGuide, ptP.x, ICurve::OFF_FILLET) || OffsCrv.GetCurveCount() > 1)
|
||||
if ( ! OffsCrv.Make( pGuide, ptP.x, ICurve::OFF_FILLET) || OffsCrv.GetCurveCount() == 0)
|
||||
return nullptr ;
|
||||
PtrOwner<ICurve> pCurrCrv( OffsCrv.GetLongerCurve()) ;
|
||||
if ( IsNull( pCurrCrv))
|
||||
|
||||
Reference in New Issue
Block a user