@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
18 lines (14 loc) • 473 B
JavaScript
import { InterpolationType } from "../../../../../navigation/ecs/components/InterpolationType.js";
import { estimatePathViaIterativeIntegral } from "./estimatePathViaIterativeIntegral.js";
/**
*
* @param {Path} path
* @returns {number}
*/
function estimatePathLength(path) {
if (path.interpolation === InterpolationType.Linear) {
return path.getLength();
} else {
return estimatePathViaIterativeIntegral(path, 0.01);
}
}