|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jagatoo.util.arrays.ArrayVector
public final class ArrayVector
Utility class, that provides vector-arithmetic methods to be applied to float arrays.
| Constructor Summary | |
|---|---|
ArrayVector()
|
|
| Method Summary | |
|---|---|
static void |
absolute(float[] v1)
Sets each compnent of the given vector v1 to its absolute. |
static void |
add(float[] a,
float[] b,
float[] o)
Adds the array a componentwise to the array b and puts the result into o. |
static float |
angle(float[] v1,
float[] v2)
Returns the angle in radians between vector v1 and v2; The return value is constrained to the range [0, PI]. |
static void |
clamp(float min,
float max,
float[] v)
Clamps the trg vector to the range [min, max]. |
static void |
clamp(float min,
float max,
float[] src,
float[] trg)
Clamps the src vector parameter to the range [min, max] and places the values into the trg vector. |
static void |
clampMax(float max,
float[] v)
Clamps the maximum value of the given vector to the max parameter. |
static void |
clampMax(float max,
float[] src,
float[] trg)
Clamps the maximum value of the tuple parameter to the max parameter and places the values into the trg vector. |
static void |
clampMin(float min,
float[] v)
Clamps the minimum value of the given vector to the min parameter. |
static void |
clampMin(float min,
float[] src,
float[] trg)
Clamps the minimum value of the tuple parameter to the min parameter and places the values into the trg vector. |
static float[] |
clone(float[] v)
Creates a new instance of this float array and copies all values. |
static void |
cross(float[] v1,
float[] v2,
float[] o)
Sets vector o to be the vector cross product of vectors v1 and v2. |
static float |
distance(float[] p1,
float[] p2)
Returns the distance between points p1 and p2. |
static float |
distanceSquared(float[] p1,
float[] p2)
Computes the square of the distance between points p1 and p2. |
static float |
dot(float[] v1,
float[] v2)
Computes the dot product of the vectors v1 and v2. |
static void |
interpolate(float[] v1,
float[] v2,
float alpha)
Linearly interpolates between vector v1 and t2 and places the result into v1: v1 = (1 - alpha) * v1 + alpha * v2. |
static void |
interpolate(float[] v1,
float[] v2,
float alpha,
float[] o)
Linearly interpolates between vectors v1 and v2 and places the result into vector o: o = (1 - alpha) * v1 + alpha * v2. |
static float |
length(float[] vector)
Returns the length of the given vector. |
static float |
lengthSquared(float[] vector)
Returns the squared length of the given vector. |
static void |
negate(float[] v1)
Negates the given vector v1. |
static void |
normalize(float[] v1)
Normalizes the given vector v1. |
static void |
round(float[] v,
int decPlaces)
Rounds the vector to the given number of decimal places. |
static void |
scale(float factor,
float[] vector)
Sets the value of the given vector to the scalar multiplication of vector v1. |
static void |
set(float[] src,
float[] trg)
Sets the elements of dst to src. |
static void |
sub(float[] a,
float[] b,
float[] o)
Subtracts the array b componentwise from the array a and puts the result into o. |
static java.lang.String |
toString(float[] vector)
Creates a String representation of the given vector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayVector()
| Method Detail |
|---|
public static final void sub(float[] a,
float[] b,
float[] o)
a - b - o -
public static final void add(float[] a,
float[] b,
float[] o)
a - b - o - public static final float lengthSquared(float[] vector)
public static final float length(float[] vector)
public static final float distanceSquared(float[] p1,
float[] p2)
p1 - the first pointp2 - the other point
public static final float distance(float[] p1,
float[] p2)
p1 - the first pointp2 - the other point
public static final void cross(float[] v1,
float[] v2,
float[] o)
v1 - the first vectorv2 - the second vectoro - the output vector
public static final float dot(float[] v1,
float[] v2)
v1 - the first vectorv2 - the other vector
public static final void set(float[] src,
float[] trg)
src - the source vectortrg - the target vectorpublic static final float[] clone(float[] v)
v - the source float array
public static final void normalize(float[] v1)
v1 - the input vector
public static final void scale(float factor,
float[] vector)
factor - the scalar valuevector - the vector to be scaledpublic static final void negate(float[] v1)
v1 - the input vectorpublic static final void absolute(float[] v1)
v1 - the input vector
public static final float angle(float[] v1,
float[] v2)
v1 - the first vectorv2 - the seconds vector
public static final void clampMin(float min,
float[] v)
min - the lowest value in the vector after clampingv - teh vector to clamp (modify)
public static final void clampMin(float min,
float[] src,
float[] trg)
min - the lowest value in the tuple after clampingsrc - the source tuple, which will not be modifiedtrg - the target tuple, which will be modified
public static final void clampMax(float max,
float[] v)
max - the largest value in the vector after clampingv - the vector to clamp (modify)
public static final void clampMax(float max,
float[] src,
float[] trg)
max - the lowest value in the tuple after clampingsrc - the source tuple, which will not be modifiedtrg - the target tuple, which will be modified
public static final void clamp(float min,
float max,
float[] v)
min - the lowest value in the vector after clampingmax - the highest value in the vector after clamping
public static final void clamp(float min,
float max,
float[] src,
float[] trg)
min - the lowest value in the vector after clampingmax - the highest value in the vector after clampingsrc - the source vector, which will not be modifiedtrg - the target vector, which will be modified
public static void round(float[] v,
int decPlaces)
v - decPlaces -
public static final void interpolate(float[] v1,
float[] v2,
float alpha)
v1 - the first vectorv2 - the second vectoralpha - the alpha interpolation parameter
public static final void interpolate(float[] v1,
float[] v2,
float alpha,
float[] o)
v1 - the first vectorv2 - the second vectoralpha - the alpha interpolation parameterpublic static final java.lang.String toString(float[] vector)
vector -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||