From 91952582799eb9f6063d725f20b8bf41a7a6361b Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 27 Dec 2018 11:23:54 +0000 Subject: [PATCH] Include : - fabs sostituito da abs. --- EGkCurvePointDiffGeom.h | 4 ++-- EGkPlane3d.h | 6 +++--- EGkPoint3d.h | 30 +++++++++++++++--------------- EGkTriangle3d.h | 12 ++++++------ EGkVector3d.h | 28 +++++++++++++--------------- 5 files changed, 39 insertions(+), 41 deletions(-) diff --git a/EGkCurvePointDiffGeom.h b/EGkCurvePointDiffGeom.h index 6255582..b5b79df 100644 --- a/EGkCurvePointDiffGeom.h +++ b/EGkCurvePointDiffGeom.h @@ -55,7 +55,7 @@ ThereIsDiscontinuity( CrvPointDiffGeom& oDiffGp, CrvPointDiffGeom& oDiffGs) ( oDiffGs.nStatus & CrvPointDiffGeom::POS) == 0) return false ; // verifico che il parametro e i punti coincidano - if ( fabs ( oDiffGp.dU - oDiffGs.dU) > EPS_PARAM || + if ( abs ( oDiffGp.dU - oDiffGs.dU) > EPS_PARAM || ! AreSamePointApprox( oDiffGp.ptP, oDiffGs.ptP)) return false ; // verifico che siano definite le tangenti @@ -74,7 +74,7 @@ ThereIsDiscontinuity( CrvPointDiffGeom& oDiffGp, CrvPointDiffGeom& oDiffGs) return false ; // verifico discontinuitā sulle normali/curvature if ( ! AreSameVectorApprox( oDiffGp.vtN, oDiffGs.vtN) || - fabs( oDiffGp.dCurv - oDiffGs.dCurv) > EPS_SMALL) { + abs( oDiffGp.dCurv - oDiffGs.dCurv) > EPS_SMALL) { oDiffGp.nFlag = CrvPointDiffGeom::P1_DISC_NC ; oDiffGs.nFlag = CrvPointDiffGeom::P2_DISC_NC ; return true ; diff --git a/EGkPlane3d.h b/EGkPlane3d.h index 1ea3fa0..4bf5002 100644 --- a/EGkPlane3d.h +++ b/EGkPlane3d.h @@ -124,19 +124,19 @@ ProjectPointOnPlane( const Point3d& ptP, const Plane3d& plPlane) inline bool PointInPlaneEpsilon( const Point3d& ptP, const Plane3d& plPlane, double dToler) { - return ( fabs( (( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) < dToler) ; + return ( abs( (( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) < dToler) ; } //----------------------------------------------------------------------------- inline bool PointInPlaneApprox( const Point3d& ptP, const Plane3d& plPlane) { - return ( fabs( (( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) < EPS_SMALL) ; + return ( abs( (( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) < EPS_SMALL) ; } //----------------------------------------------------------------------------- inline bool PointInPlaneExact( const Point3d& ptP, const Plane3d& plPlane) { - return ( fabs( (( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) < EPS_ZERO) ; + return ( abs( (( ptP - ORIG) * plPlane.GetVersN()) - plPlane.GetDist()) < EPS_ZERO) ; } diff --git a/EGkPoint3d.h b/EGkPoint3d.h index f7ab7e7..387d7ff 100644 --- a/EGkPoint3d.h +++ b/EGkPoint3d.h @@ -192,9 +192,9 @@ Media( const Point3d& ptP1, const Point3d& ptP2, double dCoeff) inline double ApproxDist( const Point3d& ptP1, const Point3d& ptP2) { - double dMax = fabs( ptP1.x - ptP2.x) ; - double dMed = fabs( ptP1.y - ptP2.y) ; - double dMin = fabs( ptP1.z - ptP2.z) ; + double dMax = abs( ptP1.x - ptP2.x) ; + double dMed = abs( ptP1.y - ptP2.y) ; + double dMin = abs( ptP1.z - ptP2.z) ; if ( dMax < dMed) { double dTmp = dMax ; dMax = dMed ; @@ -220,8 +220,8 @@ ApproxDist( const Point3d& ptP1, const Point3d& ptP2) inline double ApproxDistXY( const Point3d& ptP1, const Point3d& ptP2) { - double dMax = fabs( ptP1.x - ptP2.x) ; - double dMin = fabs( ptP1.y - ptP2.y) ; + double dMax = abs( ptP1.x - ptP2.x) ; + double dMin = abs( ptP1.y - ptP2.y) ; if ( dMax < dMin) { double dTmp = dMax ; dMax = dMin ; @@ -265,12 +265,12 @@ Dist( const Point3d& ptP1, const Point3d& ptP2) double dY = ptP1.y - ptP2.y ; double dZ = ptP1.z - ptP2.z ; - if ( fabs( dY) < EPS_ZERO && fabs( dZ) < EPS_ZERO) - return fabs( dX) ; - if ( fabs( dZ) < EPS_ZERO && fabs( dX) < EPS_ZERO) - return fabs( dY) ; - if ( fabs( dX) < EPS_ZERO && fabs( dY) < EPS_ZERO) - return fabs( dZ) ; + if ( abs( dY) < EPS_ZERO && abs( dZ) < EPS_ZERO) + return abs( dX) ; + if ( abs( dZ) < EPS_ZERO && abs( dX) < EPS_ZERO) + return abs( dY) ; + if ( abs( dX) < EPS_ZERO && abs( dY) < EPS_ZERO) + return abs( dZ) ; return sqrt( dX * dX + dY * dY + dZ * dZ) ; } @@ -284,10 +284,10 @@ DistXY( const Point3d& ptP1, const Point3d& ptP2) double dX = ptP1.x - ptP2.x ; double dY = ptP1.y - ptP2.y ; - if ( fabs( dY) < EPS_ZERO) - return fabs( dX) ; - if ( fabs( dX) < EPS_ZERO) - return fabs( dY) ; + if ( abs( dY) < EPS_ZERO) + return abs( dX) ; + if ( abs( dX) < EPS_ZERO) + return abs( dY) ; return sqrt( dX * dX + dY * dY) ; } diff --git a/EGkTriangle3d.h b/EGkTriangle3d.h index bbcc6d5..250f104 100644 --- a/EGkTriangle3d.h +++ b/EGkTriangle3d.h @@ -327,13 +327,13 @@ CalcProjPlane( const Vector3d& vtN, int& nPlane, bool& bCCW) if ( vtN.IsZero()) return false ; // proiezione sul piano XY (Nz con valore maggiore) - if ( fabs( vtN.z) > fabs( vtN.x) && - fabs( vtN.z) > fabs( vtN.y)) { + if ( abs( vtN.z) > abs( vtN.x) && + abs( vtN.z) > abs( vtN.y)) { nPlane = PL_XY ; bCCW = ( vtN.z > 0) ; } // proiezione sul piano YZ (Nx con valore maggiore) - else if ( fabs( vtN.x) > fabs( vtN.y)) { + else if ( abs( vtN.x) > abs( vtN.y)) { nPlane = PL_YZ ; bCCW = ( vtN.x > 0) ; } @@ -388,7 +388,7 @@ BarycentricCoord( const Point3d& ptP, const Triangle3d& Tria, return false ; // verifico che l'area (doppia) non sia nulla double d2Area = TwoAreaInPlane( nPlane, Tria.GetP( 0), Tria.GetP( 1), Tria.GetP( 2)) ; - if ( fabs( d2Area) < SQ_EPS_SMALL) + if ( abs( d2Area) < SQ_EPS_SMALL) return false ; // calcolo delle coordinate baricentriche double dDenom = 1 / d2Area ; @@ -397,9 +397,9 @@ BarycentricCoord( const Point3d& ptP, const Triangle3d& Tria, dW = TwoAreaInPlane( nPlane, Tria.GetP( 0), Tria.GetP( 1), ptP) * dDenom ; // devono dare somma unitaria double dSumm = dU + dV + dW ; - if ( fabs( dSumm) < EPS_ZERO) + if ( abs( dSumm) < EPS_ZERO) return false ; - if ( fabs( dSumm - 1) > EPS_ZERO) { + if ( abs( dSumm - 1) > EPS_ZERO) { double dDenom = 1 / dSumm ; dU *= dDenom ; dV *= dDenom ; diff --git a/EGkVector3d.h b/EGkVector3d.h index 40639f7..1ef6268 100644 --- a/EGkVector3d.h +++ b/EGkVector3d.h @@ -67,30 +67,30 @@ class EGK_EXPORT Vector3d { return ( ( x * x + y * y) < SQ_EPS_ZERO) ; } //! Verifica se il vettore č normalizzato (č un versore) bool IsNormalized( void) const - { return ( fabs( 1.0 - (x * x + y * y + z * z)) < ( 2 * EPS_ZERO)) ; } + { return ( abs( 1.0 - (x * x + y * y + z * z)) < ( 2 * EPS_ZERO)) ; } //! Verifica se il vettore č parallelo ed equiverso con X+ bool IsXplus( void) const - { return ( x > EPS_ZERO && fabs( y) < EPS_ZERO && fabs( z) < EPS_ZERO) ; } + { return ( x > EPS_ZERO && abs( y) < EPS_ZERO && abs( z) < EPS_ZERO) ; } //! Verifica se il vettore č parallelo ed equiverso con X- bool IsXminus( void) const - { return ( x < - EPS_ZERO && fabs( y) < EPS_ZERO && fabs( z) < EPS_ZERO) ; } + { return ( x < - EPS_ZERO && abs( y) < EPS_ZERO && abs( z) < EPS_ZERO) ; } //! Verifica se il vettore č parallelo ed equiverso con Y+ bool IsYplus( void) const - { return ( fabs( x) < EPS_ZERO && y > EPS_ZERO && fabs( z) < EPS_ZERO) ; } + { return ( abs( x) < EPS_ZERO && y > EPS_ZERO && abs( z) < EPS_ZERO) ; } //! Verifica se il vettore č parallelo ed equiverso con Y- bool IsYminus( void) const - { return ( fabs( x) < EPS_ZERO && y < - EPS_ZERO && fabs( z) < EPS_ZERO) ; } + { return ( abs( x) < EPS_ZERO && y < - EPS_ZERO && abs( z) < EPS_ZERO) ; } //! Verifica se il vettore č parallelo ed equiverso con Z+ bool IsZplus( void) const - { return ( fabs( x) < EPS_ZERO && fabs( y) < EPS_ZERO && z > EPS_ZERO) ; } + { return ( abs( x) < EPS_ZERO && abs( y) < EPS_ZERO && z > EPS_ZERO) ; } //! Verifica se il vettore č parallelo ed equiverso con Z- bool IsZminus( void) const - { return ( fabs( x) < EPS_ZERO && fabs( y) < EPS_ZERO && z < - EPS_ZERO) ; } + { return ( abs( x) < EPS_ZERO && abs( y) < EPS_ZERO && z < - EPS_ZERO) ; } //! Verifica se il vettore č generico bool IsGeneric( void) const - { return (( fabs( x) > EPS_ZERO && fabs( y) > EPS_ZERO) || - ( fabs( y) > EPS_ZERO && fabs( z) > EPS_ZERO) || - ( fabs( z) > EPS_ZERO && fabs( x) > EPS_ZERO)) ; } + { return (( abs( x) > EPS_ZERO && abs( y) > EPS_ZERO) || + ( abs( y) > EPS_ZERO && abs( z) > EPS_ZERO) || + ( abs( z) > EPS_ZERO && abs( x) > EPS_ZERO)) ; } //! 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 ; } @@ -223,9 +223,7 @@ operator*( double dMul, const Vector3d& vtV) inline Vector3d operator/( const Vector3d& vtV, double dDiv) { - double dMul ; - - dMul = 1 / dDiv ; + double dMul = 1 / dDiv ; return ( Vector3d( vtV.x * dMul, vtV.y * dMul, vtV.z * dMul)) ; } @@ -338,7 +336,7 @@ AreSameOrOppositeVectorExact( const Vector3d& vtV1, const Vector3d& vtV2) inline bool AreOrthoApprox( const Vector3d& vtV1, const Vector3d& vtV2) { - return ( fabs( vtV1 * vtV2) < COS_ORTO_ANG_SMALL) ; + return ( abs( vtV1 * vtV2) < COS_ORTO_ANG_SMALL) ; } //---------------------------------------------------------------------------- @@ -347,5 +345,5 @@ AreOrthoApprox( const Vector3d& vtV1, const Vector3d& vtV2) inline bool AreOrthoExact( const Vector3d& vtV1, const Vector3d& vtV2) { - return ( fabs( vtV1 * vtV2) < COS_ORTO_ANG_ZERO) ; + return ( abs( vtV1 * vtV2) < COS_ORTO_ANG_ZERO) ; }