From eaa2eedb1620ab49bcc006c1650c419eb731768b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 27 Jul 2015 13:37:13 +0000 Subject: [PATCH] Include : - aggiunta EGkCurveByApprox - sistemazioni varie. --- EGkCurveByApprox.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++ EGkCurveByInterp.h | 6 +++--- EXeConst.h | 6 +++--- EXeExecutor.h | 2 ++ 4 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 EGkCurveByApprox.h diff --git a/EGkCurveByApprox.h b/EGkCurveByApprox.h new file mode 100644 index 0000000..8957194 --- /dev/null +++ b/EGkCurveByApprox.h @@ -0,0 +1,54 @@ +//---------------------------------------------------------------------------- +// EgalTech 2015-2015 +//---------------------------------------------------------------------------- +// File : EGkCurveByApprox.h Data : 23.07.15 Versione : 1.6g7 +// Contenuto : Dichiarazione della classe CurveByApprox. +// +// +// +// Modifiche : 23.07.15 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include"/EgtDev/Include/EGkGeoCollection.h" + +class ICurve ; +class PolyLine ; +class PolyArc ; + +//----------------------- Macro per import/export ---------------------------- +#undef EGK_EXPORT +#if defined( I_AM_EGK) // da definirsi solo nella DLL + #define EGK_EXPORT __declspec( dllexport) +#else + #define EGK_EXPORT __declspec( dllimport) +#endif + +//---------------------------------------------------------------------------- +class CurveByApprox +{ + + public : + EGK_EXPORT bool Reset( void) ; + EGK_EXPORT bool AddPoint( const Point3d& ptP) ; + EGK_EXPORT ICurve* GetCurve( int nType, double dLinTol, double dAngTolDeg, double dLinFea) ; + + public : + EGK_EXPORT enum TYPE { BIARCS = 1, CUBIC_BEZIERS = 2} ; + + private : + bool CalcAkimaTangents( bool bCorner) ; + bool CalcBesselTangents( void) ; + bool CalcSplitPoints( double dLinTol, double dAngTolDeg, double dLinFea) ; + bool BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAngTolDeg, PolyArc& PA) const ; + + private : + PNTVECTOR m_vPnt ; + DBLVECTOR m_vPar ; + VCT3DVECTOR m_vPrevDer ; + VCT3DVECTOR m_vNextDer ; + INTVECTOR m_vSplits ; +} ; diff --git a/EGkCurveByInterp.h b/EGkCurveByInterp.h index 2cbddce..16483e6 100644 --- a/EGkCurveByInterp.h +++ b/EGkCurveByInterp.h @@ -30,9 +30,8 @@ class CurveByInterp { public : - EGK_EXPORT bool Start( void) ; + EGK_EXPORT bool Reset( void) ; EGK_EXPORT bool AddPoint( const Point3d& ptP) ; - EGK_EXPORT bool End( void) ; EGK_EXPORT ICurve* GetCurve( int nMethod, int nType) ; public : @@ -40,7 +39,8 @@ class CurveByInterp EGK_EXPORT enum TYPE { BIARCS = 1, CUBIC_BEZIERS = 2} ; private : - bool CalcTangents( int nMethod) ; + bool CalcAkimaTangents( bool bDetectCorner) ; + bool CalcBesselTangents( void) ; private : PNTVECTOR m_vPnt ; diff --git a/EXeConst.h b/EXeConst.h index e5bdbd8..8d17d80 100644 --- a/EXeConst.h +++ b/EXeConst.h @@ -27,9 +27,9 @@ enum RefType{ RTY_GLOB = 0, const int RTY_DEFAULT = RTY_LOC ; //----------------- Costanti tipo di interpolazione ---------------------------- -enum InterpType{ ITT_AKIMA = 0, // curve risultanti archi - ITT_AKIMA_CORNER = 1, // curve risultanti archi - ITT_BESSEL = 2} ; // curve risultanti Bezier cubiche +enum InterpType{ ITT_ARCS = 0, // stima tg Akima, curve risultanti archi + ITT_ARCS_CORNER = 1, // stima tg AkimaCorner, curve risultanti archi + ITT_CUBICS = 2} ; // stima tg Bessel, curve risultanti Bezier cubiche //----------------- Costanti tipo di approssimazione di curve ------------------ enum ApprType{ APP_LINES = 0, // come ICurve::APL_STD diff --git a/EXeExecutor.h b/EXeExecutor.h index 9668a7a..c5436a3 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -174,6 +174,8 @@ EXE_EXPORT int ExeCreateCurveCompo( int nParentId, const INTVECTOR& vIds, bool EXE_EXPORT int ExeCreateCurveCompoByChain( int nParentId, const INTVECTOR& vIds, const Point3d& ptNear, bool bErase, int nRefType, int* pnCount) ; EXE_EXPORT int ExeCreateCurveCompoByInterpolation( int nParentId, const PolyLine& PL, int nType, int nRefType) ; +EXE_EXPORT int ExeCreateCurveCompoByApproximation( int nParentId, const PolyLine& PL, int nType, + double dLinTol, int nRefType) ; EXE_EXPORT int ExeCreateCurveCompoFromPoints( int nParentId, const PolyLine& PL, int nRefType) ; EXE_EXPORT int ExeCreateCurveCompoFromPointBulges( int nParentId, const PolyArc& PA, int nRefType) ; EXE_EXPORT int ExeCreateRectangle2P( int nParentId, const Point3d& ptIni,