EgtGeomKernel 1.6b7 :
- aggiunto calcolo baricentro di Curve - migliorata gestione richiesta nuovo Id - aggiunta intersezione linea-piano e linea-triangolo - corretto errore in PointGrid3d con 1 solo punto (non faceva alcunchè) - aggiunte funzioni di accesso a dati di SurfTM.
This commit is contained in:
+41
-4
@@ -18,6 +18,7 @@
|
||||
#include "CurveLine.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CurveBezier.h"
|
||||
#include "PolygonPlane.h"
|
||||
#include "GeoConst.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
@@ -74,7 +75,7 @@ CurveComposite::AddCurve( const ICurve& cCrv, bool bEndOrStart, double dLinTol)
|
||||
// se curva semplice
|
||||
if ( cCrv.IsSimple()) {
|
||||
// creo una copia della curva
|
||||
ICurve* pSmplCrv = GetCurve( cCrv.Clone()) ;
|
||||
ICurve* pSmplCrv = ::GetCurve( cCrv.Clone()) ;
|
||||
if ( pSmplCrv == nullptr)
|
||||
return false ;
|
||||
// inserisco la curva
|
||||
@@ -93,7 +94,7 @@ CurveComposite::AddCurve( const ICurve& cCrv, bool bEndOrStart, double dLinTol)
|
||||
pCrvOri = ( bEndOrStart ? pCrvCompo->GetFirstCurve() : pCrvCompo->GetLastCurve()) ;
|
||||
while ( pCrvOri != nullptr) {
|
||||
// creo una copia della curva
|
||||
pSmplCrv = GetCurve( pCrvOri->Clone()) ;
|
||||
pSmplCrv = ::GetCurve( pCrvOri->Clone()) ;
|
||||
if ( pSmplCrv == nullptr)
|
||||
return false ;
|
||||
// inserisco la curva
|
||||
@@ -274,7 +275,7 @@ CurveComposite::FromSplit( const ICurve& cCrv, int nParts)
|
||||
for ( int i = 1 ; i <= nParts ; ++ i) {
|
||||
dStartLen = dEndLen ;
|
||||
dEndLen = dTotLen * i / (double) nParts ;
|
||||
PtrOwner<ICurve> pSmplCrv( GetCurve( cCrv.Clone())) ;
|
||||
PtrOwner<ICurve> pSmplCrv( ::GetCurve( cCrv.Clone())) ;
|
||||
if ( IsNull( pSmplCrv))
|
||||
return false ;
|
||||
if ( ! pSmplCrv->TrimEndAtLen( dEndLen) ||
|
||||
@@ -503,7 +504,7 @@ CurveComposite::CopyFrom( const IGeoObj* pGObjSrc)
|
||||
if ( pCC != nullptr)
|
||||
return CopyFrom( *pCC) ;
|
||||
// se sorgente è un'altro tipo di curva
|
||||
const ICurve* pCrv = GetCurve( pGObjSrc) ;
|
||||
const ICurve* pCrv = ::GetCurve( pGObjSrc) ;
|
||||
if ( pCrv != nullptr) {
|
||||
Clear() ;
|
||||
pCrv->GetExtrusion( m_VtExtr) ;
|
||||
@@ -944,6 +945,28 @@ CurveComposite::GetMidPoint( Point3d& ptMid) const
|
||||
return GetPointD1D2( dMid, FROM_MINUS, ptMid) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetCentroid( Point3d& ptCen) const
|
||||
{
|
||||
// verifico lo stato
|
||||
if ( m_nStatus != OK)
|
||||
return false ;
|
||||
// approssimo la curva con una polilinea
|
||||
PolyLine PL ;
|
||||
if ( ! ApproxWithLines( LIN_TOL_STD, ANG_TOL_STD_DEG, PL))
|
||||
return false ;
|
||||
// calcolo il centro mediante PolygonPlane
|
||||
Point3d ptP ;
|
||||
PolygonPlane PolyPlane ;
|
||||
for ( bool bFound = PL.GetFirstPoint( ptP) ; bFound ; bFound = PL.GetNextPoint( ptP))
|
||||
PolyPlane.AddPoint( ptP) ;
|
||||
if ( PolyPlane.GetCentroid( ptCen))
|
||||
return true ;
|
||||
// se non riuscito, uso il punto medio
|
||||
return GetMidPoint( ptCen) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveComposite::GetMidDir( Vector3d& vtDir) const
|
||||
@@ -1921,6 +1944,20 @@ CurveComposite::LocToLoc( const Frame3d& frOri, const Frame3d& frDest)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const ICurve*
|
||||
CurveComposite::GetCurve( int nCrv) const
|
||||
{
|
||||
// la curva deve essere validata
|
||||
if ( m_nStatus != OK)
|
||||
return nullptr ;
|
||||
// verifico che l'indice sia nei limiti
|
||||
if ( nCrv < 0 || nCrv >= int( m_CrvSmplS.size()))
|
||||
return nullptr ;
|
||||
// restituisco la curva
|
||||
return m_CrvSmplS[nCrv] ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const ICurve*
|
||||
CurveComposite::GetFirstCurve( void) const
|
||||
|
||||
Reference in New Issue
Block a user