|
||||||||||
| 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<?>>
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,
int n)
Creates a new TupleNf instance. |
protected |
TupleNf(boolean readOnly,
float[] values,
int n,
boolean copy)
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(float[] values,
int n,
boolean copy)
Creates a new TupleNf instance. |
|
TupleNf(int n)
Creates a new TupleNf instance. |
|
TupleNf(TupleNf<?> that)
Creates a new Tuple3f instance. |
| Method Summary | |
|---|---|
TupleNf<T> |
absolute()
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
TupleNf<T> |
absolute(T tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple. |
TupleNf<T> |
add(T tuple2)
Sets the value of this tuple to the vector sum of itself and tuple t1. |
TupleNf<T> |
add(T tuple1,
T tuple2)
Sets the value of this tuple to the vector sum of tuples t1 and t2. |
TupleNf<T> |
addValue(int i,
float v)
Adds v to this tuple's i'th value. |
TupleNf<T> |
clamp(float min,
float max)
Clamps this tuple to the range [min, max]. |
TupleNf<T> |
clamp(float min,
float max,
T tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple. |
TupleNf<T> |
clampMax(float max)
Clamps the maximum value of this tuple to the max parameter. |
TupleNf<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. |
TupleNf<T> |
clampMin(float min)
Clamps the minimum value of this tuple to the min parameter. |
TupleNf<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. |
TupleNf<T> |
div(float v)
Divides all components of this tuple by v. |
TupleNf<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. |
TupleNf<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(TupleNf<?> buffer)
Writes all values of this Tuple to the specified buffer Tuple. |
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()
|
TupleNf<T> |
mul(float v)
Multiplies all components of this tuple with v. |
TupleNf<T> |
mulValue(int i,
float v)
Multiplies v to this tuple's i'th value. |
TupleNf<T> |
negate()
Negates the value of this vector in place. |
TupleNf<T> |
negate(T tuple)
Sets the value of this tuple to the negation of tuple that. |
void |
readExternal(java.io.ObjectInput in)
|
TupleNf<T> |
round(int decPlaces)
Rounds this tuple to the given number of decimal places. |
TupleNf<T> |
round(T tuple,
int decPlaces)
Rounds this tuple to the given number of decimal places. |
TupleNf<T> |
scale(float factor)
Sets the value of this tuple to the scalar multiplication of itself. |
TupleNf<T> |
scale(float factor,
T tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1. |
TupleNf<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). |
TupleNf<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. |
TupleNf<T> |
set(float[] values)
Sets all values of this Tuple to the specified ones. |
TupleNf<T> |
set(TupleNf<?> tuple)
Sets all three values of this Tuple to the specified ones. |
boolean |
setClean()
Marks this tuple non-dirty. |
TupleNf<T> |
setValue(int i,
float v)
Sets the i-th value of this tuple. |
TupleNf<T> |
setZero()
Sets all components to zero. |
TupleNf<T> |
sub(T tuple2)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1). |
TupleNf<T> |
sub(T tuple1,
T tuple2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2). |
TupleNf<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)
Writes the contents of this tuple to a FloatBuffer. |
static java.nio.FloatBuffer |
writeToBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer)
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 boolean isDirty
| Constructor Detail |
|---|
protected TupleNf(boolean readOnly,
int n)
readOnly - n - the number of elements
protected TupleNf(boolean readOnly,
float[] values,
int n,
boolean copy)
readOnly - values - the values array (must be at least size 3)n - 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,
boolean copy)
values - the values array (must be at least size 3)n - the number of elementscopy - copy the array?
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<?>>public final boolean setClean()
setClean in interface TupleInterface<T extends TupleNf<?>>public final boolean isDirty()
isDirty in interface TupleInterface<T extends TupleNf<?>>public final int getSize()
getSize in interface TupleInterface<T extends TupleNf<?>>
public final TupleNf<T> setValue(int i,
float v)
setValue in interface TupleInterface<T extends TupleNf<?>>public final float getValue(int i)
getValue in interface TupleInterface<T extends TupleNf<?>>public final java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer)
buffer -
public static final java.nio.FloatBuffer writeToBuffer(TupleNf<?>[] tuples,
java.nio.FloatBuffer buffer)
buffer - public final TupleNf<T> fill(float f)
fill in interface TupleInterface<T extends TupleNf<?>>
public final TupleNf<T> addValue(int i,
float v)
addValue in interface TupleInterface<T extends TupleNf<?>>i - the index of the value to modifyv - modification amount
public final TupleNf<T> subValue(int i,
float v)
subValue in interface TupleInterface<T extends TupleNf<?>>i - the index of the value to modifyv - modification amount
public final TupleNf<T> mulValue(int i,
float v)
mulValue in interface TupleInterface<T extends TupleNf<?>>i - the index of the value to modifyv - modification amount
public final TupleNf<T> mul(float v)
mul in interface TupleInterface<T extends TupleNf<?>>v - modification amount
public final TupleNf<T> divValue(int i,
float v)
divValue in interface TupleInterface<T extends TupleNf<?>>i - the index of the value to modifyv - modification amount
public final TupleNf<T> div(float v)
div in interface TupleInterface<T extends TupleNf<?>>v - modification amount
public TupleNf<T> set(float[] values)
set in interface TupleInterface<T extends TupleNf<?>>values - the values array (must be at least size getSize())
public final TupleNf<T> set(TupleNf<?> tuple)
set in interface TupleInterface<T extends TupleNf<?>>tuple - the tuple to be copied
public void get(float[] buffer)
get in interface TupleInterface<T extends TupleNf<?>>buffer - the buffer array to write the values topublic final void get(TupleNf<?> buffer)
get in interface TupleInterface<T extends TupleNf<?>>buffer - the buffer Tuple to write the values topublic final TupleNf<T> setZero()
setZero in interface TupleInterface<T extends TupleNf<?>>public final TupleNf<T> negate()
negate in interface TupleInterface<T extends TupleNf<?>>public final TupleNf<T> negate(T tuple)
negate in interface TupleInterface<T extends TupleNf<?>>tuple - the source vector
public final TupleNf<T> absolute()
absolute in interface TupleInterface<T extends TupleNf<?>>public final TupleNf<T> absolute(T tuple)
absolute in interface TupleInterface<T extends TupleNf<?>>tuple - the source tuple, which will not be modified
public final TupleNf<T> add(T tuple1,
T tuple2)
add in interface TupleInterface<T extends TupleNf<?>>tuple1 - the first tupletuple2 - the second tuple
public final TupleNf<T> add(T tuple2)
add in interface TupleInterface<T extends TupleNf<?>>tuple2 - the other tuple
public final TupleNf<T> sub(T tuple1,
T tuple2)
sub in interface TupleInterface<T extends TupleNf<?>>tuple1 - the first tupletuple2 - the second tuple
public final TupleNf<T> sub(T tuple2)
sub in interface TupleInterface<T extends TupleNf<?>>tuple2 - the other tuple
public final TupleNf<T> scale(float factor,
T tuple)
scale in interface TupleInterface<T extends TupleNf<?>>factor - the scalar valuetuple - the source tuple
public final TupleNf<T> scale(float factor)
scale in interface TupleInterface<T extends TupleNf<?>>factor - the scalar value
public final TupleNf<T> scaleAdd(float factor,
T tuple1,
T tuple2)
scaleAdd in interface TupleInterface<T extends TupleNf<?>>factor - the scalar valuetuple1 - the tuple to be multipledtuple2 - the tuple to be added
public final TupleNf<T> scaleAdd(float factor,
T tuple2)
scaleAdd in interface TupleInterface<T extends TupleNf<?>>factor - the scalar valuetuple2 - the tuple to be added
public final TupleNf<T> clampMin(float min)
clampMin in interface TupleInterface<T extends TupleNf<?>>min - the lowest value in this tuple after clamping
public final TupleNf<T> clampMax(float max)
clampMax in interface TupleInterface<T extends TupleNf<?>>max - the highest value in the tuple after clamping
public final TupleNf<T> clamp(float min,
float max)
clamp in interface TupleInterface<T extends TupleNf<?>>min - the lowest value in this tuple after clampingmax - the highest value in this tuple after clamping
public final TupleNf<T> clamp(float min,
float max,
T tuple)
clamp in interface TupleInterface<T extends TupleNf<?>>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 TupleNf<T> clampMin(float min,
T tuple)
clampMin in interface TupleInterface<T extends TupleNf<?>>min - the lowest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final TupleNf<T> clampMax(float max,
T tuple)
clampMax in interface TupleInterface<T extends TupleNf<?>>max - the highest value in the tuple after clampingtuple - the source tuple, which will not be modified
public final TupleNf<T> round(T tuple,
int decPlaces)
round in interface TupleInterface<T extends TupleNf<?>>public final TupleNf<T> round(int decPlaces)
round in interface TupleInterface<T extends TupleNf<?>>
public void interpolate(T t2,
float alpha)
interpolate in interface TupleInterface<T extends TupleNf<?>>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<?>>t1 - the first tuplet2 - the second tuplealpha - the alpha interpolation parameterpublic 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<?>>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 | |||||||||