|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.vecmath2.Tuple2i
public class Tuple2i
A simple two-dimensional tuple implementation. Inspired by Kenji Hiranabe's Tuple2i implementation
| Field Summary | |
|---|---|
protected static int |
N
|
protected int |
roTrick
|
protected int[] |
values
|
| Constructor Summary | |
|---|---|
|
Tuple2i()
Creates a new Tuple2i instance. |
protected |
Tuple2i(boolean readOnly)
Creates a new Tuple2i instance. |
protected |
Tuple2i(boolean readOnly,
int[] values)
Creates a new Tuple2i instance. |
protected |
Tuple2i(boolean readOnly,
int x,
int y)
Creates a new Tuple2i instance. |
protected |
Tuple2i(boolean readOnly,
Tuple2i that)
Creates a new Tuple2i instance. |
|
Tuple2i(int[] values)
Creates a new Tuple2i instance. |
|
Tuple2i(int x,
int y)
Creates a new Tuple2i instance. |
|
Tuple2i(Tuple2i that)
Creates a new Tuple2i instance. |
| Method Summary | |
|---|---|
Tuple2i |
absolute()
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
Tuple2i |
absolute(Tuple2i tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
Tuple2i |
add(int x,
int y)
Adds the given parameters to this tuple's values. |
Tuple2i |
add(Tuple2i tuple2)
Sets the value of this tuple to the vector sum of itself and tuple t1. |
Tuple2i |
add(Tuple2i tuple1,
Tuple2i tuple2)
Sets the value of this tuple to the vector sum of tuples t1 and t2. |
Tuple2i |
addX(int v)
Adds v to this tuple's x value. |
Tuple2i |
addY(int v)
Adds v to this tuple's y value. |
Tuple2i |
clamp(int min,
int max)
Clamps this tuple to the range [min, max]. |
Tuple2i |
clamp(int min,
int max,
Tuple2i tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple. |
Tuple2i |
clampMax(int max)
Clamps the maximum value of this tuple to the max parameter. |
Tuple2i |
clampMax(int max,
Tuple2i tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple. |
Tuple2i |
clampMin(int min)
Clamps the minimum value of this tuple to the min parameter. |
Tuple2i |
clampMin(int min,
Tuple2i tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple. |
Tuple2i |
clone()
Creates and returns a copy of this object. |
int |
deserialize(int pos,
byte[] buffer)
Deserializes this instanc'es data from the byte array. |
Tuple2i |
div(int vx,
int vy)
Divides this tuple's values by vx, vy, vz. |
Tuple2i |
divX(int v)
Divides this tuple's x value by v. |
Tuple2i |
divY(int v)
Divides this tuple's y 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(Tuple2i tuple2)
Returns true if all of the data members of Tuple3f t1 are equal to the corresponding data members in this |
static Tuple2i |
fromPool()
Allocates an Tuple2i instance from the pool. |
static Tuple2i |
fromPool(int x,
int y)
Allocates an Tuple2i instance from the pool. |
static Tuple2i |
fromPool(Tuple2i tuple)
Allocates an Tuple2i instance from the pool. |
void |
get(int[] buffer)
Writes all values of this Tuple to the specified buffer. |
void |
get(Tuple2i 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 |
hashCode()
Returns a hash number based on the data values in this object. |
boolean |
isDirty()
|
boolean |
isReadOnly()
|
Tuple2i |
mul(int vx,
int vy)
Multiplies this tuple's values with vx, vy. |
Tuple2i |
mulX(int v)
Multiplies this tuple's x value with v. |
Tuple2i |
mulY(int v)
Multiplies this tuple's y value with v. |
Tuple2i |
negate()
Negates the value of this vector in place. |
Tuple2i |
negate(Tuple2i tuple)
Sets the value of this tuple to the negation of tuple that. |
static Tuple2i |
newReadOnly()
Creates a new Tuple2i instance. |
static Tuple2i |
newReadOnly(int[] values)
Creates a new Tuple2i instance. |
static Tuple2i |
newReadOnly(int x,
int y)
Creates a new Tuple2i instance. |
static Tuple2i |
newReadOnly(Tuple2i tuple)
Creates a new Tuple2i instance. |
void |
readExternal(java.io.ObjectInput in)
|
Tuple2i |
scale(int factor)
Sets the value of this tuple to the scalar multiplication of itself. |
Tuple2i |
scale(int factorX,
int factorY)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
Tuple2i |
scale(int factor,
Tuple2i tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
Tuple2i |
scaleAdd(int factor,
Tuple2i tuple2)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1). |
Tuple2i |
scaleAdd(int factor,
Tuple2i tuple1,
Tuple2i 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. |
Tuple2i |
set(int[] values)
Sets all values of this Tuple to the specified ones. |
Tuple2i |
set(int x,
int y)
Sets all three values of this Tuple to the specified ones. |
Tuple2i |
set(Tuple2i tuple)
Sets all three values of this Tuple to the specified ones. |
boolean |
setClean()
Marks this tuple non-dirty. |
Tuple2i |
setValue(int i,
int v)
Sets the value of the i-th element of this tuple. |
Tuple2i |
setX(int x)
Sets the value of the x-element of this tuple. |
Tuple2i |
setY(int y)
Sets the value of the y-element of this tuple. |
Tuple2i |
setZero()
Sets all components to zero. |
Tuple2i |
sub(int x,
int y)
Subtracts the given parameters from this tuple's values. |
Tuple2i |
sub(Tuple2i tuple2)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1). |
Tuple2i |
sub(Tuple2i tuple1,
Tuple2i tuple2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2). |
Tuple2i |
subX(int v)
Subtracts v from this tuple's x value. |
Tuple2i |
subY(int v)
Subtracts v from this tuple's y value. |
static void |
toPool(Tuple2i o)
Stores the given Tuple2i instance in the pool. |
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 Tuple2i(boolean readOnly,
int x,
int y)
readOnly - x - the x element to usey - the y element to use
protected Tuple2i(boolean readOnly,
int[] values)
readOnly - values - the values array (must be at least size 2)
protected Tuple2i(boolean readOnly,
Tuple2i that)
readOnly - that - the Tuple2i to copy the values fromprotected Tuple2i(boolean readOnly)
readOnly -
public Tuple2i(int x,
int y)
x - the x element to usey - the y element to usepublic Tuple2i(int[] values)
values - the values array (must be at least size 2)public Tuple2i(Tuple2i that)
that - the Tuple2i to copy the values frompublic Tuple2i()
| Method Detail |
|---|
public final boolean isReadOnly()
public final boolean setClean()
public final boolean isDirty()
public final int getSize()
public final Tuple2i setValue(int i,
int v)
i - v -
public final int getValue(int i)
public final Tuple2i setX(int x)
x -
public final Tuple2i setY(int y)
y -
public final int getX()
public final int getY()
public final Tuple2i set(int x,
int y)
x - the x element to usey - the y element to use
public final Tuple2i set(int[] values)
values - the values array (must be at least size 3)
public final Tuple2i set(Tuple2i 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(Tuple2i buffer)
buffer - the buffer Tuple to write the values topublic final Tuple2i setZero()
public final Tuple2i negate(Tuple2i tuple)
tuple - the source vector
public final Tuple2i negate()
public final Tuple2i absolute()
public final Tuple2i absolute(Tuple2i tuple)
tuple - the source tuple, which will not be modified
public final Tuple2i addX(int v)
v -
public final Tuple2i addY(int v)
v -
public final Tuple2i add(int x,
int y)
x - y -
public final Tuple2i subX(int v)
v -
public final Tuple2i subY(int v)
v -
public final Tuple2i sub(int x,
int y)
x - y -
public final Tuple2i mulX(int v)
v -
public final Tuple2i mulY(int v)
v -
public final Tuple2i mul(int vx,
int vy)
vx - vy -
public final Tuple2i divX(int v)
v -
public final Tuple2i divY(int v)
v -
public final Tuple2i div(int vx,
int vy)
vx - vy -
public final Tuple2i add(Tuple2i tuple1,
Tuple2i tuple2)
tuple1 - the first tupletuple2 - the second tuple
public final Tuple2i add(Tuple2i tuple2)
tuple2 - the other tuple
public final Tuple2i sub(Tuple2i tuple1,
Tuple2i tuple2)
tuple1 - the first tupletuple2 - the second tuple
public final Tuple2i sub(Tuple2i tuple2)
tuple2 - the other tuple
public final Tuple2i scale(int factorX,
int factorY)
factorX - factorY -
public final Tuple2i scale(int factor,
Tuple2i tuple)
factor - the scalar valuetuple - the source tuple
public final Tuple2i scale(int factor)
factor - the scalar value
public final Tuple2i scaleAdd(int factor,
Tuple2i tuple1,
Tuple2i tuple2)
factor - the scalar valuetuple1 - the tuple to be multipledtuple2 - the tuple to be added
public final Tuple2i scaleAdd(int factor,
Tuple2i tuple2)
factor - the scalar valuetuple2 - the tuple to be added
public final Tuple2i clampMin(int min)
min - the lowest value in this tuple after clamping
public final Tuple2i clampMax(int max)
max - the highest value in the tuple after clamping
public final Tuple2i clamp(int min,
int max)
min - the lowest value in this tuple after clampingmax - the highest value in this tuple after clamping
public final Tuple2i clamp(int min,
int max,
Tuple2i 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 Tuple2i clampMin(int min,
Tuple2i tuple)
min - the lowest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final Tuple2i clampMax(int max,
Tuple2i 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(Tuple2i 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 Tuple2i 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
public static Tuple2i newReadOnly(int x,
int y)
x - the x element to usey - the y element to usepublic static Tuple2i newReadOnly(int[] values)
values - the values array (must be at least size 2)public static Tuple2i newReadOnly(Tuple2i tuple)
tuple - the Tuple2f to copy the values frompublic static Tuple2i newReadOnly()
public static Tuple2i fromPool()
public static Tuple2i fromPool(int x,
int y)
public static Tuple2i fromPool(Tuple2i tuple)
public static void toPool(Tuple2i o)
o -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||