org.openmali.vecmath2
Interface TupleInterface<T extends TupleNf<T>>

All Known Subinterfaces:
PointInterface<T,P>, VectorInterface<T,V>
All Known Implementing Classes:
AxisAngle3f, Point2f, Point3f, Quaternion4f, Tuple2f, Tuple3f, TupleNf, Vector2f, Vector3f, Vector4f, VectorNf

public interface TupleInterface<T extends TupleNf<T>>

This is the base interface for all tuple types. Using it may slow down execution time because of prevented inlining.


Method Summary
 TupleInterface<T> absolute()
          Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.
 TupleInterface<T> absolute(T tuple)
          Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.
 TupleInterface<T> add(T tuple2)
          Sets the value of this tuple to the vector sum of itself and tuple t1.
 TupleInterface<T> add(T tuple1, T tuple2)
          Sets the value of this tuple to the vector sum of tuples t1 and t2.
 TupleInterface<T> addValue(int i, float v)
          Adds v to this tuple's i'th value.
 TupleInterface<T> clamp(float min, float max)
          Clamps this tuple to the range [min, max].
 TupleInterface<T> clamp(float min, float max, T tuple)
          Clamps the tuple parameter to the range [min, max] and places the values into this tuple.
 TupleInterface<T> clampMax(float max)
          Clamps the maximum value of this tuple to the max parameter.
 TupleInterface<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.
 TupleInterface<T> clampMin(float min)
          Clamps the minimum value of this tuple to the min parameter.
 TupleInterface<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.
 TupleInterface<T> div(float v)
          Divides all components of this tuple by v.
 TupleInterface<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.
 TupleInterface<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.
 int getSize()
           
 float getValue(int i)
          Sets the i-th value of this tuple.
 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()
           
 TupleInterface<T> mul(float v)
          Multiplies all components of this tuple with v.
 TupleInterface<T> mulValue(int i, float v)
          Multiplies v to this tuple's i'th value.
 TupleInterface<T> negate()
          Negates the value of this vector in place.
 TupleInterface<T> negate(T tuple)
          Sets the value of this tuple to the negation of tuple that.
 TupleInterface<T> round(int decPlaces)
          Rounds this tuple to the given number of decimal places.
 TupleInterface<T> round(T tuple, int decPlaces)
          Rounds this tuple to the given number of decimal places.
 TupleInterface<T> scale(float factor)
          Sets the value of this tuple to the scalar multiplication of itself.
 TupleInterface<T> scale(float factor, T tuple)
          Sets the value of this tuple to the scalar multiplication of tuple t1.
 TupleInterface<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).
 TupleInterface<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).
 TupleInterface<T> set(float[] values)
          Sets all values of this Tuple to the specified ones.
 TupleInterface<T> set(float[] values, int offset)
          Sets all values of this Tuple to the specified ones.
 TupleInterface<T> set(TupleNf<?> tuple)
          Sets all three values of this Tuple to the specified ones.
 boolean setClean()
          Marks this tuple non-dirty.
 TupleInterface<T> setValue(int i, float v)
          Sets the i-th value of this tuple.
 TupleInterface<T> setZero()
          Sets all components to zero.
 TupleInterface<T> sub(T tuple2)
          Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).
 TupleInterface<T> sub(T tuple1, T tuple2)
          Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).
 TupleInterface<T> subValue(int i, float v)
          Subtracts v of this tuple's i'th value.
 

Method Detail

isReadOnly

boolean isReadOnly()
Returns:
Is this tuple a read-only one?

setClean

boolean setClean()
Marks this tuple non-dirty. Any value-manipulation will mark it dirty again.

Returns:
the old value

isDirty

boolean isDirty()
Returns:
This tuple's dirty-flag

getSize

int getSize()
Returns:
this Tuple's size().

setValue

TupleInterface<T> setValue(int i,
                           float v)
Sets the i-th value of this tuple.

Returns:
itself

getValue

float getValue(int i)
Sets the i-th value of this tuple.


fill

TupleInterface<T> fill(float f)
Sets all values of this TupleNf to f.

Parameters:
f -
Returns:
itself

addValue

TupleInterface<T> addValue(int i,
                           float v)
Adds v to this tuple's i'th value.

Parameters:
i - the index of the value to modify
v - modification amount
Returns:
itself

subValue

TupleInterface<T> subValue(int i,
                           float v)
Subtracts v of this tuple's i'th value.

Parameters:
i - the index of the value to modify
v - modification amount
Returns:
itself

mulValue

TupleInterface<T> mulValue(int i,
                           float v)
Multiplies v to this tuple's i'th value.

Parameters:
i - the index of the value to modify
v - modification amount
Returns:
itself

mul

TupleInterface<T> mul(float v)
Multiplies all components of this tuple with v.

Parameters:
v - modification amount
Returns:
itself

divValue

TupleInterface<T> divValue(int i,
                           float v)
Divides this tuple's i'th value by v.

Parameters:
i - the index of the value to modify
v - modification amount
Returns:
itself

div

TupleInterface<T> div(float v)
Divides all components of this tuple by v.

Parameters:
v - modification amount
Returns:
itself

set

TupleInterface<T> set(float[] values,
                      int offset)
Sets all values of this Tuple to the specified ones.

Parameters:
values - the values array (must be at least size getSize())
offset - the offset in the (source) values array
Returns:
itself

set

TupleInterface<T> set(float[] values)
Sets all values of this Tuple to the specified ones.

Parameters:
values - the values array (must be at least size getSize())
Returns:
itself

set

TupleInterface<T> set(TupleNf<?> tuple)
Sets all three values of this Tuple to the specified ones.

Parameters:
tuple - the tuple to be copied
Returns:
itself

get

void get(float[] buffer,
         int offset)
Writes all values of this Tuple to the specified buffer.

Parameters:
buffer - the buffer array to write the values to
offset - the offset in the (target) buffer array

get

void get(float[] buffer)
Writes all values of this Tuple to the specified buffer.

Parameters:
buffer - the buffer array to write the values to

get

void get(TupleNf<?> buffer)
Writes all values of this Tuple to the specified buffer Tuple.

Parameters:
buffer - the buffer Tuple to write the values to

setZero

TupleInterface<T> setZero()
Sets all components to zero.

Returns:
itself

negate

TupleInterface<T> negate()
Negates the value of this vector in place.

Returns:
itself

negate

TupleInterface<T> negate(T tuple)
Sets the value of this tuple to the negation of tuple that.

Parameters:
tuple - the source vector
Returns:
itself

absolute

TupleInterface<T> absolute()
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.

Returns:
itself

absolute

TupleInterface<T> absolute(T tuple)
Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.

Parameters:
tuple - the source tuple, which will not be modified
Returns:
itself

add

TupleInterface<T> add(T tuple1,
                      T tuple2)
Sets the value of this tuple to the vector sum of tuples t1 and t2.

Parameters:
tuple1 - the first tuple
tuple2 - the second tuple
Returns:
itself

add

TupleInterface<T> add(T tuple2)
Sets the value of this tuple to the vector sum of itself and tuple t1.

Parameters:
tuple2 - the other tuple
Returns:
itself

sub

TupleInterface<T> sub(T tuple1,
                      T tuple2)
Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).

Parameters:
tuple1 - the first tuple
tuple2 - the second tuple
Returns:
itself

sub

TupleInterface<T> sub(T tuple2)
Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).

Parameters:
tuple2 - the other tuple
Returns:
itself

scale

TupleInterface<T> scale(float factor,
                        T tuple)
Sets the value of this tuple to the scalar multiplication of tuple t1.

Parameters:
factor - the scalar value
tuple - the source tuple
Returns:
itself

scale

TupleInterface<T> scale(float factor)
Sets the value of this tuple to the scalar multiplication of itself.

Parameters:
factor - the scalar value
Returns:
itself

scaleAdd

TupleInterface<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).

Parameters:
factor - the scalar value
tuple1 - the tuple to be multipled
tuple2 - the tuple to be added
Returns:
itself

scaleAdd

TupleInterface<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).

Parameters:
factor - the scalar value
tuple2 - the tuple to be added
Returns:
itself

clampMin

TupleInterface<T> clampMin(float min)
Clamps the minimum value of this tuple to the min parameter.

Parameters:
min - the lowest value in this tuple after clamping
Returns:
itself

clampMax

TupleInterface<T> clampMax(float max)
Clamps the maximum value of this tuple to the max parameter.

Parameters:
max - the highest value in the tuple after clamping
Returns:
itself

clamp

TupleInterface<T> clamp(float min,
                        float max)
Clamps this tuple to the range [min, max].

Parameters:
min - the lowest value in this tuple after clamping
max - the highest value in this tuple after clamping
Returns:
itself

clamp

TupleInterface<T> clamp(float min,
                        float max,
                        T tuple)
Clamps the tuple parameter to the range [min, max] and places the values into this tuple.

Parameters:
min - the lowest value in the tuple after clamping
max - the highest value in the tuple after clamping
tuple - the source tuple, which will not be modified
Returns:
itself

clampMin

TupleInterface<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.

Parameters:
min - the lowest value in the tuple after clamping
tuple - the source tuple, which will not be modified
Returns:
itself

clampMax

TupleInterface<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.

Parameters:
max - the highest value in the tuple after clamping
tuple - the source tuple, which will not be modified
Returns:
itself

round

TupleInterface<T> round(T tuple,
                        int decPlaces)
Rounds this tuple to the given number of decimal places.

Parameters:
decPlaces -
Returns:
itself

round

TupleInterface<T> round(int decPlaces)
Rounds this tuple to the given number of decimal places.

Parameters:
decPlaces -
Returns:
itself

interpolate

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.

Parameters:
t2 - the first tuple
alpha - the alpha interpolation parameter

interpolate

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.

Parameters:
t1 - the first tuple
t2 - the second tuple
alpha - the alpha interpolation parameter

epsilonEquals

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. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2), . . . ].

Parameters:
v2 - The vector to be compared to this vector
epsilon - the threshold value