|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.vecmath2.TupleNf<T>
T - the generic parameter for coefficientspublic abstract class TupleNf<T extends TupleNf<T>>
This is a base-class for all float tuples like Tuple2f, Tuple3f, VectorNf, etc.
| Field Summary | |
|---|---|
protected boolean[] |
isDirty
|
protected int |
roTrick
|
protected float[] |
values
|
| Constructor Summary | |
|---|---|
protected |
TupleNf(boolean readOnly,
float[] values,
boolean[] isDirty,
int n,
boolean copy)
Creates a new TupleNf instance. |
protected |
TupleNf(boolean readOnly,
float[] values,
int n)
Creates a new TupleNf instance. |
protected |
TupleNf(boolean readOnly,
int n)
Creates a new TupleNf instance. |
protected |
TupleNf(boolean readOnly,
TupleNf<?> that)
Creates a new Tuple3f instance. |
|
TupleNf(float[] values,
int n)
Creates a new TupleNf instance. |
|
TupleNf(int n)
Creates a new TupleNf instance. |
|
TupleNf(TupleNf<?> that)
Creates a new Tuple3f instance. |
| Method Summary | |
|---|---|
T |
absolute()
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
T |
absolute(T tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
T |
add(T tuple2)
Sets the value of this tuple to the vector sum of itself and tuple t1. |
T |
add(T tuple1,
T tuple2)
Sets the value of this tuple to the vector sum of tuples t1 and t2. |
T |
addValue(int i,
float v)
Adds v to this tuple's i'th value. |
abstract T |
asReadOnly()
|
T |
clamp(float min,
float max)
Clamps this tuple to the range [min, max]. |
T |
clamp(float min,
float max,
T tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple. |
T |
clampMax(float max)
Clamps the maximum value of this tuple to the max parameter. |
T |
clampMax(float max,
T tuple)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple. |
T |
clampMin(float min)
Clamps the minimum value of this tuple to the min parameter. |
T |
clampMin(float min,
T tuple)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple. |
int |
deserialize(int pos,
byte[] buffer)
Deserializes this instanc'es data from the byte array. |
T |
div(float v)
Divides all components of this tuple by v. |
T |
divValue(int i,
float v)
Divides this tuple's i'th value by v. |
boolean |
epsilonEquals(T v2,
float epsilon)
Returns true if the L-infinite distance between this vector and vector v1 is less than or equal to the epsilon parameter, otherwise returns false. |
boolean |
equals(java.lang.Object o)
|
boolean |
equals(T v2)
Returns true if all of the data members of GVector vector1 are equal to the corresponding data members in this GVector. |
T |
fill(float f)
Sets all values of this TupleNf to f. |
void |
get(float[] buffer)
Writes all values of this Tuple to the specified buffer. |
void |
get(float[] buffer,
int offset)
Writes all values of this Tuple to the specified buffer. |
void |
get(TupleNf<?> buffer)
Writes all values of this Tuple to the specified buffer Tuple. |
abstract T |
getReadOnly()
|
protected int |
getSerializationBufferSize()
|
int |
getSize()
|
float |
getValue(int i)
Sets the i-th value of this tuple. |
int |
hashCode()
Returns a hash number based on the data values in this object. |
void |
interpolate(T t2,
float alpha)
Linearly interpolates between this tuple and tuple t2 and places the result into this tuple: this = (1 - alpha) * this + alpha * t1. |
void |
interpolate(T t1,
T t2,
float alpha)
Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1 - alpha) * t1 + alpha * t2. |
boolean |
isDirty()
|
boolean |
isReadOnly()
|
T |
mul(float v)
Multiplies all components of this tuple with v. |
T |
mulValue(int i,
float v)
Multiplies v to this tuple's i'th value. |
T |
negate()
Negates the value of this vector in place. |
T |
negate(T tuple)
Sets the value of this tuple to the negation of tuple that. |
void |
readExternal(java.io.ObjectInput in)
|
java.nio.FloatBuffer |
readFromBuffer(java.nio.FloatBuffer buffer)
Reads the contents for this tuple from a FloatBuffer. |
java.nio.FloatBuffer |
readFromBuffer(java.nio.FloatBuffer buffer,
int position)
Reads the contents for this tuple from a FloatBuffer. |
static java.nio.FloatBuffer |
readFromBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer)
Reads the contents for this tuple from a FloatBuffer. |
static java.nio.FloatBuffer |
readFromBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer,
int position)
Reads the contents for this tuple from a FloatBuffer. |
T |
round(int decPlaces)
Rounds this tuple to the given number of decimal places. |
T |
round(T tuple,
int decPlaces)
Rounds this tuple to the given number of decimal places. |
T |
scale(float factor)
Sets the value of this tuple to the scalar multiplication of itself. |
T |
scale(float factor,
T tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
T |
scaleAdd(float factor,
T tuple2)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1). |
T |
scaleAdd(float factor,
T tuple1,
T 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. |
T |
set(float[] values)
Sets all values of this Tuple to the specified ones. |
T |
set(float[] values,
int offset)
Sets all values of this Tuple to the specified ones. |
T |
set(TupleNf<?> tuple)
Sets all three values of this Tuple to the specified ones. |
boolean |
setClean()
Marks this tuple non-dirty. |
T |
setValue(int i,
float v)
Sets the i-th value of this tuple. |
T |
setZero()
Sets all components to zero. |
T |
sub(T tuple2)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1). |
T |
sub(T tuple1,
T tuple2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2). |
T |
subValue(int i,
float v)
Subtracts v of this tuple's i'th value. |
java.lang.String |
toString()
Returns a string that contains the values of this Vector. |
void |
writeExternal(java.io.ObjectOutput out)
|
java.nio.FloatBuffer |
writeToBuffer(java.nio.FloatBuffer buffer,
boolean clear,
boolean flip)
Writes the contents of this tuple to a FloatBuffer. |
java.nio.FloatBuffer |
writeToBuffer(java.nio.FloatBuffer buffer,
int position,
boolean clear,
boolean flip)
Writes the contents of this tuple to a FloatBuffer. |
static java.nio.FloatBuffer |
writeToBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer,
boolean clear,
boolean flip)
Writes the contents of this tuple to a FloatBuffer. |
static java.nio.FloatBuffer |
writeToBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer,
int position,
boolean clear,
boolean flip)
Writes the contents of this tuple to a FloatBuffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final float[] values
protected final int roTrick
protected final boolean[] isDirty
| Constructor Detail |
|---|
protected TupleNf(boolean readOnly,
int n)
readOnly - n - the number of elements
protected TupleNf(boolean readOnly,
float[] values,
boolean[] isDirty,
int n,
boolean copy)
readOnly - values - the values array (must be at least size 3)isDirty - the isDirty-valuen - the number of elementscopy - copy the array?
protected TupleNf(boolean readOnly,
float[] values,
int n)
readOnly - values - the values array (must be at least size n)n - the number of elements to copy
protected TupleNf(boolean readOnly,
TupleNf<?> that)
readOnly - that - the TupleNf to copy the values frompublic TupleNf(int n)
n - the number of elements
public TupleNf(float[] values,
int n)
values - the values array (must be at least size n)n - the number of elements to copypublic TupleNf(TupleNf<?> that)
that - the TupleNf to copy the values from| Method Detail |
|---|
public final boolean isReadOnly()
isReadOnly in interface TupleInterface<T extends TupleNf<T>>public final boolean setClean()
setClean in interface TupleInterface<T extends TupleNf<T>>public final boolean isDirty()
isDirty in interface TupleInterface<T extends TupleNf<T>>public final int getSize()
getSize in interface TupleInterface<T extends TupleNf<T>>
public final T setValue(int i,
float v)
setValue in interface TupleInterface<T extends TupleNf<T>>public final float getValue(int i)
getValue in interface TupleInterface<T extends TupleNf<T>>
public final java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer,
boolean clear,
boolean flip)
buffer - clear - clear the buffer before writing data?flip - flip the buffer after writing data?
public final java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer,
int position,
boolean clear,
boolean flip)
buffer - position - position in the bufferclear - clear the buffer before writing data?flip - flip the buffer after writing data?
public static final java.nio.FloatBuffer writeToBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer,
boolean clear,
boolean flip)
tuples - buffer - clear - clear the buffer before writing data?flip - flip the buffer after writing data?
public static final java.nio.FloatBuffer writeToBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer,
int position,
boolean clear,
boolean flip)
tuples - buffer - position - position in the bufferclear - clear the buffer before writing data?flip - flip the buffer after writing data?public final java.nio.FloatBuffer readFromBuffer(java.nio.FloatBuffer buffer)
buffer -
public final java.nio.FloatBuffer readFromBuffer(java.nio.FloatBuffer buffer,
int position)
buffer - position - position in the buffer
public static final java.nio.FloatBuffer readFromBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer)
buffer -
public static final java.nio.FloatBuffer readFromBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer,
int position)
buffer - position - position in the bufferpublic final T fill(float f)
fill in interface TupleInterface<T extends TupleNf<T>>
public final T addValue(int i,
float v)
addValue in interface TupleInterface<T extends TupleNf<T>>i - the index of the value to modifyv - modification amount
public final T subValue(int i,
float v)
subValue in interface TupleInterface<T extends TupleNf<T>>i - the index of the value to modifyv - modification amount
public final T mulValue(int i,
float v)
mulValue in interface TupleInterface<T extends TupleNf<T>>i - the index of the value to modifyv - modification amount
public final T mul(float v)
mul in interface TupleInterface<T extends TupleNf<T>>v - modification amount
public final T divValue(int i,
float v)
divValue in interface TupleInterface<T extends TupleNf<T>>i - the index of the value to modifyv - modification amount
public final T div(float v)
div in interface TupleInterface<T extends TupleNf<T>>v - modification amount
public T set(float[] values,
int offset)
set in interface TupleInterface<T extends TupleNf<T>>values - the values array (must be at least size getSize())offset - the offset in the (source) values array
public T set(float[] values)
set in interface TupleInterface<T extends TupleNf<T>>values - the values array (must be at least size getSize())
public final T set(TupleNf<?> tuple)
set in interface TupleInterface<T extends TupleNf<T>>tuple - the tuple to be copied
public void get(float[] buffer,
int offset)
get in interface TupleInterface<T extends TupleNf<T>>buffer - the buffer array to write the values tooffset - the offset in the (target) buffer arraypublic void get(float[] buffer)
get in interface TupleInterface<T extends TupleNf<T>>buffer - the buffer array to write the values topublic final void get(TupleNf<?> buffer)
get in interface TupleInterface<T extends TupleNf<T>>buffer - the buffer Tuple to write the values topublic final T setZero()
setZero in interface TupleInterface<T extends TupleNf<T>>public final T negate()
negate in interface TupleInterface<T extends TupleNf<T>>public final T negate(T tuple)
negate in interface TupleInterface<T extends TupleNf<T>>tuple - the source vector
public final T absolute()
absolute in interface TupleInterface<T extends TupleNf<T>>public final T absolute(T tuple)
absolute in interface TupleInterface<T extends TupleNf<T>>tuple - the source tuple, which will not be modified
public final T add(T tuple1,
T tuple2)
add in interface TupleInterface<T extends TupleNf<T>>tuple1 - the first tupletuple2 - the second tuple
public final T add(T tuple2)
add in interface TupleInterface<T extends TupleNf<T>>tuple2 - the other tuple
public final T sub(T tuple1,
T tuple2)
sub in interface TupleInterface<T extends TupleNf<T>>tuple1 - the first tupletuple2 - the second tuple
public final T sub(T tuple2)
sub in interface TupleInterface<T extends TupleNf<T>>tuple2 - the other tuple
public final T scale(float factor,
T tuple)
scale in interface TupleInterface<T extends TupleNf<T>>factor - the scalar valuetuple - the source tuple
public final T scale(float factor)
scale in interface TupleInterface<T extends TupleNf<T>>factor - the scalar value
public final T scaleAdd(float factor,
T tuple1,
T tuple2)
scaleAdd in interface TupleInterface<T extends TupleNf<T>>factor - the scalar valuetuple1 - the tuple to be multipledtuple2 - the tuple to be added
public final T scaleAdd(float factor,
T tuple2)
scaleAdd in interface TupleInterface<T extends TupleNf<T>>factor - the scalar valuetuple2 - the tuple to be added
public final T clampMin(float min)
clampMin in interface TupleInterface<T extends TupleNf<T>>min - the lowest value in this tuple after clamping
public final T clampMax(float max)
clampMax in interface TupleInterface<T extends TupleNf<T>>max - the highest value in the tuple after clamping
public final T clamp(float min,
float max)
clamp in interface TupleInterface<T extends TupleNf<T>>min - the lowest value in this tuple after clampingmax - the highest value in this tuple after clamping
public final T clamp(float min,
float max,
T tuple)
clamp in interface TupleInterface<T extends TupleNf<T>>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 T clampMin(float min,
T tuple)
clampMin in interface TupleInterface<T extends TupleNf<T>>min - the lowest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final T clampMax(float max,
T tuple)
clampMax in interface TupleInterface<T extends TupleNf<T>>max - the highest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final T round(T tuple,
int decPlaces)
round in interface TupleInterface<T extends TupleNf<T>>public final T round(int decPlaces)
round in interface TupleInterface<T extends TupleNf<T>>
public void interpolate(T t2,
float alpha)
interpolate in interface TupleInterface<T extends TupleNf<T>>t2 - the first tuplealpha - the alpha interpolation parameter
public final void interpolate(T t1,
T t2,
float alpha)
interpolate in interface TupleInterface<T extends TupleNf<T>>t1 - the first tuplet2 - the second tuplealpha - the alpha interpolation parameterpublic abstract T asReadOnly()
getReadOnly()public abstract T getReadOnly()
asReadOnly()public boolean equals(T v2)
v2 - The vector with which the comparison is made.
public boolean equals(java.lang.Object o)
equals in class java.lang.Object
public boolean epsilonEquals(T v2,
float epsilon)
epsilonEquals in interface TupleInterface<T extends TupleNf<T>>v2 - The vector to be compared to this vectorepsilon - the threshold valuepublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
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
java.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||