EgtGeomKernel :

- migliorata GetArc2PVN quando arco diventa una retta
- a CurveComposite aggiunta IsACircle.
This commit is contained in:
Dario Sassi
2017-02-20 18:27:29 +00:00
parent 506e5a5f51
commit 036aa216d3
3 changed files with 45 additions and 2 deletions
+41
View File
@@ -2817,3 +2817,44 @@ CurveComposite::RemoveUndercutOnY( double dLinTol, double dAngTolDeg)
Clear() ;
return AddCurve( Release( pOutLoop)) ;
}
//----------------------------------------------------------------------------
bool
CurveComposite::IsOneCircle( Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const
{
// deve essere una sola entità
if ( GetCurveCount() != 1)
return false ;
// deve essere un arco di circonferenza completo
const CurveArc* pArc = GetBasicCurveArc( GetFirstCurve()) ;
if ( pArc == nullptr || ! pArc->IsACircle())
return false ;
// assegno i parametri
ptCen = pArc->GetCenter() ;
vtN = pArc->GetNormVersor() ;
dRad = pArc->GetRadius() ;
bCCW = ( pArc->GetAngCenter() > 0) ;
return true ;
}
//----------------------------------------------------------------------------
bool
CurveComposite::IsACircle( double dLinTol, Point3d& ptCen, Vector3d& vtN, double& dRad, bool& bCCW) const
{
// deve essere chiusa
if ( ! IsClosed())
return false ;
// se è formata da una sola entità arco che è una circonferenza
if ( IsOneCircle( ptCen, vtN, dRad, bCCW))
return true ;
// provo ad approssimarla con archi e verifico se si riduce ad una circonferenza
PolyArc PA ;
if ( ! ApproxWithArcs( dLinTol, ANG_TOL_STD_DEG, PA))
return false ;
CurveComposite CrvTemp ;
if ( ! CrvTemp.FromPolyArc( PA) || ! CrvTemp.MergeCurves( dLinTol, ANG_TOL_STD_DEG))
return false ;
return CrvTemp.IsOneCircle( ptCen, vtN, dRad, bCCW) ;
}