From f614420f37a634dc5035d7c56fcd9507b5f1ca3d Mon Sep 17 00:00:00 2001 From: DarioS Date: Mon, 24 Apr 2023 15:38:36 +0200 Subject: [PATCH] =?UTF-8?q?Include=20:=20-=20miglioramenti=20interfacce=20?= =?UTF-8?q?di=20Vector3d,=20Point3d=20e=20Frame3d=20-=20aggiunta=20costant?= =?UTF-8?q?e=20ICurve::APL=5FSPECIAL=5FINT=20per=20nuovo=20tipo=20di=20app?= =?UTF-8?q?rossimazione=20(come=20SP=C3=A9ECIAL=20ma=20con=20almeno=20tre?= =?UTF-8?q?=20punti=20per=20curve=20non=20rettilinee).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EGkCurve.h | 1 + EGkFrame3d.h | 20 ++++++++++---------- EGkPoint3d.h | 36 ++++++++++++++++++------------------ EGkVector3d.h | 36 ++++++++++++++++++------------------ 4 files changed, 47 insertions(+), 46 deletions(-) diff --git a/EGkCurve.h b/EGkCurve.h index 1144609..7d20f16 100644 --- a/EGkCurve.h +++ b/EGkCurve.h @@ -31,6 +31,7 @@ class __declspec( novtable) ICurve : public IGeoObj PP_END = 3} ; // punto coincidente con la fine enum ApprLineType { APL_STD = 0, // approssimazione standard APL_SPECIAL = 10, // come STD, per composite conserva estremi di curve componenti + APL_SPECIAL_INT = 20, // come SPECIAL, per composite anche almeno un interno di componenti non rettilinei APL_LEFT = 1, // linee sempre a sinistra APL_LEFT_CONVEX = 11, // linee sempre a sinistra convesse APL_RIGHT = 2, // linee sempre a destra diff --git a/EGkFrame3d.h b/EGkFrame3d.h index b92aa2d..2502099 100644 --- a/EGkFrame3d.h +++ b/EGkFrame3d.h @@ -56,23 +56,23 @@ class EGK_EXPORT Frame3d bool ToLoc( const Frame3d& frRef) ; bool LocToLoc( const Frame3d& frOri, const Frame3d& frDest) ; Frame3d& operator*=( const Frame3d& frRef) - { this->ToGlob( frRef) ; return *this ;} + { ToGlob( frRef) ; return *this ; } Frame3d& operator/=( const Frame3d& frRef) - { this->ToLoc( frRef) ; return *this ;} + { ToLoc( frRef) ; return *this ; } bool IsValid( void) const { return ( m_nType != ERR) ; } int GetType( void) const - { return m_nType ;} + { return m_nType ; } int GetZType( void) const - { return m_nZType ;} + { return m_nZType ; } const Point3d& Orig( void) const - { return m_ptOrig ;} + { return m_ptOrig ; } const Vector3d& VersX( void) const - { return m_vtVersX ;} + { return m_vtVersX ; } const Vector3d& VersY( void) const - { return m_vtVersY ;} + { return m_vtVersY ; } const Vector3d& VersZ( void) const - { return m_vtVersZ ;} + { return m_vtVersZ ; } bool GetRotationsCAC1( double& dAngC, double& dAngA, double& dAngC1) const ; bool GetFixedAxesRotationsABC( double& dAngADeg, double& dAngBDeg, double& dAngCDeg) const ; @@ -97,7 +97,7 @@ const Frame3d GLOB_FRM ; //---------------------------------------------------------------------------- // Prodotto di due frame (porta il primo dal secondo nel globale) //---------------------------------------------------------------------------- -inline Frame3d +inline const Frame3d operator*( const Frame3d& frRef1, const Frame3d& frRef2) { Frame3d frRefR = frRef1 ; @@ -108,7 +108,7 @@ operator*( const Frame3d& frRef1, const Frame3d& frRef2) //---------------------------------------------------------------------------- // Divisione di due frame (porta il primo dal globale nel secondo) //---------------------------------------------------------------------------- -inline Frame3d +inline const Frame3d operator/( const Frame3d& frRef1, const Frame3d& frRef2) { Frame3d frRefR = frRef1 ; diff --git a/EGkPoint3d.h b/EGkPoint3d.h index e0c33a0..2e3dcce 100644 --- a/EGkPoint3d.h +++ b/EGkPoint3d.h @@ -50,19 +50,19 @@ class EGK_EXPORT Point3d { return ( ( x * x + y * y + z * z) < SQ_EPS_ZERO) ; } //! Somma sul posto con un vettore Point3d& operator +=( const Vector3d& vtV) - { this->x += vtV.x ; this->y += vtV.y ; this->z += vtV.z ; return *this ; } + { x += vtV.x ; y += vtV.y ; z += vtV.z ; return *this ; } //! Sottrazione sul posto con un vettore Point3d& operator -=( const Vector3d& vtV) - { this->x -= vtV.x ; this->y -= vtV.y ; this->z -= vtV.z ; return *this ; } + { x -= vtV.x ; y -= vtV.y ; z -= vtV.z ; return *this ; } //! Somma sul posto con un altro punto (valida solo se equivalente ad una combinazione baricentrica) Point3d& operator +=( const Point3d& ptP) - { this->x += ptP.x ; this->y += ptP.y ; this->z += ptP.z ; return *this ; } + { x += ptP.x ; y += ptP.y ; z += ptP.z ; return *this ; } //! Moltiplicazione sul posto con un numero Point3d& operator *=( double dMul) - { this->x *= dMul ; this->y *= dMul ; this->z *= dMul ; return *this ; } + { x *= dMul ; y *= dMul ; z *= dMul ; return *this ; } //! Divisione sul posto con un numero Point3d& operator /=( double dDiv) - { double dMul = 1 / dDiv ; this->x *= dMul ; this->y *= dMul ; this->z *= dMul ; return *this ; } + { double dMul = 1 / dDiv ; x *= dMul ; y *= dMul ; z *= dMul ; return *this ; } //! Traslazione dato il vettore di movimento void Translate( const Vector3d& vtMove) ; //! Rotazione attorno ad un asse per un punto, dato l'angolo in gradi @@ -102,7 +102,7 @@ const Point3d ORIG( 0, 0, 0) ; //---------------------------------------------------------------------------- //! Somma di due punti (valida solo se equivalente ad una combinazione baricentrica) //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d operator+( const Point3d& ptP1, const Point3d& ptP2) { return Point3d( ptP1.x + ptP2.x, ptP1.y + ptP2.y, ptP1.z + ptP2.z) ; @@ -111,16 +111,16 @@ operator+( const Point3d& ptP1, const Point3d& ptP2) //---------------------------------------------------------------------------- //! Somma di un punto e un vettore //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d operator+( const Point3d& ptP1, const Vector3d& vtV2) { return Point3d( ptP1.x + vtV2.x, ptP1.y + vtV2.y, ptP1.z + vtV2.z) ; } //---------------------------------------------------------------------------- -//! Opposto di un punto +//! Opposto di un punto, genera un vettore //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator-( const Point3d& ptP) { return Vector3d( - ptP.x, - ptP.y, - ptP.z) ; @@ -129,7 +129,7 @@ operator-( const Point3d& ptP) //---------------------------------------------------------------------------- //! Differenza di due punti, genera un vettore //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator-( const Point3d& ptP1, const Point3d& ptP2) { return Vector3d( ptP1.x - ptP2.x, ptP1.y - ptP2.y, ptP1.z - ptP2.z) ; @@ -138,7 +138,7 @@ operator-( const Point3d& ptP1, const Point3d& ptP2) //---------------------------------------------------------------------------- //! Sottrazione di un punto e un vettore //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d operator-( const Point3d& ptP1, const Vector3d& vtV2) { return Point3d( ptP1.x - vtV2.x, ptP1.y - vtV2.y, ptP1.z - vtV2.z) ; @@ -147,7 +147,7 @@ operator-( const Point3d& ptP1, const Vector3d& vtV2) //---------------------------------------------------------------------------- //! Prodotto con uno scalare //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d operator*( const Point3d& ptP, double dMul) { return Point3d( ptP.x * dMul, ptP.y * dMul, ptP.z * dMul) ; @@ -156,7 +156,7 @@ operator*( const Point3d& ptP, double dMul) //---------------------------------------------------------------------------- //! Prodotto di uno scalare con un punto //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d operator*( double dMul, const Point3d& ptP) { return Point3d( ptP.x * dMul, ptP.y * dMul, ptP.z * dMul) ; @@ -165,7 +165,7 @@ operator*( double dMul, const Point3d& ptP) //---------------------------------------------------------------------------- //! Divisione per uno scalare //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d operator/( const Point3d& ptP, double dDiv) { double dMul ; @@ -177,7 +177,7 @@ operator/( const Point3d& ptP, double dDiv) //---------------------------------------------------------------------------- //! Somma mediata di due punti (baricentrica) //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d Media( const Point3d& ptP1, const Point3d& ptP2, double dCoeff = 0.5) { return Point3d( ( 1 - dCoeff) * ptP1.x + dCoeff * ptP2.x, @@ -368,7 +368,7 @@ AreSamePointXYExact( const Point3d& ptP1, const Point3d& ptP2) //---------------------------------------------------------------------------- //! Restituisce una copia in locale del punto passato //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d GetToLoc( const Point3d& ptP, const Frame3d& frRef) { Point3d ptQ = ptP ; @@ -379,7 +379,7 @@ GetToLoc( const Point3d& ptP, const Frame3d& frRef) //---------------------------------------------------------------------------- //! Restituisce una copia in globale del punto passato //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d GetToGlob( const Point3d& ptP, const Frame3d& frRef) { Point3d ptQ = ptP ; @@ -390,7 +390,7 @@ GetToGlob( const Point3d& ptP, const Frame3d& frRef) //---------------------------------------------------------------------------- //! Restituisce una copia dal primo al secondo riferimento del punto passato //---------------------------------------------------------------------------- -inline Point3d +inline const Point3d GetLocToLoc( const Point3d& ptP, const Frame3d& frOri, const Frame3d& frDest) { Point3d ptQ = ptP ; diff --git a/EGkVector3d.h b/EGkVector3d.h index 0c9bf54..dc25701 100644 --- a/EGkVector3d.h +++ b/EGkVector3d.h @@ -110,21 +110,21 @@ class EGK_EXPORT Vector3d { return ( ! IsX() && ! IsY() && ! IsZ()) ; } //! Somma sul posto con altro vettore Vector3d& operator +=( const Vector3d& vtV) - { this->x += vtV.x ; this->y += vtV.y ; this->z += vtV.z ; return *this ; } + { x += vtV.x ; y += vtV.y ; z += vtV.z ; return *this ; } //! Sottrazione sul posto con altro vettore Vector3d& operator -=( const Vector3d& vtV) - { this->x -= vtV.x ; this->y -= vtV.y ; this->z -= vtV.z ; return *this ; } + { x -= vtV.x ; y -= vtV.y ; z -= vtV.z ; return *this ; } //! Moltiplicazione sul posto con un numero Vector3d& operator *=( double dMul) - { this->x *= dMul ; this->y *= dMul ; this->z *= dMul ; return *this ; } + { x *= dMul ; y *= dMul ; z *= dMul ; return *this ; } //! Divisione sul posto con un numero Vector3d& operator /=( double dDiv) - { double dMul = 1 / dDiv ; this->x *= dMul ; this->y *= dMul ; this->z *= dMul ; return *this ; } + { double dMul = 1 / dDiv ; x *= dMul ; y *= dMul ; z *= dMul ; return *this ; } //! Ritorna la rappresentazione in coordinate sferiche void ToSpherical( double* pdLen, double* pdAngVertDeg, double* pdAngOrizzDeg) const ; //! Inversione del vettore void Invert( void) - { x = - x ; y = - y ; z = - z ; } + { x = -x ; y = -y ; z = -z ; } //! Normalizzazione del vettore (trasformazione in versore) bool Normalize( double dEps = EPS_SMALL) ; //! Rotazione attorno ad un asse, dato l'angolo in gradi @@ -199,7 +199,7 @@ EGK_EXPORT Vector3d FromNearestHorizontalOrtho( const Vector3d& vtV, const Vecto //---------------------------------------------------------------------------- //! Opposto di un vettore //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator-( const Vector3d& vtV) { return ( Vector3d( - vtV.x, - vtV.y, - vtV.z)) ; @@ -208,7 +208,7 @@ operator-( const Vector3d& vtV) //---------------------------------------------------------------------------- //! Somma di due vettori //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator+( const Vector3d& vtV1, const Vector3d& vtV2) { return ( Vector3d( vtV1.x + vtV2.x, vtV1.y + vtV2.y, vtV1.z + vtV2.z)) ; @@ -217,7 +217,7 @@ operator+( const Vector3d& vtV1, const Vector3d& vtV2) //---------------------------------------------------------------------------- //! Sottrazione di due vettori //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator-( const Vector3d& vtV1, const Vector3d& vtV2) { return ( Vector3d( vtV1.x - vtV2.x, vtV1.y - vtV2.y, vtV1.z - vtV2.z)) ; @@ -226,7 +226,7 @@ operator-( const Vector3d& vtV1, const Vector3d& vtV2) //---------------------------------------------------------------------------- //! Prodotto con uno scalare //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator*( const Vector3d& vtV, double dMul) { return ( Vector3d( vtV.x * dMul, vtV.y * dMul, vtV.z * dMul)) ; @@ -235,7 +235,7 @@ operator*( const Vector3d& vtV, double dMul) //---------------------------------------------------------------------------- //! Prodotto di uno scalare con un vettore //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator*( double dMul, const Vector3d& vtV) { return ( Vector3d( vtV.x * dMul, vtV.y * dMul, vtV.z * dMul)) ; @@ -244,7 +244,7 @@ operator*( double dMul, const Vector3d& vtV) //---------------------------------------------------------------------------- //! Divisione con uno scalare //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator/( const Vector3d& vtV, double dDiv) { double dMul = 1 / dDiv ; @@ -272,7 +272,7 @@ ScalarXY( const Vector3d& vtV1, const Vector3d& vtV2) //---------------------------------------------------------------------------- //! Prodotto vettoriale //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d operator^( const Vector3d& vtV1, const Vector3d& vtV2) { return ( Vector3d( vtV1.y * vtV2.z - vtV1.z * vtV2.y, @@ -292,7 +292,7 @@ CrossXY( const Vector3d& vtV1, const Vector3d& vtV2) //---------------------------------------------------------------------------- //! Somma mediata di due vettori (baricentrica) //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d Media( const Vector3d& vtV1, const Vector3d& vtV2, double dCoeff = 0.5) { return ( Vector3d( ( 1 - dCoeff) * vtV1.x + dCoeff * vtV2.x, @@ -303,7 +303,7 @@ Media( const Vector3d& vtV1, const Vector3d& vtV2, double dCoeff = 0.5) //---------------------------------------------------------------------------- //! Restituisce il componente del vettore parallelo a quello di riferimento //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d ParallCompo( const Vector3d& vtV, const Vector3d& vtRef) { if ( vtRef.IsNormalized()) @@ -315,7 +315,7 @@ ParallCompo( const Vector3d& vtV, const Vector3d& vtRef) //---------------------------------------------------------------------------- //! Restituisce il componente del vettore ortogonale a quello di riferimento //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d OrthoCompo( const Vector3d& vtV, const Vector3d& vtRef) { if ( vtRef.IsNormalized()) @@ -426,7 +426,7 @@ AreOrthoExact( const Vector3d& vtV1, const Vector3d& vtV2) //---------------------------------------------------------------------------- //! Restituisce una copia in locale del vettore passato //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d GetToLoc( const Vector3d& vtV, const Frame3d& frRef) { Vector3d vtW = vtV ; @@ -437,7 +437,7 @@ GetToLoc( const Vector3d& vtV, const Frame3d& frRef) //---------------------------------------------------------------------------- //! Restituisce una copia in globale del vettore passato //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d GetToGlob( const Vector3d& vtV, const Frame3d& frRef) { Vector3d vtW = vtV ; @@ -448,7 +448,7 @@ GetToGlob( const Vector3d& vtV, const Frame3d& frRef) //---------------------------------------------------------------------------- //! Restituisce una copia dal primo al secondo riferimento del vettore passato //---------------------------------------------------------------------------- -inline Vector3d +inline const Vector3d GetLocToLoc( const Vector3d& vtV, const Frame3d& frOri, const Frame3d& frDest) { Vector3d vtW = vtV ;