|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.vecmath2.Tuple3i
public class Tuple3i
A simple three-dimensional tuple implementation. Inspired by Kenji Hiranabe's Tuple2i implementation
| Field Summary | |
|---|---|
protected static int |
N
|
protected int |
roTrick
|
protected int[] |
values
|
| Constructor Summary | |
|---|---|
protected |
Tuple3i(boolean readOnly,
int[] values)
Creates a new Tuple3i instance. |
protected |
Tuple3i(boolean readOnly,
int x,
int y,
int z)
Creates a new Tuple3i instance. |
protected |
Tuple3i(boolean readOnly,
Tuple3i that)
Creates a new Tuple3i instance. |
|
Tuple3i(int[] values)
Creates a new Tuple3i instance. |
|
Tuple3i(int x,
int y,
int z)
Creates a new Tuple3i instance. |
|
Tuple3i(Tuple3i that)
Creates a new Tuple3i instance. |
| Method Summary | |
|---|---|
Tuple3i |
absolute()
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
Tuple3i |
absolute(Tuple3i tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
Tuple3i |
add(int x,
int y,
int z)
Adds the given parameters to this tuple's values. |
Tuple3i |
add(Tuple3i tuple2)
Sets the value of this tuple to the vector sum of itself and tuple t1. |
Tuple3i |
add(Tuple3i tuple1,
Tuple3i tuple2)
Sets the value of this tuple to the vector sum of tuples t1 and t2. |
Tuple3i |
addX(int v)
Adds v to this tuple's x value. |
Tuple3i |
addY(int v)
Adds v to this tuple's y value. |
Tuple3i |
addZ(int v)
Adds v to this tuple's z value. |
Tuple3i |
clamp(int min,
int max)
Clamps this tuple to the range [min, max]. |
Tuple3i |
clamp(int min,
int max,
Tuple3i tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple. |
Tuple3i |
clampMax(int max)
Clamps the maximum value of this tuple to the max parameter. |
Tuple3i |
clampMax(int max,
Tuple3i tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple. |
Tuple3i |
clampMin(int min)
Clamps the minimum value of this tuple to the min parameter. |
Tuple3i |
clampMin(int min,
Tuple3i tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple. |
Tuple3i |
clone()
Creates and returns a copy of this object. |
int |
deserialize(int pos,
byte[] buffer)
Deserializes this instanc'es data from the byte array. |
Tuple3i |
div(int vx,
int vy,
int vz)
Divides this tuple's values by vx, vy, vz. |
Tuple3i |
divX(int v)
Divides this tuple's x value by v. |
Tuple3i |
divY(int v)
Divides this tuple's y value by v. |
Tuple3i |
divZ(int v)
Divides this tuple's z value by v. |
boolean |
equals(java.lang.Object tuple2)
Returns true if the Object t1 is of type Tuple3f and all of the data members of t1 are equal to the corresponding data members in this Tuple2f. |
boolean |
equals(Tuple3i tuple2)
Returns true if all of the data members of Tuple3f t1 are equal to the corresponding data members in this |
void |
get(int[] buffer)
Writes all values of this Tuple to the specified buffer. |
void |
get(Tuple3i buffer)
Writes all values of this Tuple to the specified buffer Tuple. |
protected int |
getSerializationBufferSize()
|
int |
getSize()
|
int |
getValue(int i)
|
int |
getX()
|
int |
getY()
|
int |
getZ()
|
int |
hashCode()
Returns a hash number based on the data values in this object. |
boolean |
isDirty()
|
boolean |
isReadOnly()
|
Tuple3i |
mul(int vx,
int vy,
int vz)
Multiplies this tuple's values with vx, vy. |
Tuple3i |
mulX(int v)
Multiplies this tuple's x value with v. |
Tuple3i |
mulY(int v)
Multiplies this tuple's y value with v. |
Tuple3i |
mulZ(int v)
Multiplies this tuple's z value with v. |
Tuple3i |
negate()
Negates the value of this vector in place. |
Tuple3i |
negate(Tuple3i tuple)
Sets the value of this tuple to the negation of tuple that. |
void |
readExternal(java.io.ObjectInput in)
|
Tuple3i |
scale(int factor)
Sets the value of this tuple to the scalar multiplication of itself. |
Tuple3i |
scale(int factorX,
int factorY,
int factorZ)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
Tuple3i |
scale(int factor,
Tuple3i tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
Tuple3i |
scaleAdd(int factor,
Tuple3i tuple2)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1). |
Tuple3i |
scaleAdd(int factor,
Tuple3i tuple1,
Tuple3i tuple2)
Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2). |
int |
serialize(int pos,
byte[] buffer)
Serializes this instanc'es data into the byte array. |
Tuple3i |
set(int[] values)
Sets all values of this Tuple to the specified ones. |
Tuple3i |
set(int x,
int y,
int z)
Sets all three values of this Tuple to the specified ones. |
Tuple3i |
set(Tuple3i tuple)
Sets all three values of this Tuple to the specified ones. |
boolean |
setClean()
Marks this tuple non-dirty. |
Tuple3i |
setValue(int i,
int v)
Sets the value of the i-th element of this tuple. |
Tuple3i |
setX(int x)
Sets the value of the x-element of this tuple. |
Tuple3i |
setY(int y)
Sets the value of the y-element of this tuple. |
Tuple3i |
setZ(int z)
Sets the value of the z-element of this tuple. |
Tuple3i |
setZero()
Sets all components to zero. |
Tuple3i |
sub(int x,
int y,
int z)
Subtracts the given parameters from this tuple's values. |
Tuple3i |
sub(Tuple3i tuple2)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1). |
Tuple3i |
sub(Tuple3i tuple1,
Tuple3i tuple2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2). |
Tuple3i |
subX(int v)
Subtracts v from this tuple's x value. |
Tuple3i |
subY(int v)
Subtracts v from this tuple's y value. |
Tuple3i |
subZ(int v)
Subtracts v from this tuple's z value. |
java.lang.String |
toString()
Returns a string that contains the values of this Tuple2f. |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int N
protected final int[] values
protected final int roTrick
| Constructor Detail |
|---|
protected Tuple3i(boolean readOnly,
int x,
int y,
int z)
readOnly - x - the x element to usey - the y element to usez - the z element to use
protected Tuple3i(boolean readOnly,
int[] values)
readOnly - values - the values array (must be at least size 3)
protected Tuple3i(boolean readOnly,
Tuple3i that)
readOnly - that - the Tuple3i to copy the values from
public Tuple3i(int x,
int y,
int z)
x - the x element to usey - the y element to usez - the z element to usepublic Tuple3i(int[] values)
values - the values array (must be at least size 3)public Tuple3i(Tuple3i that)
that - the Tuple3i to copy the values from| Method Detail |
|---|
public final boolean isReadOnly()
public final boolean setClean()
public final boolean isDirty()
public final int getSize()
public final Tuple3i setValue(int i,
int v)
i - v -
public final int getValue(int i)
public final Tuple3i setX(int x)
x -
public final Tuple3i setY(int y)
y -
public final Tuple3i setZ(int z)
z -
public final int getX()
public final int getY()
public final int getZ()
public final Tuple3i set(int x,
int y,
int z)
x - the x element to usey - the y element to usez - the z element to use
public final Tuple3i set(int[] values)
values - the values array (must be at least size 3)
public final Tuple3i set(Tuple3i tuple)
tuple - the tuple to be copied
public final void get(int[] buffer)
buffer - the buffer array to write the values topublic final void get(Tuple3i buffer)
buffer - the buffer Tuple to write the values topublic final Tuple3i setZero()
public final Tuple3i negate(Tuple3i tuple)
tuple - the source vector
public final Tuple3i negate()
public final Tuple3i absolute()
public final Tuple3i absolute(Tuple3i tuple)
tuple - the source tuple, which will not be modified
public final Tuple3i addX(int v)
v -
public final Tuple3i addY(int v)
v -
public final Tuple3i addZ(int v)
v -
public final Tuple3i add(int x,
int y,
int z)
x - y - z -
public final Tuple3i subX(int v)
v -
public final Tuple3i subY(int v)
v -
public final Tuple3i subZ(int v)
v -
public final Tuple3i sub(int x,
int y,
int z)
x - y - z -
public final Tuple3i mulX(int v)
v -
public final Tuple3i mulY(int v)
v -
public final Tuple3i mulZ(int v)
v -
public final Tuple3i mul(int vx,
int vy,
int vz)
vx - vy - vz -
public final Tuple3i divX(int v)
v -
public final Tuple3i divY(int v)
v -
public final Tuple3i divZ(int v)
v -
public final Tuple3i div(int vx,
int vy,
int vz)
vx - vy - vz -
public final Tuple3i add(Tuple3i tuple1,
Tuple3i tuple2)
tuple1 - the first tupletuple2 - the second tuple
public final Tuple3i add(Tuple3i tuple2)
tuple2 - the other tuple
public final Tuple3i sub(Tuple3i tuple1,
Tuple3i tuple2)
tuple1 - the first tupletuple2 - the second tuple
public final Tuple3i sub(Tuple3i tuple2)
tuple2 - the other tuple
public final Tuple3i scale(int factorX,
int factorY,
int factorZ)
factorX - factorY - factorZ -
public final Tuple3i scale(int factor,
Tuple3i tuple)
factor - the scalar valuetuple - the source tuple
public final Tuple3i scale(int factor)
factor - the scalar value
public final Tuple3i scaleAdd(int factor,
Tuple3i tuple1,
Tuple3i tuple2)
factor - the scalar valuetuple1 - the tuple to be multipledtuple2 - the tuple to be added
public final Tuple3i scaleAdd(int factor,
Tuple3i tuple2)
factor - the scalar valuetuple2 - the tuple to be added
public final Tuple3i clampMin(int min)
min - the lowest value in this tuple after clamping
public final Tuple3i clampMax(int max)
max - the highest value in the tuple after clamping
public final Tuple3i clamp(int min,
int max)
min - the lowest value in this tuple after clampingmax - the highest value in this tuple after clamping
public final Tuple3i clamp(int min,
int max,
Tuple3i tuple)
min - the lowest value in the tuple after clampingmax - the highest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final Tuple3i clampMin(int min,
Tuple3i tuple)
min - the lowest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final Tuple3i clampMax(int max,
Tuple3i tuple)
max - the highest value in the tuple after clampingtuple - the source tuple, which will not be modified
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(Tuple3i tuple2)
tuple2 - the vector with which the comparison is made.public boolean equals(java.lang.Object tuple2)
equals in class java.lang.Objecttuple2 - the Object with which the comparison is made
public java.lang.String toString()
toString in class java.lang.Objectpublic Tuple3i clone()
clone in class java.lang.Objectjava.lang.OutOfMemoryError - if there is not enough memory.Cloneable
public int serialize(int pos,
byte[] buffer)
pos - buffer -
public int deserialize(int pos,
byte[] buffer)
pos - buffer -
protected int getSerializationBufferSize()
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||