|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.utils.math.Vectors3f
public class Vectors3f
The Vectors3f
class supplies convenience methods for 3 dimensional vector (represented as a float array
with length 3 ) calculations. No checking what so ever is done, so the callee has to make sure the arrays are
initialized and have a length of 3.
Two different methods of almost all functions exist, one which creates a new allocated array and one which puts the result in a supplied array. Again, the callee has to make sure the supplied array is initialized and has a length of at least 3.
Constructor Summary | |
---|---|
Vectors3f()
|
Method Summary | |
---|---|
static String |
asString(float[] a)
|
static float[] |
cross(float[] a,
float[] b)
Calculate the cross product of given vectors and store the result in a new allocated array of length 3. |
static void |
cross(float[] a,
float[] b,
float[] result)
Calculate the cross product of given vectors and store the result in given result vector with length 3 |
static float |
distance(float[] a,
float[] b)
Returns the distance between the two given vectors. |
static float |
distance(float[] a,
int ia,
float[] b,
int ib)
Returns the distance between the two given vectors. |
static float |
dot(float[] a,
float[] b)
Calculate the dot product of given vectors (with length 3). |
static boolean |
equals(float[] first,
float[] second,
float precision)
|
static float |
length(float[] a)
|
static float[] |
normal(float[] a,
float[] b,
float[] c)
Calculate the normal vector for given vectors a, b, c by calculating the cross product from ab x ac and store the result in a new allocated array with length 3. |
static void |
normal(float[] a,
float[] b,
float[] c,
float[] result)
Calculate the normal vector for given vectors a, b, c by calculating the cross product from ab x ac and store the result in given result vector. |
static float[] |
normal(float[] a,
int index)
Calculate the normal vector for vectors starting at index by using the vectors a=(index, index+1, index+2), b=(index+3, index+4, index+5) and c=(index+6, index+7, index+8) by calculating the cross product from ab x ac and store the result in a new allocated array with length 3. |
static void |
normal(float[] a,
int index,
float[] result)
Calculate the normal vector for vectors starting at index by using the vectors a=(index, index+1, index+2), b=(index+3, index+4, index+5) and c=(index+6, index+7, index+8) by calculating the cross product from ab x ac and store the result in given array with length 3. |
static float[] |
normal(float[] a,
int ia,
int ib,
int ic)
Calculate the normal vector for vectors starting at index by using the vectors a=(ia, ia+1, ia+2), b=(ib, ib+1, ib+3) and c=(ic, ic+1, ic+2) by calculating the cross product from ab x ac and store the result in a new allocated array with length 3. |
static void |
normal(float[] a,
int ia,
int ib,
int ic,
float[] result)
Calculate the normal vector for vectors starting at given indizes a=(ia, ia+1, ia+2), b=(ib, ib+1, ib+2) and c=(ic, ic+1, ic+2) by calculating the cross product from ab x ac and store the result in given array with length 3. |
static float[] |
normalize(float[] a)
Normalize the given vector (of length 3) and store the result in a new allocated array of length 3. |
static float[] |
normalizedNormal(float[] a,
float[] b,
float[] c)
Calculate the normalized normal vector for given triangle with vertices a, b, c by calculating the cross product from ab x ac and normalize the result which will be stored in a new allocated array of length 3. |
static void |
normalizedNormal(float[] a,
float[] b,
float[] c,
float[] result)
Calculate the normalized normal vector for given triangle with vertices a, b, c by calculating the cross product from ab x ac and normalize the result which will be stored in the given result array with length 3. |
static float[] |
normalizedNormal(float[] a,
int index)
Calculate the normal vector for vectors starting at index by using the vectors a=(index, index+1, index+2), b=(index+3, index+4, index+5) and c=(index+6, index+7, index+8) by calculating the cross product from ab x ac and store the result in a new allocated array with length 3. |
static void |
normalizedNormal(float[] a,
int index,
float[] result)
Calculate the normalized normal vector for given triangle with vertices a=(index, index+1, index+2), b=(index+3, index+4, index+5) and c=(index+6, index+7, index+8) by calculating the cross product from ab x ac and normalize the result which will be stored in the given result array with length 3. |
static float[] |
normalizedNormal(float[] a,
int ia,
int ib,
int ic)
Calculate the normal vector for vectors starting at index by using the vectors a=(ia, ia+1, ia+2), b=(ib, ib+1, ib+2) and c=(ic, ic+1, ic+2) by calculating the cross product from ab x ac and store the result in a new allocated array with length 3. |
static void |
normalizedNormal(float[] a,
int ia,
int ib,
int ic,
float[] result)
Calculate the normalized normal vector for given triangle with vertices a=(ia, ia+1, ia+2), b=(ib, ib+1, ib+2) and c=(ic, ic+1, ic+2) by calculating the cross product from ab x ac and normalize the result which will be stored in the given result array with length 3. |
static void |
normalizeInPlace(float[] a)
Normalize the given vector (of length 3) in place. |
static void |
scale(float scale,
float[] vector)
Apply the given scale to all scalars in the vector |
static float[] |
sub(float[] a,
float[] b)
Subtract b from a and store the result in a new allocated float[3] array. |
static void |
sub(float[] a,
float[] b,
float[] result)
Subtract b from a and store the result in result. |
static float[] |
sub(float[] a,
int ia,
int ib)
|
static void |
sub(float[] a,
int ia,
int ib,
float[] result)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Vectors3f()
Method Detail |
---|
public static float distance(float[] a, float[] b)
a
- array with length 3b
- array with length 3
public static float distance(float[] a, int ia, float[] b, int ib)
a
- array with arbitrary lengthia
- index of vector in a arrayb
- array with arbitrary lengthib
- index of vector in b array
public static void sub(float[] a, float[] b, float[] result)
a
- array with length 3b
- array with length 3result
- array with length 3public static float[] sub(float[] a, float[] b)
a
- array with length 3b
- array with length 3
public static void sub(float[] a, int ia, int ib, float[] result)
a
- an array containing the ordinates of the vectorsia
- index of the first vectorib
- index of the second vectorresult
- an array with length 3public static float[] sub(float[] a, int ia, int ib)
a
- an array containing the ordinates of the vectorsia
- index of the first vectorib
- index of the second vector
public static final String asString(float[] a)
a
- array with length 3
public static final float[] normal(float[] a, int index)
a
- array with length > index + 9index
- index of the first vector
public static final float[] normal(float[] a, int ia, int ib, int ic)
a
- array containing the ordinates of the vectorsia
- index of the first vectorib
- index of the second vectoric
- index of the third vector
public static final void normal(float[] a, int ia, int ib, int ic, float[] result)
a
- array containing the ordinates of the vectorsia
- index of the first vectorib
- index of the second vectoric
- index of the third vectorresult
- array with length 3
IndexOutOfBoundsException
- if one of the indizes doesn't fitpublic static final void normal(float[] a, int index, float[] result)
a
- an array containing the ordinates of the vectors with length > index + 9index
- index of the first vectorresult
- array with length 3
IndexOutOfBoundsException
- if a.length < index +9public static final float[] normalizedNormal(float[] a, int index)
a
- array containing the ordinates of the vectors with length > index + 9index
- index of the first vector
public static final float[] normalizedNormal(float[] a, int ia, int ib, int ic)
a
- array containing the ordinates of the vectorsia
- index of the first vectorib
- index of the second vectoric
- index of the third vector
public static final void normalizedNormal(float[] a, int index, float[] result)
a
- array containing the ordinates of the vectors with length > index + 9index
- index of the first vectorresult
- array with length 3public static final void normalizedNormal(float[] a, int ia, int ib, int ic, float[] result)
a
- array containing the ordinates of the vectorsia
- index of the first vectorib
- index of the second vectoric
- index of the third vectorresult
- array with length 3public static final float[] normal(float[] a, float[] b, float[] c)
a
- array with length 3b
- array with length 3c
- array with length 3
public static final void normal(float[] a, float[] b, float[] c, float[] result)
a
- array with length 3b
- array with length 3c
- array with length 3result
- array with length 3public static final float[] normalizedNormal(float[] a, float[] b, float[] c)
a
- array with length 3b
- array with length 3c
- array with length 3
public static final void normalizedNormal(float[] a, float[] b, float[] c, float[] result)
a
- array with length 3b
- array with length 3c
- array with length 3result
- array with length 3public static final float[] cross(float[] a, float[] b)
a
- array with length 3b
- array with length 3
public static final void cross(float[] a, float[] b, float[] result)
a
- array with length 3b
- array with length 3result
- array with length 3public static final float dot(float[] a, float[] b)
a
- array with length 3b
- array with length 3
public static final float length(float[] a)
a
- array with length 3
public static final void normalizeInPlace(float[] a)
a
- array with length 3public static final float[] normalize(float[] a)
a
- array with length 3
public static boolean equals(float[] first, float[] second, float precision)
first
- second
- precision
-
public static void scale(float scale, float[] vector)
scale
- to be appliedvector
- with length 3.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |