From a69e7a9b3fbd2e6efe59df1b9eb9ad21dad07dfb Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 29 Sep 2017 18:55:03 +0100 Subject: [PATCH] Added Curve.getDistancePoints --- v3/src/paths/curves/Curve.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/v3/src/paths/curves/Curve.js b/v3/src/paths/curves/Curve.js index f658535d9..0ab2a2a0e 100644 --- a/v3/src/paths/curves/Curve.js +++ b/v3/src/paths/curves/Curve.js @@ -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)