From 4febe3ca4bc58151591d6aff19d6702fe7c2d659 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 8 Apr 2017 08:34:06 +0000 Subject: [PATCH] EgtGeomKernel : - piccola miglioria estetica. --- Vector3d.cpp | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/Vector3d.cpp b/Vector3d.cpp index 9dac16c..efb3504 100644 --- a/Vector3d.cpp +++ b/Vector3d.cpp @@ -397,13 +397,9 @@ Vector3d::LocToLoc( const Frame3d& frOri, const Frame3d& frDest) bool Vector3d::GetAngle( const Vector3d& vtEnd, double& dAngDeg) const { - double dProSca ; - double dProVett ; - - // quantità ugualmente proporzionali a coseno e seno - dProSca = *this * vtEnd ; - dProVett = ( *this ^ vtEnd).Len() ; + double dProSca = *this * vtEnd ; + double dProVett = ( *this ^ vtEnd).Len() ; // se entrambe nulle if ( fabs( dProSca) < EPS_ZERO && fabs( dProVett) < EPS_ZERO) { @@ -422,13 +418,9 @@ Vector3d::GetAngle( const Vector3d& vtEnd, double& dAngDeg) const bool Vector3d::GetAngleXY( const Vector3d& vtEnd, double& dAngDeg) const { - double dProSca ; - double dProVett ; - - // quantità ugualmente proporzionali a coseno e seno - dProSca = ScalarXY( *this, vtEnd) ; - dProVett = CrossXY( *this, vtEnd) ; + double dProSca = ScalarXY( *this, vtEnd) ; + double dProVett = CrossXY( *this, vtEnd) ; // se entrambe nulle if ( fabs( dProSca) < EPS_ZERO && fabs( dProVett) < EPS_ZERO) { @@ -448,29 +440,21 @@ Vector3d::GetAngleXY( const Vector3d& vtEnd, double& dAngDeg) const bool Vector3d::GetRotation( const Vector3d& vtEnd, const Vector3d& vtAx, double& dAngDeg, bool& bDet) const { - double dKcosA ; - double dKsinA ; - Vector3d vtDirAx ; - Vector3d vtPerp ; - Vector3d vtPerpE ; - Vector3d vtPerp2 ; - - // ricavo versore asse di rotazione - vtDirAx = vtAx ; + Vector3d vtDirAx = vtAx ; if ( ! vtDirAx.Normalize()) return false ; // ricavo le componenti perpendicolari all'asse di rotazione - vtPerp = *this - vtDirAx * ( *this * vtDirAx) ; - vtPerpE = vtEnd - vtDirAx * ( vtEnd * vtDirAx) ; + Vector3d vtPerp = *this - vtDirAx * ( *this * vtDirAx) ; + Vector3d vtPerpE = vtEnd - vtDirAx * ( vtEnd * vtDirAx) ; // se sono entrambe non nulle : angolo determinato if ( ! vtPerp.IsZero() && ! vtPerpE.IsZero()) { // secondo vettore perpendicolare ad asse e a componente perpendicolare - vtPerp2 = vtDirAx ^ vtPerp ; + Vector3d vtPerp2 = vtDirAx ^ vtPerp ; // proporzionali a seno e coseno del perpendicolare E - dKcosA = vtPerpE * vtPerp ; - dKsinA = vtPerpE * vtPerp2 ; + double dKcosA = vtPerpE * vtPerp ; + double dKsinA = vtPerpE * vtPerp2 ; // angolo di rotazione dAngDeg = atan2( dKsinA, dKcosA) * RADTODEG ; bDet = true ;