diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp index 2216c61e5d..141c614b84 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp @@ -325,7 +325,7 @@ QwtSpline RigWellPathGeometryTools::createSpline( const std::vector& ori // Extend spline from 0.0 (if it does not already exist) to a large value for MD // This is to force a specific and known extrapolation. // Otherwise we get an undefined and unknown extrapolation. - if ( !( splinePoints[0].x() == 0.0 && splinePoints[0].y() == 0.0 ) ) + if ( !( splinePoints[0].x() == 0.0 ) ) { double x1 = splinePoints[0].x(); double x2 = splinePoints[1].x(); diff --git a/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp b/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp index 27f837326d..0487338999 100644 --- a/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellPathGeometryTools-Test.cpp @@ -74,6 +74,22 @@ TEST( RigWellPathGeometryTools, LinearPathStartingAtZero ) } } +TEST( RigWellPathGeometryTools, ShortLinearPathStartingAtZero ) +{ + std::vector mdValues = { 0, 1000.0 }; + std::vector tvdValues = { 2000.0, 4000 }; + std::vector fullTVDValues = { 0, 2000.0, 3000, 4000.0 }; + std::vector expectedMDValues = { 0.0, 0.0, 500, 1000.0 }; + + std::vector fullMDValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTVDValues ); + + EXPECT_EQ( fullTVDValues.size(), fullMDValues.size() ); + for ( size_t i = 0; i < fullTVDValues.size(); ++i ) + { + EXPECT_NEAR( expectedMDValues[i], fullMDValues[i], TOLERANCE ); + } +} + double quadraticFunction( double x ) { return 0.0015 * std::pow( x, 2 ) - 0.25 * x + 100;