EgtGeomKernel 2.5b2 :

- in CurveComposite aggiunta funzione StraightArcsToLines
- in OffsetCurve filtraggio prima dell'esecuzione anche con la funzione precedente.
This commit is contained in:
DarioS
2023-02-20 09:14:23 +01:00
parent 4f60bd24b6
commit 65909b3366
5 changed files with 48 additions and 8 deletions
+35 -2
View File
@@ -2039,7 +2039,7 @@ CurveComposite::ModifyCurveToArc( int nCrv, const Point3d& ptMid)
if ( nCrv < 0 || nCrv > nCrvCount - 1)
return false ;
// recupero la curva corrente
ICurve* pCrv = *(m_CrvSmplS.begin() + nCrv) ;
ICurve* pCrv = m_CrvSmplS[nCrv] ;
// recupero gli estremi
Point3d ptStart, ptEnd ;
if ( ! pCrv->GetStartPoint( ptStart) || ! pCrv->GetEndPoint( ptEnd))
@@ -2072,7 +2072,7 @@ CurveComposite::ModifyCurveToLine( int nCrv)
if ( nCrv < 0 || nCrv > nCrvCount - 1)
return false ;
// recupero la curva corrente
ICurve* pCrv = *(m_CrvSmplS.begin() + nCrv) ;
ICurve* pCrv = m_CrvSmplS[nCrv] ;
// se già linea non devo fare alcunchè
if ( pCrv->GetType() == CRV_LINE)
return true ;
@@ -2880,6 +2880,39 @@ CurveComposite::ArcsBezierCurvesToArcsPerpExtr( double dLinTol, double dAngTolDe
return true ;
}
//----------------------------------------------------------------------------
bool
CurveComposite::StraightArcsToLines( double dLinTol, double dAngTolDeg)
{
// controllo le tolleranze
dLinTol = max( dLinTol, EPS_SMALL) ;
dAngTolDeg = Clamp( dAngTolDeg, EPS_ANG_SMALL, ANG_RIGHT) ;
// verifico le singole curve
for ( auto Iter = m_CrvSmplS.begin() ; Iter != m_CrvSmplS.end() ; ++ Iter) {
CurveArc* pArc = GetBasicCurveArc( *Iter) ;
if ( pArc != nullptr &&
abs( pArc->GetAngCenter()) < dAngTolDeg &&
pArc->GetRadius() * ( 1 - cos( pArc->GetAngCenter() / 2 * DEGTORAD)) < dLinTol) {
// recupero gli estremi
Point3d ptStart, ptEnd ;
if ( ! pArc->GetStartPoint( ptStart) || ! pArc->GetEndPoint( ptEnd))
return false ;
// creo la linea
PtrOwner<CurveLine> pLine( CreateBasicCurveLine()) ;
if ( IsNull( pLine) || ! pLine->Set( ptStart, ptEnd))
return false ;
// elimino la curva originale e la sostituisco con la nuova
delete (*Iter) ;
(*Iter) = Release( pLine) ;
}
}
// imposto ricalcolo della grafica
m_OGrMgr.Reset() ;
return true ;
}
//----------------------------------------------------------------------------
static int
MergeTwoCurves( ICurve* pCrvP, ICurve* pCrvC, double& dCurrLinTol, double dCosAngTol, bool bNeedSameProp)