simplefeatures icon indicating copy to clipboard operation
simplefeatures copied to clipboard

Better LERP function

Open peterstace opened this issue 3 years ago • 0 comments

A LERP function is defined here: https://github.com/peterstace/simplefeatures/blob/master/geom/alg_linear_interpolation.go#L55

func lerp(a, b, ratio float64) float64 {
	return a + ratio*(b-a)
}

I ran into the following article, which shares some interesting insight into ways that LERP functions can go wrong: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0811r2.html The implementation in simplefeatures has some of the problems listed (namely, it's not monotonic).

We should implement a more robust version of LERP.

peterstace avatar Apr 14 '22 20:04 peterstace