A 3D path interpolated with Bezier equations
A Bezier path is basically an array of 3D points, but the path is interpolated thanks to Bezier equations, allowing some nice movements
new BezierPath()public function getSegment(pnId:Number):ArrayReturns the segment that fits to the percentage number passed in arguments. You can imagine the whole path length as the 1.0 value (100%). Now if you need the segment when you are at only 10% of the whole path you just have to pass 0.1 in argument, and the returned array contain the bezierCurve points [startPoint, controlPoint, endPoint]
pnId |
Array array containing the segment's bezierCurve points [startPoint, controlPoint, endPoint]
public function getPosition(p:Number):VectorReturns the position in the 3D space at a specific percentage. You can imagine the whole path length as the 1.0 value (100%). Now if you need the position when you are at only 10% of the whole path you just have to pass 0.1 in argument, and the returned value is the position on that percentage of the whole path.
p | Number A percentage between [0-1] |
Vector The 3D position on the path at the current percentage.
public function addPoint(x:Number, y:Number, z:Number):BooleanAdd a point to the path. WARNING : You can't add a point to the path once it has been compiled.
x | Number |
y | Number |
z | Number |
Boolean true if operation succeed, false otherwise.
public function compile(Void):VoidComputes all the control points. Must be called before being used by Sandy's engine. Should be called once tha last point of the path has been added.
Void |