Class sandy.util.BezierUtil

Description

BezierUtil All credits go to Alex Ulhmann and its Animation Package Library

Method Index

casteljau(), casteljau_interval(), getCubicControlPoints(), getPointsOnCubicCurve(), getPointsOnQuadCurve(), getQuadControlPoints()

Method Detail

getPointsOnQuadCurve

static public function getPointsOnQuadCurve(p:Number, p1:Vector, p2:Vector, p3:Vector):Vector

Parameters

p(Number) A percentage between [0-1]
p1(Vector)
p2(Vector)
p3(Vector)

Return

Vector The resulting position vector

getPointsOnCubicCurve

static public function getPointsOnCubicCurve(p:Number, p1:Vector, p2:Vector, p3:Vector, p4:Vector):Vector

Parameters

p(Number) A percentage between [0-1]
p1(Vector)
p2(Vector)
p3(Vector)
p4(Vector)

Return

Vector The resulting position vector

getQuadControlPoints

static public function getQuadControlPoints(start:Vector, middle:Vector, end:Vector):Vector

Parameters

startVector The starting point
middleVector The point where the curve goes throught
endVector The end point of the curve

Return

Vector The control point

getCubicControlPoints

static public function getCubicControlPoints(start:Vector, through1:Vector, through2:Vector, end:Vector):Array

Parameters

start(Vector)
through1(Vector)
through2(Vector)
end(Vector)

Return

Array of Vector. A two dimensionnal array containing the two controls points.

casteljau

static public function casteljau(p:Number, plist:Array):Vector

Apply the casteljau algorithm.

Parameters

pNumber A percentage value between [0-1]
plistArray of Vector The list of vector that are used as control points of the Bezier curve.

Return

Vector The position on the Bezier curve at the ration p of the curve.

casteljau_interval

static public function casteljau_interval(p:Number, plist:Array, pdeb:Number, pfin:Number):Vector

More robust casteljau algorithm if the intervals are wierd. UNTESTED METHOD. MAY BE REMOVED IN THE FUTURE VERSION. USE IT CAREFULLY.

Parameters

p
plist
pdeb
pfin

Return