#7763 Improve extrapolation for when points are too close.

This commit is contained in:
Kristian Bendiksen
2021-06-09 13:38:33 +02:00
committed by Magne Sjaastad
parent 4de91e885b
commit 1ebe4ec2a1
2 changed files with 29 additions and 1 deletions

View File

@@ -162,7 +162,11 @@ int RiaInterpolationTools::extrapolateRange( int start,
std::vector<double> ys = { y[firstPoint], y[lastPoint] };
for ( int index = start; index < end; index++ )
{
y[index] = extrapolate( xs, ys, x[index] );
// Avoid excessive extrapolation when points are very close
if ( almostEqual( xs[0], xs[1] ) || almostEqual( ys[0], ys[1] ) )
y[index] = ys[0];
else
y[index] = extrapolate( xs, ys, x[index] );
}
return end;