From 09edd2497b6fdbb6a29b52cff4e4036d7e5b132a Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 22 Nov 2013 14:57:50 +0000 Subject: [PATCH] Include : aggiunto EGkGeoVector3d.h per interfaccia. --- EGkGeoConst.h | 32 ++++++++++++++++---------------- EGkGeoObjType.h | 20 ++++++++++---------- EGkGeoPoint3d.h | 10 ++++++++++ EGkGeoVector3d.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ EGkPoint3d.h | 4 ++++ EGkVector3d.h | 7 +++++++ 6 files changed, 91 insertions(+), 26 deletions(-) create mode 100644 EGkGeoVector3d.h diff --git a/EGkGeoConst.h b/EGkGeoConst.h index de291e1..d2e339f 100644 --- a/EGkGeoConst.h +++ b/EGkGeoConst.h @@ -16,25 +16,25 @@ //----------------- Costanti generali ---------------------------------------- // unità di lunghezza di riferimento : millimetro -#define ONEMM 1 -#define ONEINCH 25.4 +const double ONEMM = 1.0 ; +const double ONEINCH = 25.4 ; // epsilon per lunghezze e versori -#define EPS_SMALL (1e-3) -#define EPS_ZERO (1e-7) +const double EPS_SMALL = 1e-3 ; +const double EPS_ZERO = 1e-7 ; // infinito per lunghezze -#define INFINITO (1e10) - -// epsilon per gli angoli (in gradi) -#define EPS_ANG_SMALL (1e-3) -#define EPS_ANG_ZERO (1e-7) -#define SIN_EPS_ANG_SMALL (EPS_ANG_SMALL*DEGTORAD) -#define SIN_EPS_ANG_ZERO (EPS_ANG_ZERO*DEGTORAD) -#define COS_ORTO_ANG_SMALL SIN_EPS_ANG_SMALL -#define COS_ORTO_ANG_ZERO SIN_EPS_ANG_ZERO +const double INFINITO = 1e10 ; // conversione da gradi a radianti e viceversa -#define PIGRECO (3.14159265358979324) -#define DEGTORAD (PIGRECO / 180.) -#define RADTODEG (180. / PIGRECO) +const double PIGRECO = 3.14159265358979324 ; +const double DEGTORAD = PIGRECO / 180. ; +const double RADTODEG = 180. / PIGRECO ; + +// epsilon per gli angoli (in gradi) +const double EPS_ANG_SMALL = 1e-3 ; +const double EPS_ANG_ZERO = 1e-7 ; +const double SIN_EPS_ANG_SMALL = EPS_ANG_SMALL * DEGTORAD ; +const double SIN_EPS_ANG_ZERO = EPS_ANG_ZERO * DEGTORAD ; +const double COS_ORTO_ANG_SMALL = SIN_EPS_ANG_SMALL ; +const double COS_ORTO_ANG_ZERO = SIN_EPS_ANG_ZERO ; diff --git a/EGkGeoObjType.h b/EGkGeoObjType.h index 8bca78e..a0b925d 100644 --- a/EGkGeoObjType.h +++ b/EGkGeoObjType.h @@ -15,9 +15,9 @@ //----------------- Costanti famiglie oggetto geometrico ---------------------- -#define GEO_ZERODIM 0x100 -#define GEO_CURVE 0x200 -#define GEO_SURF 0x400 +const int GEO_ZERODIM = 0x100 ; +const int GEO_CURVE = 0x200 ; +const int GEO_SURF = 0x400 ; //----------------- Costanti tipo oggetto geometrico -------------------------- enum GeoObjType { GEO_NONE = 0, @@ -30,10 +30,10 @@ enum GeoObjType { GEO_NONE = 0, SRF_TRIMESH = ( GEO_SURF + 0)} ; //----------------- Costanti chiavi oggetto geometrico ------------------------ -#define KEY_GEO_VECT3D "G_VEC" -#define KEY_GEO_PNT3D "G_PNT" -#define KEY_CRV_LINE "C_LIN" -#define KEY_CRV_ARC "C_ARC" -#define KEY_CRV_BEZ "C_BEZ" -#define KEY_CRV_COMPO "C_CMP" -#define KEY_SRF_TRIMESH "S_TRM" +static const char* KEY_GEO_VECT3D = "G_VEC" ; +static const char* KEY_GEO_PNT3D = "G_PNT" ; +static const char* KEY_CRV_LINE = "C_LIN" ; +static const char* KEY_CRV_ARC = "C_ARC" ; +static const char* KEY_CRV_BEZ = "C_BEZ" ; +static const char* KEY_CRV_COMPO = "C_CMP" ; +static const char* KEY_SRF_TRIMESH = "S_TRM" ; diff --git a/EGkGeoPoint3d.h b/EGkGeoPoint3d.h index d969eb6..1429fbb 100644 --- a/EGkGeoPoint3d.h +++ b/EGkGeoPoint3d.h @@ -24,6 +24,16 @@ class _declspec( novtable) IGeoPoint3d : public IGeoObj } ; //----------------------------------------------------------------------------- +inline IGeoPoint3d* CreateGeoPoint3d( void) + { return (static_cast( CreateGeoObj( KEY_GEO_PNT3D))) ; } +inline IGeoPoint3d* CloneGeoPoint3d( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_PNT3D) + return nullptr ; + return (static_cast(pGObj->Clone())) ; } +inline bool CopyGeoPoint3d( const IGeoPoint3d* pGPSou, IGeoPoint3d* pGPDest) + { if ( pGPSou == nullptr || pGPDest == nullptr) + return false ; + return pGPDest->Set( *(pGPSou->GetPoint())) ; } inline const IGeoPoint3d* GetGeoPoint3d( const IGeoObj* pGObj) { if ( pGObj == nullptr || pGObj->GetType() != GEO_PNT3D) return nullptr ; diff --git a/EGkGeoVector3d.h b/EGkGeoVector3d.h new file mode 100644 index 0000000..78258ee --- /dev/null +++ b/EGkGeoVector3d.h @@ -0,0 +1,44 @@ +//---------------------------------------------------------------------------- +// EgalTech 2013-2013 +//---------------------------------------------------------------------------- +// File : EGkGeoVector3d.h Data : 22.11.13 Versione : 1.3a1 +// Contenuto : Dichiarazione della interfaccia IGeoVector3d. +// +// +// +// Modifiche : 22.11.13 DS Creazione modulo. +// +// +//---------------------------------------------------------------------------- + +#pragma once + +#include "/EgtDev/Include/EGkGeoObj.h" + +//----------------------------------------------------------------------------- +class _declspec( novtable) IGeoVector3d : public IGeoObj +{ + public : + virtual bool Set( const Vector3d& vtV) = 0 ; + virtual const Vector3d* GetVector( void) const = 0 ; +} ; + +//----------------------------------------------------------------------------- +inline IGeoVector3d* CreateGeoVector3d( void) + { return (static_cast( CreateGeoObj( KEY_GEO_VECT3D))) ; } +inline IGeoVector3d* CloneGeoVector3d( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_VECT3D) + return nullptr ; + return (static_cast(pGObj->Clone())) ; } +inline bool CopyGeoVector3d( const IGeoVector3d* pGVSou, IGeoVector3d* pGVDest) + { if ( pGVSou == nullptr || pGVDest == nullptr) + return false ; + return pGVDest->Set( *(pGVSou->GetVector())) ; } +inline const IGeoVector3d* GetGeoVector3d( const IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_VECT3D) + return nullptr ; + return (static_cast(pGObj)) ; } +inline IGeoVector3d* GetGeoVector3d( IGeoObj* pGObj) + { if ( pGObj == nullptr || pGObj->GetType() != GEO_VECT3D) + return nullptr ; + return (static_cast(pGObj)) ; } diff --git a/EGkPoint3d.h b/EGkPoint3d.h index 803f59a..72677bf 100644 --- a/EGkPoint3d.h +++ b/EGkPoint3d.h @@ -53,6 +53,10 @@ class EGK_EXPORT Point3d double z ; } ; +//---------------------------------------------------------------------------- +// Punti notevoli +//---------------------------------------------------------------------------- +const Point3d ORIG( 0, 0, 0) ; //---------------------------------------------------------------------------- // Somma di due punti diff --git a/EGkVector3d.h b/EGkVector3d.h index 687360b..f365984 100644 --- a/EGkVector3d.h +++ b/EGkVector3d.h @@ -69,6 +69,13 @@ class EGK_EXPORT Vector3d double z ; } ; +//---------------------------------------------------------------------------- +// Vettori notevoli +//---------------------------------------------------------------------------- +const Vector3d X_AX( 1, 0, 0) ; +const Vector3d Y_AX( 0, 1, 0) ; +const Vector3d Z_AX( 0, 0, 1) ; + //---------------------------------------------------------------------------- // Opposto di un vettore //----------------------------------------------------------------------------