| Package | sandy.util |
| Class | public class BezierUtil |
All credits go to Alex Ulhmann and his Animation Package Library
| Method | Defined by | ||
|---|---|---|---|
|
[static]
Applies the de Casteljau's algorithm.
| BezierUtil | ||
|
casteljau_interval(p:Number, plist:Array, pdeb:Number, pfin:Number):Vector
[static]
Applies a more robust de Casteljau's algorithm if the intervals are "wierd".
| BezierUtil | ||
|
[static]
Returns the control points for a qubic Bézier curve.
| BezierUtil | ||
|
[static]
Returns a point on a qubic Bézier curve.
| BezierUtil | ||
|
[static]
Returns a point on a quadratic Bézier curve.
| BezierUtil | ||
|
[static]
Returns the control point for a quadratic Bézier curve.
| BezierUtil | ||
| casteljau | () | method |
public static function casteljau(p:Number, plist:Array):VectorApplies the de Casteljau's algorithm.
[ToDo: Better explanations - link to wikipedia ]
Parametersp:Number — A fraction between [0-1] of the whole curve
|
|
plist:Array — The list of control points of the Bézier curve.
|
Vector —
The position on the Bézier curve at the fraction p of the curve.
|
| casteljau_interval | () | method |
public static function casteljau_interval(p:Number, plist:Array, pdeb:Number, pfin:Number):VectorApplies a more robust de Casteljau's algorithm if the intervals are "wierd".
UNTESTED METHOD. MAY BE REMOVED IN THE FUTURE VERSION. USE IT CAREFULLY.
[ToDo: Better explanations - link to wikipedia ]
Parametersp:Number — A fraction between [0-1] of the whole curve
|
|
plist:Array — The list of control points of the Bézier curve.
|
|
pdeb:Number |
|
pfin:Number |
Vector —
The position on the Bézier curve at the fraction p of the curve.
|
| getCubicControlPoints | () | method |
public static function getCubicControlPoints(start:Vector, through1:Vector, through2:Vector, end:Vector):ArrayReturns the control points for a qubic Bézier curve.
If anybody finds a generic method to compute control points for bezier curves with n control points, if only the points on the curve are given, please let us know!
Parametersstart:Vector — The start point of the curve
|
|
through1:Vector — The second point
|
|
through2:Vector — The third point
|
|
end:Vector — The end point
|
Array — A two dimensional array containing the two controls points.
|
| getPointsOnCubicCurve | () | method |
public static function getPointsOnCubicCurve(p:Number, p1:Vector, p2:Vector, p3:Vector, p4:Vector):VectorReturns a point on a qubic Bézier curve.
Adapted from Paul Bourke.
Parametersp:Number — A fraction between [0-1] of the whole curve
|
|
p1:Vector — First point
|
|
p2:Vector — Second point
|
|
p3:Vector — Third point
|
|
p4:Vector — Fourth point
|
Vector —
The resulting position vector
|
| getPointsOnQuadCurve | () | method |
public static function getPointsOnQuadCurve(p:Number, p1:Vector, p2:Vector, p3:Vector):VectorReturns a point on a quadratic Bézier curve.
Adapted from Robert Penner
with Robert Penner's optimization of the standard equation.
p:Number — A fraction between [0-1] of the whole curve
|
|
p1:Vector — First point
|
|
p2:Vector — Second point
|
|
p3:Vector — Third point
|
Vector —
The resulting position vector
|
| getQuadControlPoints | () | method |
public static function getQuadControlPoints(start:Vector, middle:Vector, end:Vector):VectorReturns the control point for a quadratic Bézier curve.
Adapted from Robert Penner's drawCurve3Pts() method
Parametersstart:Vector — The start point of the curve
|
|
middle:Vector — The middle point
|
|
end:Vector — The end point
|
Vector —
The control point
|