public class AffineTransformation extends Object
Modifier and Type | Field and Description |
---|---|
private int |
dim
the dimensionality of the transformation
|
private Matrix |
inv
the inverse transformation
|
private Matrix |
trans
The transformation matrix of dim+1 x dim+1 for homogeneous coordinates
|
Constructor and Description |
---|
AffineTransformation(int dim)
Constructor for an identity transformation.
|
AffineTransformation(int dim,
Matrix trans,
Matrix inv)
Trivial constructor with all fields, mostly for cloning
|
Modifier and Type | Method and Description |
---|---|
void |
addAxisReflection(int axis)
Add a reflection along the given axis.
|
void |
addMatrix(Matrix m)
Add a matrix operation to the matrix.
|
void |
addRotation(int axis1,
int axis2,
double angle)
Convenience function to apply a rotation in 2 dimensions.
|
void |
addScaling(double scale)
Simple linear (symmetric) scaling.
|
void |
addTranslation(double[] v)
Add a translation operation to the matrix
|
void |
addTranslation(Vector v)
Add a translation operation to the matrix
|
double[] |
apply(double[] v)
Apply the transformation onto a vector
|
Vector |
apply(Vector v)
Apply the transformation onto a vector
|
double[] |
applyInverse(double[] v)
Apply the inverse transformation onto a vector
|
Vector |
applyInverse(Vector v)
Apply the inverse transformation onto a vector
|
double[] |
applyRelative(double[] v)
Apply the transformation onto a vector
|
Vector |
applyRelative(Vector v)
Apply the transformation onto a vector
|
double[] |
applyRelativeInverse(double[] v)
Apply the inverse transformation onto a vector
|
Vector |
applyRelativeInverse(Vector v)
Apply the inverse transformation onto a vector
|
AffineTransformation |
clone()
Return a clone of the affine transformation
|
int |
getDimensionality()
Query dimensionality of the transformation.
|
Matrix |
getInverse()
Get a copy of the inverse matrix
|
Matrix |
getTransformation()
Get a copy of the transformation matrix
|
double[] |
homogeneRelativeVector(double[] v)
Transform a relative vector into homogeneous coordinates.
|
Vector |
homogeneRelativeVector(Vector v)
Transform a relative vector into homogeneous coordinates.
|
double[] |
homogeneVector(double[] v)
Transform an absolute vector into homogeneous coordinates.
|
Vector |
homogeneVector(Vector v)
Transform an absolute vector into homogeneous coordinates.
|
static AffineTransformation |
reorderAxesTransformation(int dim,
int[] axes)
Generate a transformation that reorders axes in the given way.
|
double[] |
unhomogeneRelativeVector(double[] v)
Project an homogeneous vector back into the original space.
|
Vector |
unhomogeneRelativeVector(Vector v)
Project an homogeneous vector back into the original space.
|
double[] |
unhomogeneVector(double[] v)
Project an homogeneous vector back into the original space.
|
Vector |
unhomogeneVector(Vector v)
Project an homogeneous vector back into the original space.
|
private void |
updateInverse()
Compute the inverse transformation matrix
|
private int dim
private Matrix trans
private Matrix inv
public AffineTransformation(int dim)
dim
- dimensionalitypublic static AffineTransformation reorderAxesTransformation(int dim, int[] axes)
dim
- Dimensionality of vector space (resulting Matrix will be dim+1 x
dim+1)axes
- (Partial) list of axespublic AffineTransformation clone()
public int getDimensionality()
public void addTranslation(Vector v)
v
- translation vectorpublic void addTranslation(double[] v)
v
- translation vectorpublic void addMatrix(Matrix m)
m
- matrix (should be invertible)public void addRotation(int axis1, int axis2, double angle)
axis1
- first dimensionaxis2
- second dimensionangle
- rotation angle in radians.public void addAxisReflection(int axis)
axis
- Axis number to do the reflection at.public void addScaling(double scale)
scale
- Scaling factorpublic Matrix getTransformation()
public Matrix getInverse()
private void updateInverse()
public Vector homogeneVector(Vector v)
v
- initial vectorpublic double[] homogeneVector(double[] v)
v
- initial vectorpublic Vector homogeneRelativeVector(Vector v)
v
- initial vectorpublic double[] homogeneRelativeVector(double[] v)
v
- initial vectorpublic Vector unhomogeneVector(Vector v)
v
- Matrix of 1 x dim+1 containing the homogeneous vectorpublic double[] unhomogeneVector(double[] v)
v
- Matrix of 1 x dim+1 containing the homogeneous vectorpublic Vector unhomogeneRelativeVector(Vector v)
v
- Matrix of 1 x dim+1 containing the homogeneous vectorpublic double[] unhomogeneRelativeVector(double[] v)
v
- Matrix of 1 x dim+1 containing the homogeneous vectorpublic Vector apply(Vector v)
v
- vector of dimensionality dimpublic double[] apply(double[] v)
v
- vector of dimensionality dimpublic Vector applyInverse(Vector v)
v
- vector of dimensionality dimpublic double[] applyInverse(double[] v)
v
- vector of dimensionality dimpublic Vector applyRelative(Vector v)
v
- vector of dimensionality dimpublic double[] applyRelative(double[] v)
v
- vector of dimensionality dimpublic Vector applyRelativeInverse(Vector v)
v
- vector of dimensionality dimpublic double[] applyRelativeInverse(double[] v)
v
- vector of dimensionality dimCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.