org.deken.game.utils
Class FastMath

java.lang.Object
  extended by org.deken.game.utils.FastMath

public final class FastMath
extends java.lang.Object

Title: FastTrig

Description: Fast Trig functions for x86.

Version:
1.0
Author:
Jeff's Game Gems, Markus Persson, Bruno Augier (DzzD), Riven

Field Summary
static float[] ATAN2
           
 
Constructor Summary
FastMath()
           
 
Method Summary
static int abs(int a)
           
static float atan2DegLookup(float y, float x)
           
static float atan2DegStrict(float y, float x)
           
static float atan2Lookup(float y, float x)
           
static double cosLookup(double x)
           
static int fastCeil(float x)
           
static double fastCos(double radians)
           
static int fastFloor(float x)
           
static int fastRound(float x)
           
static double fastSin(double radians)
           
static double getDistanceBetweenPoints(double x1, double y1, double x2, double y2)
           
static int sign(double v)
           
static int sign(long v)
           
static double sinLookup(double x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATAN2

public static final float[] ATAN2
Constructor Detail

FastMath

public FastMath()
Method Detail

abs

public static int abs(int a)
Parameters:
a -
Returns:
absolute int

atan2DegLookup

public static float atan2DegLookup(float y,
                                   float x)
Parameters:
y -
x -
Returns:
float

atan2DegStrict

public static float atan2DegStrict(float y,
                                   float x)
Parameters:
y -
x -
Returns:
float

atan2Lookup

public static float atan2Lookup(float y,
                                float x)
Parameters:
y -
x -
Returns:
float

cosLookup

public static double cosLookup(double x)
Parameters:
x - angle in radian to
Returns:
cosinus value for the given parameter

fastCeil

public static int fastCeil(float x)
Parameters:
x -
Returns:
int

fastCos

public static double fastCos(double radians)
Parameters:
radians -
Returns:
cosine double

fastFloor

public static int fastFloor(float x)
Parameters:
x -
Returns:
int

fastRound

public static int fastRound(float x)
Parameters:
x -
Returns:
int

fastSin

public static double fastSin(double radians)
Parameters:
radians -
Returns:
sine double

getDistanceBetweenPoints

public static double getDistanceBetweenPoints(double x1,
                                              double y1,
                                              double x2,
                                              double y2)
Parameters:
x1 -
y1 -
x2 -
y2 -
Returns:
distance

sign

public static int sign(long v)
Parameters:
v -
Returns:
int

sign

public static int sign(double v)
Parameters:
v -
Returns:
int

sinLookup

public static double sinLookup(double x)
Parameters:
x - angle in radian to
Returns:
sinus value for the given parameter