java.lang.Cloneable
, MatrixTransformation
, Transformation
public class Matrix2DTransformation extends java.lang.Object implements MatrixTransformation
Modifier and Type | Class | Description |
---|---|---|
protected static class |
Matrix2DTransformation.Matrix2DTransformationLoader |
Constructor | Description |
---|---|
Matrix2DTransformation(double[][] matrix) |
Constructs a 2D transformation using the given matrix.
|
Matrix2DTransformation(java.awt.geom.AffineTransform transform) |
Constructor Matrix2DTransformation
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.Object |
clone() |
Provides a copy of this transformation.
|
static Matrix2DTransformation |
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[] |
getFlatMatrix(double[] mat) |
Gets the direct homogeneous affine transformation flattened into a 1-d arrray.
|
static XML.ObjectLoader |
getLoader() |
|
java.awt.geom.AffineTransform |
getTotalTransform() |
|
double[] |
inverse(double[] point) |
Transforms the given point using the inverse transformation (if it exists).
|
void |
multiply(double[][] mat) |
Multiplies this rotation matrix by the given matrix.
|
void |
multiply(Matrix2DTransformation trans) |
Multiplies (concatenates) this transformation matrix with the given transformation.
|
static Matrix2DTransformation |
rotation(double theta) |
Creates a 2D transformation representing a rotation about the origin by the given angle.
|
static Matrix2DTransformation |
rotation(double theta,
double anchorx,
double anchory) |
Creates a 2D transformation representing a rotation about the origin by the given angle around
the given axis.
|
double[] |
setOrigin(double[] origin) |
Sets the origin for this rotation.
|
void |
setOrigin(double ox,
double oy) |
Sets the origin for this rotation.
|
public Matrix2DTransformation(double[][] matrix)
matrix
- double[][]public Matrix2DTransformation(java.awt.geom.AffineTransform transform)
transform
- public static Matrix2DTransformation rotation(double theta)
theta
- doublepublic static Matrix2DTransformation rotation(double theta, double anchorx, double anchory)
theta
- doubleanchorx
- doubleanchory
- doublepublic java.awt.geom.AffineTransform getTotalTransform()
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 static Matrix2DTransformation createAlignmentTransformation(double[] v1, double[] v2)
v1
- double[]v2
- double[]public void setOrigin(double ox, double oy)
ox
- doubleoy
- doublepublic double[] setOrigin(double[] origin)
origin
- double[] the new originpublic final void multiply(Matrix2DTransformation trans)
trans
- Matrix2DTransformationpublic final void multiply(double[][] mat)
mat
- double[][]public double[] direct(double[] point)
direct
in interface Transformation
point
- the coordinates 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 static XML.ObjectLoader getLoader()