From 11ed06a5d5f3196755ccd0ea7ade9d3d73063ffe Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 4 Jan 2018 19:31:44 +0100 Subject: [PATCH] #2314 Fracture : Along well path direction Use fabs instead of abs to avoid unintentionally conversion to integer --- .../ReservoirDataModel/RigWellPath.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigWellPath.cpp b/ApplicationCode/ReservoirDataModel/RigWellPath.cpp index 301872bb17..f8b2bb072d 100644 --- a/ApplicationCode/ReservoirDataModel/RigWellPath.cpp +++ b/ApplicationCode/ReservoirDataModel/RigWellPath.cpp @@ -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. - double AzimuthAngle = 90.0; + double azimuthAngleDegrees = 90.0; if (closestIndex != cvf::UNDEFINED_DOUBLE) { @@ -135,20 +135,15 @@ double RigWellPath::wellPathAzimuthAngle(const cvf::Vec3d& position) const cvf::Vec3d direction = p2 - p1; - - if (abs(direction.y()) > 1e-5) + if (fabs(direction.y()) > 1e-5) { double atanValue = direction.x() / direction.y(); - AzimuthAngle = atan(atanValue); - AzimuthAngle = cvf::Math::toDegrees(AzimuthAngle); + double azimuthRadians = atan(atanValue); + azimuthAngleDegrees = cvf::Math::toDegrees(azimuthRadians); } } - return AzimuthAngle; - - - - + return azimuthAngleDegrees; } //--------------------------------------------------------------------------------------------------