Use goog.math.lerp in ol.geom.flat.lineStringInterpolate
This commit is contained in:
@@ -288,9 +288,10 @@ ol.geom.flat.lineStringInterpolate =
|
|||||||
var t = (target - cumulativeLengths[-index - 2]) /
|
var t = (target - cumulativeLengths[-index - 2]) /
|
||||||
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
|
(cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
|
||||||
var o = offset + (-index - 2) * stride;
|
var o = offset + (-index - 2) * stride;
|
||||||
pointX = (1 - t) * flatCoordinates[o] + t * flatCoordinates[o + stride];
|
pointX = goog.math.lerp(
|
||||||
pointY = (1 - t) * flatCoordinates[o + 1] +
|
flatCoordinates[o], flatCoordinates[o + stride], t);
|
||||||
t * flatCoordinates[o + stride + 1];
|
pointY = goog.math.lerp(
|
||||||
|
flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t);
|
||||||
} else {
|
} else {
|
||||||
pointX = flatCoordinates[offset + index * stride];
|
pointX = flatCoordinates[offset + index * stride];
|
||||||
pointY = flatCoordinates[offset + index * stride + 1];
|
pointY = flatCoordinates[offset + index * stride + 1];
|
||||||
|
|||||||
Reference in New Issue
Block a user