|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.math.Vec2f
public final class Vec2f
A collection of methods for vectors of length 3, represented by float arrays. Vectors can be stored within arrays of length three, or they can be stored inside a larger float array a, together with an integer offset "index" into that array. This represents a vector with components (a[index], a[index+1], a[index+2]). The methods from this class never allocate new arrays; rather, they assume that results are to be stored into some existing "destination" array.
| Field Summary | |
|---|---|
private static int |
BUFSIZE
|
static int |
VEC2F_SIZE
Length of Vec2f arrays is 2 |
static int |
X
Offset values for Vec4 vectors. |
static int |
Y
|
| Constructor Summary | |
|---|---|
private |
Vec2f()
|
| Method Summary | |
|---|---|
static void |
add(float[] dst,
float[] a)
Adds vector b to vector a. |
static void |
add(float[] dst,
float[] a,
float[] b)
Adds vector a and b, puts result in dest. |
static void |
add(float[] dst,
float ax,
float ay,
float az)
Adds 2 floats to dst |
static void |
add(float[] dst,
int dstIndex,
float[] a,
int aIndex)
Adds vector b to vector a. |
static void |
add(float[] dst,
int dstIndex,
float[] a,
int aIndex,
float[] b,
int bIndex)
Sets vector dst to sum of a and b. |
static float |
dot(float[] a,
float[] b)
Calculates the dot product for two vectors of length 2 |
static float |
dot(float[] a,
int aIndex,
float[] b,
int bIndex)
Calculates the dot product for two vectors of length 2 |
static boolean |
epsilonEquals(float[] a,
float[] b,
float epsilon)
Tests for equality of vectror components within epsilon. |
static boolean |
epsilonEquals(float[] a,
int aIndex,
float[] b,
int bIndex,
float epsilon)
Tests for equality of vector components within epsilon. |
static boolean |
equals(float[] a,
float[] b)
Tests for equality of two vectors |
static boolean |
equals(float[] a,
float bx,
float by)
Tests for equality of one vectors and 2 floats |
static boolean |
equals(float[] a,
int aIndex,
float[] b,
int bIndex)
Tests for equality of two vectors |
static float[] |
getUnitX()
Returns a new unit vector in the x-direction |
static float[] |
getUnitY()
Returns a new unit vector in the y-direction |
static float[] |
getVec2f()
Returns a new float[2] array with zero components |
static float[] |
getVec2f(float[] vec2f)
Rturns a new float[2] array with initialized components |
static float[] |
getVec2f(float x,
float y)
Returns a new float[2] array with initialized components |
static float[] |
getZero()
Returns a new float[2] array with zero components |
static void |
interpolate(float[] dst,
float[] a,
float[] b,
float alpha)
Linear interpolates between vector a and b, and puts the result in vector dst: dst = (1-alpha)*a + alpha*b |
static void |
interpolate(float[] dst,
int dstIndex,
float[] a,
int aIndex,
float[] b,
int bIndex,
float alpha)
Linear interpolates between vector a and b, and puts the result in vector dst: dst = (1-alpha)*a + alpha*b |
static void |
invert(float[] dst)
Replaces dst[i] by 1.0f/dst[i] |
static float |
length(float[] a)
returns the vector length |
static float |
length(float[] a,
int aIndex)
returns the vector length |
static float |
lengthSq(float[] a)
returns the square of the vector length |
static float |
lengthSq(float[] a,
int aIndex)
returns the square of the vector length |
static void |
negate(float[] dst)
Negates a vector |
static void |
negate(float[] dst,
float[] src)
Sets vector dst to the negated version of vector src |
static void |
negate(float[] dst,
int dstIndex)
Negates a vector |
static void |
negate(float[] dst,
int dstIndex,
float[] src,
int srcIndex)
Sets vector dst to the negated version of vector src |
static void |
normalize(float[] a)
Normalizes a, that is, a = a/|a| |
static void |
normalize(float[] dst,
float[] a)
Normalizes a, that is, dst = a/|a| |
static void |
normalize(float[] a,
int aIndex)
Normalizes a, that is, a = a/|a| |
static void |
normalize(float[] dst,
int dstIndex,
float[] a,
int aIndex)
Normalizes a, that is, a = a/|a| |
static void |
pmul(float[] u,
float[] v)
Performs pointwise multiplication of two vectors: u[i] = u[i]*v[i]; |
static void |
scale(float scale,
float[] dst)
Scales a vector |
static void |
scale(float scale,
float[] dst,
float[] src)
Scales a vector dst = scale * src |
static void |
scale(float scale,
float[] dst,
int dstIndex)
Scales a vector |
static void |
scale(float scale,
float[] dst,
int dstIndex,
float[] src,
int srcIndex)
Scales a vector dst = scale * src |
static void |
scaleAdd(float[] dst,
float scale,
float[] a)
First scales vector a, then and a to dst dst = dst + s*a |
static void |
scaleAdd(float[] dst,
float scale,
float[] a,
float[] b)
Sets vector dst to scaled version of vector a, then adds vector b dst = s*a + b |
static void |
scaleAdd(float[] dst,
int dstIndex,
float scale,
float[] a,
int aIndex)
First scales vector a, then and a to dst dst = dst + s*a |
static void |
scaleAdd(float[] dst,
int dstIndex,
float scale,
float[] a,
int aIndex,
float[] b,
int bIndex)
Sets vector a to scaled version of vector b, then adds vector c dst = s*a + b |
static void |
scaleAdd(float scale,
float[] dst,
float[] a)
First scales vector dst, then and adds vector a. |
static void |
scaleAdd(float scale,
float[] dst,
int dstIndex,
float[] a,
int aIndex)
First scales vector dst, then and adds vector a. |
static void |
set(float[] dst,
float[] src)
Copies vector src to vector dst. |
static void |
set(float[] dst,
float x,
float y)
Sets vector components tp specified float values. |
static void |
set(float[] dst,
int dstIndex,
float[] src,
int srcIndex)
Copies vector src to vector dst. |
static void |
set(float[] dst,
int dstIndex,
float x,
float y,
float z)
Sets vector components to specified float values. |
static void |
setZero(float[] dst)
Resets the Vec2f to (0, 0) |
static void |
setZero(float[] dst,
int dstIndex)
Resets the Vec2f to (0, 0) |
static void |
sub(float[] dst,
float[] a)
Subtracts vector a from vector dst. |
static void |
sub(float[] dst,
float[] a,
float[] b)
Subtracts vector b from vector a. |
static void |
sub(float[] dst,
float ax,
float ay,
float az)
Substracts 2 floats from dst |
static void |
sub(float[] dst,
int dstIndex,
float[] a,
int aIndex)
Subtracts vector a from vector dst. |
static void |
sub(float[] dst,
int dstIndex,
float[] a,
int aIndex,
float[] b,
int bIndex)
Sets vector dst to a minus b |
static String |
toString(float[] a)
Returns a String of the form (x, y), representing the Vec2f value. |
static String |
toString(float[] a,
int index)
Returns a String of the form (x, y), representing the Vec2f value. |
static String |
toString(float[] a,
int fieldwidth,
int precision)
Returns a String of the form (x, y), representing the Vec2f value. |
static String |
toString(float[] a,
String fmt)
Returns a String of the form (x, y), representing the Vec2f value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int VEC2F_SIZE
public static final int X
public static final int Y
private static final int BUFSIZE
| Constructor Detail |
|---|
private Vec2f()
| Method Detail |
|---|
public static float[] getVec2f()
public static float[] getVec2f(float x,
float y)
public static float[] getVec2f(float[] vec2f)
public static float[] getZero()
public static float[] getUnitX()
public static float[] getUnitY()
public static boolean equals(float[] a,
int aIndex,
float[] b,
int bIndex)
public static boolean equals(float[] a,
float bx,
float by)
public static boolean equals(float[] a,
float[] b)
public static boolean epsilonEquals(float[] a,
int aIndex,
float[] b,
int bIndex,
float epsilon)
public static boolean epsilonEquals(float[] a,
float[] b,
float epsilon)
public static String toString(float[] a,
int index)
public static String toString(float[] a)
public static String toString(float[] a,
int fieldwidth,
int precision)
public static String toString(float[] a,
String fmt)
public static void setZero(float[] dst)
public static void setZero(float[] dst,
int dstIndex)
public static void set(float[] dst,
int dstIndex,
float[] src,
int srcIndex)
public static void set(float[] dst,
float[] src)
public static void set(float[] dst,
int dstIndex,
float x,
float y,
float z)
public static void set(float[] dst,
float x,
float y)
public static void add(float[] dst,
int dstIndex,
float[] a,
int aIndex,
float[] b,
int bIndex)
public static void add(float[] dst,
int dstIndex,
float[] a,
int aIndex)
public static void add(float[] dst,
float[] a,
float[] b)
public static void add(float[] dst,
float[] a)
public static void add(float[] dst,
float ax,
float ay,
float az)
public static void sub(float[] dst,
int dstIndex,
float[] a,
int aIndex,
float[] b,
int bIndex)
public static void sub(float[] dst,
int dstIndex,
float[] a,
int aIndex)
public static void sub(float[] dst,
float[] a,
float[] b)
public static void sub(float[] dst,
float[] a)
public static void sub(float[] dst,
float ax,
float ay,
float az)
public static void scale(float scale,
float[] dst,
float[] src)
public static void scale(float scale,
float[] dst,
int dstIndex,
float[] src,
int srcIndex)
public static void scale(float scale,
float[] dst,
int dstIndex)
public static void scale(float scale,
float[] dst)
public static void invert(float[] dst)
public static void scaleAdd(float[] dst,
int dstIndex,
float scale,
float[] a,
int aIndex,
float[] b,
int bIndex)
public static void scaleAdd(float[] dst,
float scale,
float[] a,
float[] b)
public static void scaleAdd(float scale,
float[] dst,
int dstIndex,
float[] a,
int aIndex)
public static void scaleAdd(float[] dst,
int dstIndex,
float scale,
float[] a,
int aIndex)
public static void scaleAdd(float[] dst,
float scale,
float[] a)
public static void scaleAdd(float scale,
float[] dst,
float[] a)
public static void negate(float[] dst,
int dstIndex,
float[] src,
int srcIndex)
public static void negate(float[] dst,
float[] src)
public static void negate(float[] dst,
int dstIndex)
public static void negate(float[] dst)
public static float dot(float[] a,
float[] b)
public static float dot(float[] a,
int aIndex,
float[] b,
int bIndex)
public static float lengthSq(float[] a,
int aIndex)
public static float lengthSq(float[] a)
public static float length(float[] a,
int aIndex)
public static float length(float[] a)
public static void interpolate(float[] dst,
int dstIndex,
float[] a,
int aIndex,
float[] b,
int bIndex,
float alpha)
public static void interpolate(float[] dst,
float[] a,
float[] b,
float alpha)
public static void normalize(float[] dst,
int dstIndex,
float[] a,
int aIndex)
a - vector to be normalizedaIndex - index in a arraydst - vector to receive the resultdstIndex - index in dst array
public static void normalize(float[] a,
int aIndex)
a - vector to be normalizedaIndex - index in a array
public static void normalize(float[] dst,
float[] a)
a - vector to be normalizeddst - vector to receive the resultpublic static void normalize(float[] a)
a - vector to be normalized
public static void pmul(float[] u,
float[] v)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||