EgtGeomKernel 1.5a8 : sistemata scalatura non uniforme di archi (sono trasformati in curve di Bezier singole o composite).
Aggiunte costanti geometriche locali.
This commit is contained in:
+38
-42
@@ -15,10 +15,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "GdbObj.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "CurveAux.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EgkCurveBezier.h"
|
||||
#include "/EgtDev/Include/EgkCurveArc.h"
|
||||
#include <new>
|
||||
|
||||
using namespace std ;
|
||||
@@ -124,93 +122,91 @@ GdbObj::Load( const std::string& sType, Scanner& TheScanner, int& nParentId)
|
||||
bool
|
||||
GdbObj::GetLocalBBox( BBox3d& b3Loc) const
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->GetLocalBBox( b3Loc) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->GetLocalBBox( b3Loc) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::GetBBox( const Frame3d& frRef, BBox3d& b3Ref) const
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->GetBBox( frRef, b3Ref) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->GetBBox( frRef, b3Ref) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::Translate( const Vector3d& vtMove)
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->Translate( vtMove) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->Translate( vtMove) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::Rotate( const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng)
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->Rotate( ptAx, vtAx, dCosAng, dSinAng) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::Scale( const Frame3d& frRef, double dCoeffX, double dCoeffY, double dCoeffZ)
|
||||
{
|
||||
if ( m_pGeoObj != nullptr) {
|
||||
// se scalatura non omogenea e arco, devo trasformare in curva di Bezier
|
||||
if ( m_pGeoObj->GetType() == CRV_ARC &&
|
||||
(fabs( dCoeffX - dCoeffY) > EPS_SMALL || fabs( dCoeffX - dCoeffZ) > EPS_SMALL)) {
|
||||
// creo la curva di Bezier
|
||||
PtrOwner<ICurveBezier> pCrvBez( CreateCurveBezier()) ;
|
||||
if ( ! IsValid( pCrvBez))
|
||||
return false ;
|
||||
if ( ! pCrvBez->FromArc( *GetCurveArc( m_pGeoObj)))
|
||||
return false ;
|
||||
// elimino l'arco e lo sostituisco con la curva di Bezier
|
||||
delete m_pGeoObj ;
|
||||
m_pGeoObj = Release( pCrvBez) ;
|
||||
}
|
||||
// eseguo scalatura
|
||||
return m_pGeoObj->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
}
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
// se arco e scalatura non omogenea
|
||||
if ( m_pGeoObj->GetType() == CRV_ARC &&
|
||||
(fabs( dCoeffX - dCoeffY) > EPS_SMALL || fabs( dCoeffX - dCoeffZ) > EPS_SMALL)) {
|
||||
// trasformo in curva di Bezier (semplice o composta)
|
||||
ICurve* pCrvNew ;
|
||||
if ( ! ArcToBezierCurve( GetCurve( m_pGeoObj), pCrvNew))
|
||||
return false ;
|
||||
// elimino l'arco e lo sostituisco con la curva di Bezier
|
||||
delete m_pGeoObj ;
|
||||
m_pGeoObj = pCrvNew ;
|
||||
}
|
||||
|
||||
// eseguo scalatura
|
||||
return m_pGeoObj->Scale( frRef, dCoeffX, dCoeffY, dCoeffZ) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::Mirror( const Point3d& ptOn, const Vector3d& vtNorm)
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->Mirror( ptOn, vtNorm) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->Mirror( ptOn, vtNorm) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::ToGlob( const Frame3d& frRef)
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->ToGlob( frRef) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->ToGlob( frRef) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GdbObj::ToLoc( const Frame3d& frRef)
|
||||
{
|
||||
if ( m_pGeoObj != nullptr)
|
||||
return m_pGeoObj->ToLoc( frRef) ;
|
||||
else
|
||||
if ( m_pGeoObj == nullptr)
|
||||
return false ;
|
||||
|
||||
return m_pGeoObj->ToLoc( frRef) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user