|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.atzberger.mango.atz3d.Atz_LinearAlgebra
public class Atz_LinearAlgebra
Linear algebra routines needed for many of the operations associated with the 3D rendering engine.
Constructor Summary | |
---|---|
Atz_LinearAlgebra()
|
Method Summary | |
---|---|
static void |
genRotationMatrix(double[] vec_theta,
double[] matrix_result)
Create rotation matrix about a given axis. |
static void |
matrixLeftMultPtsX(int m,
int n,
double[] matrix,
double[] ptsX,
double[] result)
Multiply a collection of points (vectors) on the left by a given matrix. |
static void |
matrixMatrixMult(int m1,
int n1,
double[] matrixA,
int m2,
int n2,
double[] matrixB,
double[] result)
Multiply two matrices. |
static void |
matrixTranspose(int m,
int n,
double[] matrix,
double[] result)
Transpose a given matrix represented using our array format. |
static void |
matrixVecMult(int m,
int n,
double[] matrix,
double[] vec,
double[] result)
Multiply a vector by a matrix on the left. |
static void |
performRotation(double[] vec_theta,
double[] vec_w,
double[] vec_result)
Performs rotation of a vector w about the axis vec_theta by the amount theta. |
static double |
vecNorm(double[] vec)
Compute the norm of a vector |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Atz_LinearAlgebra()
Method Detail |
---|
public static void matrixTranspose(int m, int n, double[] matrix, double[] result)
m
- n
- matrix
- result
- public static void matrixLeftMultPtsX(int m, int n, double[] matrix, double[] ptsX, double[] result)
m
- n
- matrix
- ptsX
- result
- public static void matrixVecMult(int m, int n, double[] matrix, double[] vec, double[] result)
m
- n
- matrix
- vec
- result
- public static void matrixMatrixMult(int m1, int n1, double[] matrixA, int m2, int n2, double[] matrixB, double[] result)
m1
- n1
- matrixA
- m2
- n2
- matrixB
- result
- public static double vecNorm(double[] vec)
vec
-
public static void performRotation(double[] vec_theta, double[] vec_w, double[] vec_result)
This is done by using a rotation matrix about the z-axis and performing a change of variable to the appropriate axis q = vec_theta/norm(vec_theta).
This can be done by observing that z can be mapped to any point p = -q by using reflection about the plane orthogonal to v = z - p which passes through the origin. The reflection corresponds to the Householder transformation H = I - 2*v*v^T, p = Hz. To obtain a rotation we need to make this unitary matrix orientation preserving (determinant positive), which can be done by reflecting through the origin to obtain G = -H. This gives Gz = q, where G is now a rotation matrix. Note that v = (z - p)/norm(z - p) = (z + q)/norm(z + q). In the case that (z - p) is nearly zero we have that G is approximately the identify I.
The rotation matrix is then given by M = G*R*G^T.
To compute the rotation we avoid construction of the matrix and instead compute the action of the above operators, which is more efficient.
vec_theta
- vec_w
- vec_result
- public static void genRotationMatrix(double[] vec_theta, double[] matrix_result)
vec_theta
- matrix_result
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |