|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.util.Fixed
public class Fixed
Fixed point math library. Precision is 16 bits whole, 16 bits fractional. Uses 32 bit values to represent the Fixed number.
| Field Summary | |
|---|---|
static int |
FIXED_ONE
|
static int |
FIXED_ONE_HALF
|
static int |
FIXED_PI
|
static int |
FIXED_TWO
|
static int |
MAX_VALUE
|
| Constructor Summary | |
|---|---|
Fixed()
|
|
| Method Summary | |
|---|---|
static int |
abs(int value)
return absolute value of a fixed point number |
static int |
add(int fvalue1,
int fvalue2)
add two fixed point values together |
static int |
cos(int angle)
angle = 0-359 degrees. |
static int |
cosf(int fAngle)
fAngle = 0-359 in fixed point. |
static int |
divide(int dividend,
int divisor)
divide a fixed point value by a fixed point value dividend - number to divide "into" divisor - number to divide "by" If divisor is 0 (zero), then an ArithmeticException is thrown. |
static int |
floor(int fValue)
Given a signed fixed point value, and return the nearest integer. |
static int |
fromInt(int value)
given an integer value, return a fixed point value |
static int |
fromReal(int whole,
int dividend,
int divisor)
create fixed point value from real expression. |
static int |
getFraction(int fValue)
given a fixed point value, return the fraction part |
static int |
hypot(int x,
int y)
Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with sides x and y. |
static int |
multiply(int factor1,
int factor2)
sign multiply two fixed point values together and return a fixed point value reference - http://www.embedded.com/2001/0104/0104feat1list2.htm |
static int |
round(int fValue)
Round to nearest fixed point value. |
static int |
sin(int angle)
angle = 0-359 degrees. |
static int |
sinf(int fAngle)
fAngle = 0-359 in fixed point. |
static int |
sqrt(int fValue)
Returns square root of fixed value Throws Arithmetic Exception if (fValue < 0) This is not accurate, but faster than Math.sqrt() |
static int |
subtract(int fvalue1,
int fvalue2)
subtract two fixed point values |
void |
testCosSin()
Deprecated. For internal use only. |
static void |
testSqrt()
Deprecated. For internal use only. |
static int |
toInt(int fvalue)
given a fixed point value, return an integer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FIXED_ONE
public static final int FIXED_TWO
public static final int FIXED_PI
public static final int MAX_VALUE
public static final int FIXED_ONE_HALF
| Constructor Detail |
|---|
public Fixed()
| Method Detail |
|---|
public static int fromInt(int value)
public static int toInt(int fvalue)
public static int getFraction(int fValue)
public static int fromReal(int whole,
int dividend,
int divisor)
public static int abs(int value)
public static int divide(int dividend,
int divisor)
public static int add(int fvalue1,
int fvalue2)
public static int subtract(int fvalue1,
int fvalue2)
public static int multiply(int factor1,
int factor2)
public static int sinf(int fAngle)
public static int cosf(int fAngle)
public static int sin(int angle)
public static int cos(int angle)
public static int floor(int fValue)
public static int round(int fValue)
public static int hypot(int x,
int y)
public static int sqrt(int fValue)
public void testCosSin()
public static void testSqrt()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||