MathTables Class
Class org.rapo.games.MathTables
Inheritance
>
MathTables
Maintains sine and cosine tables for fast lookup of pre-calculated values
The properties and methods are "static" so they can be used through a
reference to the class (e.g. MathTables.sine[45])
This class should not be instanced.
| Property Summary |
|---|
| static Number | The number of angle divisions used to rotate game objecst |
| static Array | A pre-calcuated Array of cosine values for each whole degree |
| static Number | The value of PI |
| static Array | A pre-calcuated Array of sine values for each whole degree |
| static Boolean | Indicates whether or not the class has been initialized. |
| Method Summary |
|---|
| static Boolean | Precalculates the sine and cosine Arrays. |
| static Void | setVelocity(angle_index:Number, speed:Number, velocity:Object) Given an angle index and a speed, sets the velocity coordinates of the given
velocity Object. |
| static | Prints the contents of the sine and cosine Arrays to the Output window. |
angleDivisions
static var angleDivisions:Number;
The number of angle divisions used to rotate game objecst
cosine
static var cosine:Array;
A pre-calcuated Array of cosine values for each whole degree
PI
static var PI:Number;
The value of PI
sine
static var sine:Array;
A pre-calcuated Array of sine values for each whole degree
tablesInitialized
static var tablesInitialized:Boolean;
Indicates whether or not the class has been initialized.
Calling initTables() in the declaration ensures that it will be.
initTables
public static function initTables():Boolean
Precalculates the sine and cosine Arrays.
Parameters:
setVelocity
public static function setVelocity(angle_index:Number, speed:Number, velocity:Object):Void
Given an angle index and a speed, sets the velocity coordinates of the given
velocity Object.
Parameters:
angle_index- The angle index of the desired angle
speed- The speed value (one-dimensional Scalar)
velocity- The Object which receives the vector coordinates (two-dimensional Vector)
traceTables
public static function traceTables()
Prints the contents of the sine and cosine Arrays to the Output window.
Useful for debugging.
Parameters:
Documentation generated by BLDoc Community Edition from B-Line Express.