java.lang.Cloneable
, MatrixTransformation
, Transformation
public class Matrix3DTransformation extends java.lang.Object implements MatrixTransformation
Modifier and Type | Class | Description |
---|---|---|
protected static class |
Matrix3DTransformation.Affine3DTransformationLoader |
Modifier and Type | Field | Description |
---|---|---|
protected double[][] |
inverseMatrix |
|
protected double[][] |
matrix |
|
protected double[] |
origin |
Constructor | Description |
---|---|
Matrix3DTransformation(double[][] matrix) |
Constructs a 3D transformation using the given matrix.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
clone() |
Provides a copy of this transformation.
|
static Matrix3DTransformation |
createAlignmentTransformation(double[] v1,
double[] v2) |
Instantiates a rotation that aligns the first vector with the second vector.
|
double[] |
direct(double[] point) |
Transforms the given point+.
|
double[][] |
direct(double[][] mat) |
Transforms the given matrix into the transformation's coordinate system.
|
double[] |
getFlatMatrix(double[] mat) |
Gets the direct homogeneous affine transformation flattened into a 1-d array.
|
static XML.ObjectLoader |
getLoader() |
|
double[] |
getOrigin() |
|
double[] |
getTransposedFlatMatrix(double[] mat) |
Gets the direct homogeneous affine transformation flattened into a 1-d array,
ordered left to right, top to bottom
If the mat parameter is null a double[16] array is created;
otherwise the given array is used.
|
double[] |
inverse(double[] point) |
Transforms the given point using the inverse transformation (if it exists).
|
double[][] |
inverse(double[][] mat) |
Transforms the given matrix from the transformation's coordinate system.
|
void |
multiply(double[][] mat) |
Multiplies this rotation matrix by the given matrix from the right.
|
void |
multiply(Matrix3DTransformation trans) |
Multiplies (concatenates) this transformation matrix with the given transformation.
|
static Matrix3DTransformation |
Quaternion(double[] quaternion) |
Creates an transformation representing a rotation about the origin by the given quaternion.
|
static Matrix3DTransformation |
Quaternion(double q0,
double q1,
double q2,
double q3) |
Creates an AffineMatrix representing a rotation about the origin by the given quaternion components.
|
static Matrix3DTransformation |
rotation(double theta,
double[] axis) |
Creates a 3D transforamtion representing a rotation about the origin by the given angle around
the given axis.
|
static Matrix3DTransformation |
rotationX(double theta) |
Creates a 3D transforamtion representing a rotation about the x axis by the given angle.
|
static Matrix3DTransformation |
rotationY(double theta) |
Creates a 3D transforamtion representing a rotation about the y axis by the given angle.
|
static Matrix3DTransformation |
rotationZ(double theta) |
Creates a 3D transforamtion representing a rotation about the z axis by the given angle.
|
boolean |
setMatrix(double[] newMatrix) |
Sets the matrix array of the rotation
|
boolean |
setMatrix(double[][] newMatrix) |
Sets the double[][] matrix array of the rotation
|
double[] |
setOrigin(double[] origin) |
Sets the origin for this rotation.
|
void |
setOrigin(double ox,
double oy,
double oz) |
Sets the origin for this rotation.
|
double[] |
toQuaternion(double[] q) |
protected double[] origin
protected double[][] matrix
protected double[][] inverseMatrix
public Matrix3DTransformation(double[][] matrix)
matrix
- double[][]public static Matrix3DTransformation rotationX(double theta)
theta
- doublepublic static Matrix3DTransformation rotationY(double theta)
theta
- doublepublic static Matrix3DTransformation rotationZ(double theta)
theta
- doublepublic static Matrix3DTransformation rotation(double theta, double[] axis)
theta
- doubleaxis
- double[]public static Matrix3DTransformation Quaternion(double[] quaternion)
quaternion
- double[]public static Matrix3DTransformation Quaternion(double q0, double q1, double q2, double q3)
q0
- q1
- q2
- q3
- public boolean setMatrix(double[][] newMatrix)
newMatrix
- public boolean setMatrix(double[] newMatrix)
matrix
- a double[9] array with the matrix components
in this order {m[0][0],m[0][1],m[0][2],m[1][0],...}public java.lang.Object clone()
clone
in interface Transformation
clone
in class java.lang.Object
public final double[] getFlatMatrix(double[] mat)
getFlatMatrix
in interface MatrixTransformation
mat
- double[] optional matrixpublic final double[] getTransposedFlatMatrix(double[] mat)
mat
- double[] optional matrixpublic final double[] toQuaternion(double[] q)
public static Matrix3DTransformation createAlignmentTransformation(double[] v1, double[] v2)
v1
- double[]v2
- double[]public void setOrigin(double ox, double oy, double oz)
ox
- doubleoy
- doubleoz
- doublepublic final void multiply(Matrix3DTransformation trans)
trans
- Matrix3DTransformationpublic final void multiply(double[][] mat)
mat
- double[][]public double[] setOrigin(double[] origin)
origin
- double[] the new originpublic double[] direct(double[] point)
direct
in interface Transformation
point
- the coordinates to be transformedpublic double[][] direct(double[][] mat)
matrix
- to be transformedpublic double[] inverse(double[] point) throws java.lang.UnsupportedOperationException
inverse
in interface Transformation
point
- the coordinates to be transformedjava.lang.UnsupportedOperationException
- If the transformation is
not invertiblepublic double[][] inverse(double[][] mat)
matrix
- to be transformedpublic double[] getOrigin()
public static XML.ObjectLoader getLoader()