| Package | sandy.core.data |
| Class | public class BezierPath |
The Bezier path is built form an array of 3D points, by using Bezier equations
With two points the path is degenereated to a straight line. To get a curved line, you need
at least three points. The mid point is used as a control point which gives the curvature.
After that you will have to add three point segments
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new Bézier path.
| BezierPath | ||
|
addPoint(p_nX:Number, p_nY:Number, p_nZ:Number):Boolean
Adds a 3D point to this path.
| BezierPath | ||
|
compile():void
Computes all the control points for this path.
| BezierPath | ||
|
getNumberOfSegments():uint
Returns the number of segments for this path.
| BezierPath | ||
|
getPosition(p_nP:Number):Vector
Returns the position in the 3D space at a specific portion of this path.
| BezierPath | ||
|
getSegment(p_nId:uint):Array
Returns a segment of this path identified by its sequence number.
| BezierPath | ||
|
toString():String
Returns a string represntation of the Bezier path.
| BezierPath | ||
| BezierPath | () | constructor |
public function BezierPath()Creates a new Bézier path.
| addPoint | () | method |
public function addPoint(p_nX:Number, p_nY:Number, p_nZ:Number):BooleanAdds a 3D point to this path.
NOTE: You can't add a point to the path once it has been compiled.
Add at least three point for a a curved segment, then two new points for each segment,
the first a control point, the second an end point.
p_nX:Number — The x coordinate of the 3D point
|
|
p_nY:Number — The y coordinate of the 3D point
|
|
p_nZ:Number — The z coordinate of the 3D point
|
Boolean — true if operation succeed, false otherwise.
|
| compile | () | method |
public function compile():voidComputes all the control points for this path.
Must be called after the last point of the path has been added, and before being used by Sandy's engine.
| getNumberOfSegments | () | method |
public function getNumberOfSegments():uintReturns the number of segments for this path.
Returnsuint — The number of segments
|
| getPosition | () | method |
public function getPosition(p_nP:Number):VectorReturns the position in the 3D space at a specific portion of this path. If you regard the whole length of the path as 1.0 (100%), and you need the position at 10% of the whole path, you pass 0.1 as an argument.
Parametersp_nP:Number — The portion of the path length ( 0 - 1 )
|
Vector —
The 3D position on the path at
|
| getSegment | () | method |
public function getSegment(p_nId:uint):ArrayReturns a segment of this path identified by its sequence number.
The Bézier path is made up of a sequence of segments which are internally numbered. This method returns the n:th segment, where n is the passed in number.
Parametersp_nId:uint — The number of the segment to return
|
Array — An array containing the bezierCurve points [startPoint, controlPoint, endPoint]
|
| toString | () | method |
public function toString():StringReturns a string represntation of the Bezier path.
ReturnsString — A string representing the BezierPath.
|