Package | starling.utils |
Class | public class MathUtil |
Inheritance | MathUtil Object |
Method | Defined By | ||
---|---|---|---|
clamp(value:Number, min:Number, max:Number):Number [static] Moves value into the range between min and max. | MathUtil | ||
getNextPowerOfTwo(number:Number):int [static] Returns the next power of two that is equal to or bigger than the specified number. | MathUtil | ||
intersectLineWithXYPlane(pointA:Vector3D, pointB:Vector3D, out:Point = null):Point [static] Calculates the intersection point between the xy-plane and an infinite line
that is defined by two 3D points in the same coordinate system. | MathUtil | ||
isEquivalent(a:Number, b:Number, epsilon:Number = 0.0001):Boolean [static] Indicates if two float (Number) values are equal, give or take epsilon. | MathUtil | ||
isPointInTriangle(p:Point, a:Point, b:Point, c:Point):Boolean [static] Calculates if the point p is inside the triangle a-b-c. | MathUtil | ||
max(a:Number, b:Number):Number [static] Returns the larger of the two values. | MathUtil | ||
min(a:Number, b:Number):Number [static] Returns the smaller of the two values. | MathUtil | ||
normalizeAngle(angle:Number):Number [static] Moves a radian angle into the range [-PI, +PI], while keeping the direction intact. | MathUtil |
clamp | () | method |
public static function clamp(value:Number, min:Number, max:Number):Number
Moves value
into the range between min
and max
.
Parameters
value:Number | |
min:Number | |
max:Number |
Number |
getNextPowerOfTwo | () | method |
public static function getNextPowerOfTwo(number:Number):int
Returns the next power of two that is equal to or bigger than the specified number.
Parameters
number:Number |
int |
intersectLineWithXYPlane | () | method |
public static function intersectLineWithXYPlane(pointA:Vector3D, pointB:Vector3D, out:Point = null):Point
Calculates the intersection point between the xy-plane and an infinite line that is defined by two 3D points in the same coordinate system.
Parameters
pointA:Vector3D | |
pointB:Vector3D | |
out:Point (default = null )
|
Point |
isEquivalent | () | method |
public static function isEquivalent(a:Number, b:Number, epsilon:Number = 0.0001):Boolean
Indicates if two float (Number) values are equal, give or take epsilon
.
Parameters
a:Number | |
b:Number | |
epsilon:Number (default = 0.0001 )
|
Boolean |
isPointInTriangle | () | method |
public static function isPointInTriangle(p:Point, a:Point, b:Point, c:Point):Boolean
Calculates if the point p
is inside the triangle a-b-c
.
Parameters
p:Point | |
a:Point | |
b:Point | |
c:Point |
Boolean |
max | () | method |
public static function max(a:Number, b:Number):Number
Returns the larger of the two values. Different to the native Math.max
,
this doesn't create any temporary objects when using the AOT compiler.
Parameters
a:Number | |
b:Number |
Number |
min | () | method |
public static function min(a:Number, b:Number):Number
Returns the smaller of the two values. Different to the native Math.min
,
this doesn't create any temporary objects when using the AOT compiler.
Parameters
a:Number | |
b:Number |
Number |
normalizeAngle | () | method |
public static function normalizeAngle(angle:Number):Number
Moves a radian angle into the range [-PI, +PI], while keeping the direction intact.
Parameters
angle:Number |
Number |