From 76779c175f15f8230ce7bbaccb0bc0460e568d66 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 12 Mar 2014 11:09:23 +0100 Subject: [PATCH] Use goog.math.lerp in ol.geom.flat.lineStringInterpolate --- src/ol/geom/flatgeom.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ol/geom/flatgeom.js b/src/ol/geom/flatgeom.js index c463be099f..25e281c1a8 100644 --- a/src/ol/geom/flatgeom.js +++ b/src/ol/geom/flatgeom.js @@ -288,9 +288,10 @@ ol.geom.flat.lineStringInterpolate = var t = (target - cumulativeLengths[-index - 2]) / (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]); var o = offset + (-index - 2) * stride; - pointX = (1 - t) * flatCoordinates[o] + t * flatCoordinates[o + stride]; - pointY = (1 - t) * flatCoordinates[o + 1] + - t * flatCoordinates[o + stride + 1]; + pointX = goog.math.lerp( + flatCoordinates[o], flatCoordinates[o + stride], t); + pointY = goog.math.lerp( + flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t); } else { pointX = flatCoordinates[offset + index * stride]; pointY = flatCoordinates[offset + index * stride + 1];