A helper utility class for various geometric calculations.
public static function barycenter(a:Number, b:Number, c:Number, t:Number):Number
Calculates the barycenter of a quadratic bezier curve.
Parameters
| a:Number — A number indicating the start axis coordinate.
|
| |
| b:Number — A number indicating the control axis coordinate.
|
| |
| c:Number — A number indicating the end axis coordinate.
|
| |
| t:Number — A number indicating the accuracy.
|
Returns
| Number — The barycenter of the given points.
|
public static function bezierBounds(x:Number, y:Number, cx:Number, cy:Number, x1:Number, y1:Number):Rectangle
Return the tight bounding rectangle for a bezier curve.
Parameters
| x:Number — A number indicating the starting x-axis coordinate.
|
| |
| y:Number — A number indicating the starting y-axis coordinate.
|
| |
| cx:Number — A number indicating the control x-axis coordinate.
|
| |
| cy:Number — A number indicating the control y-axis coordinate.
|
| |
| x1:Number — A number indicating the ending x-axis coordinate.
|
| |
| y1:Number — A number indicating the ending y-axis coordinate.
|
Returns
| Rectangle — The bounds rectangle for the bezier curve.
|
public static function cubicToQuadratic(p1:GraphicPoint, c1:GraphicPoint, c2:GraphicPoint, p2:GraphicPoint, k:Number, quadratics:Array):void
CubicToQuadratic
Approximates a cubic bezier with as many quadratic bezier segments (n) as required
to achieve a specified tolerance.
Parameters
| p1:GraphicPoint — (GraphicPoint) endpoint
|
| |
| c1:GraphicPoint — (GraphicPoint) 1st control point
|
| |
| c2:GraphicPoint — (GraphicPoint) 2nd control point
|
| |
| p2:GraphicPoint — (GraphicPoint) endpoint
|
| |
| k:Number — tolerance (low number = most accurate result)
|
| |
| quadratics:Array — (Array) will contain array of quadratic bezier curves, each element containing p1x, p1y, cx, cy, p2x, p2y (start point, control points, end point
|
public static function degressToRadius(angle:Number):Number
Convert Degress to radius.
Parameters
| angle:Number — A angle value to convert.
|
Returns
| Number — The resulting number converted to a radius.
|
public static function lineIntersects(p1:GraphicPoint, p2:GraphicPoint, p3:GraphicPoint, p4:GraphicPoint):GraphicPoint
LineIntersects
Returns the point of intersection between two lines
Parameters
Returns
public static function midPoint(p1:GraphicPoint, p2:GraphicPoint):GraphicPoint
MidPoint
Returns the midpoint Point of 2 Point structures
Parameters
Returns
public static function perimeter(x:Number, y:Number, cx:Number, cy:Number, x1:Number, y1:Number):Number
Calculates the perimeter of a quadratic bezier curve
Parameters
| x:Number — A number indicating the starting x-axis coordinate.
|
| |
| y:Number — A number indicating the starting y-axis coordinate.
|
| |
| cx:Number — A number indicating the control x-axis coordinate.
|
| |
| cy:Number — A number indicating the control y-axis coordinate.
|
| |
| x1:Number — A number indicating the ending x-axis coordinate.
|
| |
| y1:Number — A number indicating the ending y-axis coordinate.
|
Returns
| Number — The perimeter distance for the bezier curve.
|
public static function radiusToDegress(angle:Number):Number
Convert radius to degrees.
Parameters
| angle:Number — A angle radius to convert.
|
Returns
| Number — The resulting number converted to degress.
|
public static function rotatePoint(value:GraphicPoint, angle:Number):GraphicPoint
Rotate a point by a degrees.
Parameters
| value:GraphicPoint — The point to rotate.
|
| |
| angle:Number — A radius to rotate.
|
Returns
public static function rotatePointOnCenterPoint(point:GraphicPoint, centerPoint:GraphicPoint, degrees:Number):GraphicPoint
Rotate a point around a given center point by degrees.
Parameters
| point:GraphicPoint — The point to rotate.
|
| |
| centerPoint:GraphicPoint — the center point that point should be roatated around.
|
| |
| degrees:Number — A radius to rotate.
|
Returns
public static function roundTo(input:Number, digits:Number):Number
Round a number a specified number of decimal places.
Parameters
| input:Number — The number to round.
|
| |
| digits:Number — The number of deciaml points to round to.
|
Returns
| Number — The resulting rounded number.
|
public static function splitBezier(p1:GraphicPoint, c1:GraphicPoint, c2:GraphicPoint, p2:GraphicPoint):Object
SplitBezier
Divides a cubic bezier curve into two cubic bezier curve definitions
Parameters
Returns
| Object — Object (object with two cubic bezier definitions, b0 and b1)
|