#2314 Fracture : Along well path direction

Use fabs instead of abs to avoid unintentionally conversion to integer
This commit is contained in:
Magne Sjaastad 2018-01-04 19:31:44 +01:00
parent addf200a9e
commit 11ed06a5d5

View File

@ -115,7 +115,7 @@ double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const
} }
//For vertical well (x-component of direction = 0) returned angle will be 90. //For vertical well (x-component of direction = 0) returned angle will be 90.
double AzimuthAngle = 90.0; double azimuthAngleDegrees = 90.0;
if (closestIndex != cvf::UNDEFINED_DOUBLE) if (closestIndex != cvf::UNDEFINED_DOUBLE)
{ {
@ -135,20 +135,15 @@ double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const
cvf::Vec3d direction = p2 - p1; cvf::Vec3d direction = p2 - p1;
if (fabs(direction.y()) > 1e-5)
if (abs(direction.y()) > 1e-5)
{ {
double atanValue = direction.x() / direction.y(); double atanValue = direction.x() / direction.y();
AzimuthAngle = atan(atanValue); double azimuthRadians = atan(atanValue);
AzimuthAngle = cvf::Math::toDegrees(AzimuthAngle); azimuthAngleDegrees = cvf::Math::toDegrees(azimuthRadians);
} }
} }
return AzimuthAngle; return azimuthAngleDegrees;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------