Added Curve.getDistancePoints

This commit is contained in:
Richard Davey 2017-09-29 18:55:03 +01:00
parent 017eb32dd9
commit a69e7a9b3f

View file

@ -90,6 +90,23 @@ var Curve = new Class({
return points;
},
// Return an array of points, spaced out X distance pixels apart
getDistancePoints: function (distance)
{
var len = this.getLength();
var spaced = Math.max(1, len / distance);
return this.getSpacedPoints(spaced);
// Get the t value for 200 pixels along the curve
// var t = curve.getTFromDistance(200);
// = this.getUtoTmapping(0, distance, divisions)
// Get the point at t
// var p = curve.getPoint(t);
},
// Get sequence of points using getPointAt( u )
getSpacedPoints: function (divisions)