|
Terrenus HRPT v2.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectterrenus.orbit.VectorOp
public class VectorOp
The VectorOp
class performs various vector and matrix
operations.
Field Summary | |
---|---|
static int |
X
The index of the x coordinate. |
static int |
Y
The index of the y coordinate. |
static int |
Z
The index of the z coordinate. |
Constructor Summary | |
---|---|
VectorOp()
|
Method Summary | |
---|---|
static double[] |
add(double[] vectorA,
double[] vectorB,
double[] output)
Computes the sum two vectors, a + b. |
static double[] |
cross(double[] vectorA,
double[] vectorB,
double[] output)
Computes the cross product of two vectors, a x b. |
static double |
dot(double[] vectorA,
double[] vectorB)
Computes the dot product of two vectors, a (dot) b. |
static double |
magnitude(double[] vector)
Computes the vector 2-norm magnitude. |
static double[][] |
multiply(double[][] matrixA,
double[][] matrixB,
double[][] output)
Computes the product of two matrices, AB. |
static double[] |
multiply(double[][] matrix,
double[] vector,
double[] output)
Applies a matrix transform to a vector. |
static double[] |
multiply(double[] vector,
double factor,
double[] output)
Multiplies a vector by a scalar. |
static double[] |
normalize(double[] vector,
double[] output)
Normalizes a vector to unit magnitude. |
static double[][] |
rotationMatrix(int axis,
double theta,
double[][] output)
Computes a rotation matrix. |
static double[] |
subtract(double[] vectorA,
double[] vectorB,
double[] output)
Computes the difference of two vectors, a - b. |
static java.lang.String |
toString(double[] vector)
Converts a vector to a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int X
public static final int Y
public static final int Z
Constructor Detail |
---|
public VectorOp()
Method Detail |
---|
public static double[] multiply(double[] vector, double factor, double[] output)
vector
- the vector to multiply.factor
- the scalar multiple.output
- the output vector to fill. If null, an
output vector is created.
public static double magnitude(double[] vector)
vector
- the vector to compute magnitude.
public static double[] normalize(double[] vector, double[] output)
vector
- the vector to normalize.output
- the output vector to fill. If null, an
output vector is created.
public static double[] cross(double[] vectorA, double[] vectorB, double[] output)
vectorA
- the first vector in the product.vectorB
- the second vector in the product.output
- the output vector to fill. If null, an
output vector is created.
public static double[] add(double[] vectorA, double[] vectorB, double[] output)
vectorA
- the first vector in the sum.vectorB
- the second vector in the sum.output
- the output vector to fill. If null, an
output vector is created.
public static double[] subtract(double[] vectorA, double[] vectorB, double[] output)
vectorA
- the first vector in the difference.vectorB
- the second vector in the difference.output
- the output vector to fill. If null, an
output vector is created.
public static double[] multiply(double[][] matrix, double[] vector, double[] output)
matrix
- the matrix to apply.vector
- the vector to transform.output
- the output vector to fill. If null, an
output vector is created.
public static double dot(double[] vectorA, double[] vectorB)
vectorA
- the first vector in the product.vectorB
- the second vector in the product.
public static double[][] rotationMatrix(int axis, double theta, double[][] output)
axis
- the axis about which the matrix should rotate: X, Y, or Z.theta
- the angle to rotate in radians. A positive angle
will rotate coordinates in a counter-clockwise direction (right
hand rule, thumb pointing along the positive axis).output
- the output matrix to fill. If null, an output
matrix is created.
public static double[][] multiply(double[][] matrixA, double[][] matrixB, double[][] output)
matrixA
- the first matrix in the product.matrixB
- the second matrix in the product.output
- the output matrix to fill. If null, an
output matrix is created.
public static java.lang.String toString(double[] vector)
|
Terrenus HRPT v2.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |