| Package | sandy.util |
| Class | public class NumberUtil |
| Property | Defined by | ||
|---|---|---|---|
| HALF_PI : Number [static][read-only]
Math constant pi/2.
| NumberUtil | ||
| PI : Number [static][read-only]
Math constant pi.
| NumberUtil | ||
| TO_DEGREE : Number [static][read-only]
Constant used to convert angle from radians to degrees.
| NumberUtil | ||
| TOL : Number = 0.00001 [static]
Value used to compare numbers with.
| NumberUtil | ||
| TO_RADIAN : Number [static][read-only]
Constant used to convert degrees to radians.
| NumberUtil | ||
| TWO_PI : Number [static][read-only]
Math constant pi*2.
| NumberUtil | ||
| Method | Defined by | ||
|---|---|---|---|
|
areEqual(p_nN:Number, p_nM:Number):Boolean
[static]
Compares two numbers and determines if they are equal.
| NumberUtil | ||
|
constrain(p_nN:Number, p_nMin:Number, p_nMax:Number):Number
[static]
Constrains a number to a given interval.
| NumberUtil | ||
|
isZero(p_nN:Number):Boolean
[static]
Determines if a number is regarded as zero.
| NumberUtil | ||
|
roundTo(p_nN:Number, p_nRoundToInterval:Number = 0):Number
[static]
Rounds a number to specified accuracy.
| NumberUtil | ||
|
toDegree(p_nRad:Number):Number
[static]
Converts an angle from radians to degrees
| NumberUtil | ||
|
toRadian(p_nDeg:Number):Number
[static]
Converts an angle from degrees to radians.
| NumberUtil | ||
| HALF_PI | property |
HALF_PI:Number [read-only]Math constant pi/2.
Implementation public static function get HALF_PI():Number
| PI | property |
PI:Number [read-only]Math constant pi.
Implementation public static function get PI():Number
| TO_DEGREE | property |
TO_DEGREE:Number [read-only]Constant used to convert angle from radians to degrees.
Implementation public static function get TO_DEGREE():Number
| TOL | property |
public static var TOL:Number = 0.00001Value used to compare numbers with.
Basically used to say if a number is zero or not.
Adjust this number with regard to the precision of your application
| TO_RADIAN | property |
TO_RADIAN:Number [read-only]Constant used to convert degrees to radians.
Implementation public static function get TO_RADIAN():Number
| TWO_PI | property |
TWO_PI:Number [read-only]Math constant pi*2.
Implementation public static function get TWO_PI():Number
| areEqual | () | method |
public static function areEqual(p_nN:Number, p_nM:Number):BooleanCompares two numbers and determines if they are equal.
Adjust the TOL property depending on the precision of your application.
Parametersp_nN:Number — The first number.
|
|
p_nM:Number — The second number.
|
Boolean — Whether the numbers are regarded as equal.
|
| constrain | () | method |
public static function constrain(p_nN:Number, p_nMin:Number, p_nMax:Number):NumberConstrains a number to a given interval.
Parametersp_nN:Number — The number to constrain.
|
|
p_nMin:Number — The minimal valid value.
|
|
p_nMax:Number — The maximal valid value.
|
Number — The constrained number.
|
| isZero | () | method |
public static function isZero(p_nN:Number):BooleanDetermines if a number is regarded as zero.
Adjust the TOL property depending on the precision of your application.
Parametersp_nN:Number — The number to compare to zero.
|
Boolean — Whether the number is to be regarded as zero.
|
| roundTo | () | method |
public static function roundTo(p_nN:Number, p_nRoundToInterval:Number = 0):NumberRounds a number to specified accuracy.
To round off the number to 2 decimals, set the the accuracy to 0.01
Parametersp_nN:Number — The number to round.
|
|
p_nRoundToInterval:Number (default = 0) — The accuracy to which to round.
|
Number — The rounded number.
|
| toDegree | () | method |
public static function toDegree(p_nRad:Number):NumberConverts an angle from radians to degrees
Parametersp_nRad:Number — A number representing the angle in radians.
|
Number — The angle in degrees.
|
| toRadian | () | method |
public static function toRadian(p_nDeg:Number):NumberConverts an angle from degrees to radians.
Parametersp_nDeg:Number — A number representing the angle in dregrees.
|
Number — The angle in radians.
|