Skip to content

Commit a69e7a9

Browse files
committed
Added Curve.getDistancePoints
1 parent 017eb32 commit a69e7a9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

v3/src/paths/curves/Curve.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@ var Curve = new Class({
9090
return points;
9191
},
9292

93+
// Return an array of points, spaced out X distance pixels apart
94+
getDistancePoints: function (distance)
95+
{
96+
var len = this.getLength();
97+
98+
var spaced = Math.max(1, len / distance);
99+
100+
return this.getSpacedPoints(spaced);
101+
102+
// Get the t value for 200 pixels along the curve
103+
// var t = curve.getTFromDistance(200);
104+
// = this.getUtoTmapping(0, distance, divisions)
105+
106+
// Get the point at t
107+
// var p = curve.getPoint(t);
108+
},
109+
93110
// Get sequence of points using getPointAt( u )
94111

95112
getSpacedPoints: function (divisions)

0 commit comments

Comments
 (0)