render
Class Vec
java.lang.Object
|
+--render.Vec
- public class Vec
- extends java.lang.Object
Provides functionality to manipulate vectors.
|
Constructor Summary |
Vec()
|
|
Method Summary |
static void |
copy(double[] src,
double[] dst)
Copies contents of the src vector to the dst vector. |
static void |
cross(double[] a,
double[] b,
double[] dst)
Computes the cross-product of two vectors a and b and stores the result in dst. |
static double |
dot(double[] a,
double[] b)
Computes the dot product of vectors a and b. |
static double |
norm(double[] v)
Computes the magnitude of the vector. |
static void |
normalize(double[] v)
Normalizes vector v to unit-length. |
static void |
set(double[] dst,
double x,
double y,
double z)
Populates the dst vector with values x, y, z. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Vec
public Vec()
normalize
public static void normalize(double[] v)
- Normalizes vector v to unit-length.
- Parameters:
v - a vector
norm
public static double norm(double[] v)
- Computes the magnitude of the vector.
- Parameters:
v - a vector- Returns:
- the magnitude of vector v
dot
public static double dot(double[] a,
double[] b)
- Computes the dot product of vectors a and b. Vectors a and b must be of the same length.
- Parameters:
a - source vectorb - source vector- Returns:
- the result of a dot b
cross
public static void cross(double[] a,
double[] b,
double[] dst)
- Computes the cross-product of two vectors a and b and stores the result in dst. a, b, and dst must be 3 dimensional vectors.
- Parameters:
a - source vector 1b - source vector 2dst - resulting vector from a cross b
copy
public static void copy(double[] src,
double[] dst)
- Copies contents of the src vector to the dst vector. Both vectors must be of the same length.
- Parameters:
src - original vectordst - copy of original vector
set
public static void set(double[] dst,
double x,
double y,
double z)
- Populates the dst vector with values x, y, z.
- Parameters:
dst - vector to be populatedx - component 0y - component 1z - component 2