|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--au.edu.swin.synergy.math.BScalar
Class for a generic scalar type.. Haven't decided if it should be floating point or fixed point int's yet, so by making it a class i should be able to change it later without having to change everything that uses it. Currently uses a 16:16 fixed point format. so scalar values should never exceed -32768..32767 This class doesn't have any debug/log messages printed because it needs to be fast. It's just provides wrapper methods that mean I don't have to put in shifts and mults in the actual program code.
Field Summary | |
static float |
kFloatToFixed
value to convert from float to fixed |
static int |
kShiftAmount
shift amount for the fixed point format |
Constructor Summary | |
protected |
BScalar()
|
|
BScalar(BScalar value)
|
|
BScalar(float value)
|
|
BScalar(int value)
|
Method Summary | |
void |
add(BScalar amount)
adds another BScalar to this BScalar |
static int |
add(BScalar op1,
BScalar op2)
|
void |
add(int amount)
adds an int to this BScalar |
void |
addH(BScalarRect rect)
|
void |
addMult(BScalar op1,
int op2)
multiplies a BScalar by an int and adds the result to value |
void |
addW(BScalarRect rect)
|
void |
addX(BScalarRect rect)
|
void |
addY(BScalarRect rect)
|
void |
div(BScalar amount)
divides two BScalar types |
void |
div(int amount)
divides a BScalar by an int |
void |
divByH(BScalarRect rect)
|
void |
divByW(BScalarRect rect)
|
int |
getActualValue()
gets the actual value of the scalar |
float |
getFloatValue()
gets the floating point value of this scalar type |
int |
getIntValue()
gets the integer (truncated) value of this scalar type |
int |
getValue()
just get the value of the scalar (this is truncated if an int) |
boolean |
greaterThan(BScalar op1)
|
boolean |
greaterThanOrEqualTo(BScalar op1)
|
void |
half()
|
boolean |
lessThan(BScalar op1)
|
boolean |
lessThanOrEqualTo(BScalar op1)
|
void |
mod(int amount)
the modulus of the scalar type |
void |
mult(BScalar amount)
multiplies two BScalar types |
void |
mult(BScalar op1,
BScalar op2)
|
void |
mult(float amount)
multiplies the BScalar by a float |
void |
mult(int amount)
multiplies the BScalar by an int |
void |
neg()
reverses the sign of the scalar |
void |
reciprocal(BScalar op1)
sets the value of this scalar to the reciprocal of the param |
void |
setActualValue(int newValue)
sets the actual value of the Scalar, without shifting etc |
void |
setValue(BScalar newValue)
sets the value of the Scalar from a Scalar |
void |
setValue(float newValue)
sets the value of the Scalar from a float |
void |
setValue(int newValue)
sets the value of the Scalar from an int |
void |
setValueH(BScalarRect rect)
sets the value to the y value of the rect |
void |
setValueW(BScalarRect rect)
sets the value to the x value of the rect |
void |
setValueX(BScalarRect rect)
sets the value to the x value of the rect |
void |
setValueY(BScalarRect rect)
sets the value to the y value of the rect |
void |
sub(BScalar amount)
subs a BScalar from this BScalar |
void |
sub(int amount)
subs an int from this BScalar |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final float kFloatToFixed
public static final int kShiftAmount
Constructor Detail |
public BScalar(BScalar value)
public BScalar(int value)
public BScalar(float value)
protected BScalar()
Method Detail |
public final void setValue(float newValue)
public final void setValue(int newValue)
public final void setValue(BScalar newValue)
public final void setValueX(BScalarRect rect)
public final void setValueY(BScalarRect rect)
public final void setValueW(BScalarRect rect)
public final void setValueH(BScalarRect rect)
public final void setActualValue(int newValue)
public final int getIntValue()
public final float getFloatValue()
public final int getValue()
public final int getActualValue()
public final void add(BScalar amount)
public final void add(int amount)
public static final int add(BScalar op1, BScalar op2)
public final void addX(BScalarRect rect)
public final void addY(BScalarRect rect)
public final void addW(BScalarRect rect)
public final void addH(BScalarRect rect)
public final void sub(BScalar amount)
public final void sub(int amount)
public final void mult(int amount)
public final void addMult(BScalar op1, int op2)
public final void mult(float amount)
public final void mult(BScalar amount)
public final void mult(BScalar op1, BScalar op2)
public final void div(int amount)
public final void divByW(BScalarRect rect)
public final void divByH(BScalarRect rect)
public final void div(BScalar amount)
public final void mod(int amount)
public final void neg()
public final void reciprocal(BScalar op1)
public final void half()
public final boolean lessThan(BScalar op1)
public final boolean lessThanOrEqualTo(BScalar op1)
public final boolean greaterThan(BScalar op1)
public final boolean greaterThanOrEqualTo(BScalar op1)
public final String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |