Packagesandy.core.data
Classpublic class BezierPath

A 3D Bézier path.

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



Public Methods
 MethodDefined 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
  
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
Constructor detail
BezierPath()constructor
public function BezierPath()

Creates a new Bézier path.

Method detail
addPoint()method
public function addPoint(p_nX:Number, p_nY:Number, p_nZ:Number):Boolean

Adds 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.

Parameters
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

Returns
Boolean — true if operation succeed, false otherwise.
compile()method 
public function compile():void

Computes 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():uint

Returns the number of segments for this path.

Returns
uint — The number of segments
getPosition()method 
public function getPosition(p_nP:Number):Vector

Returns 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.

Parameters
p_nP:Number — The portion of the path length ( 0 - 1 )

Returns
Vector — The 3D position on the path at
getSegment()method 
public function getSegment(p_nId:uint):Array

Returns 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.

Parameters
p_nId:uint — The number of the segment to return

Returns
Array — An array containing the bezierCurve points [startPoint, controlPoint, endPoint]
toString()method 
public function toString():String

Returns a string represntation of the Bezier path.

Returns
String — A string representing the BezierPath.