EgtGeomKernel :

- piccola miglioria estetica.
This commit is contained in:
Dario Sassi
2017-04-08 08:34:06 +00:00
parent aa490f32c8
commit 4febe3ca4b
+10 -26
View File
@@ -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 ;