|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.math.linearalgebra.AffineTransformation
public class AffineTransformation
Affine transformations implemented using homogeneous coordinates. The use of homogeneous coordinates allows the combination of multiple affine transformations (rotations, translations, scaling) into a single matrix operation (of dimensionality dim+1), and also the construction of an inverse transformation.
Field Summary | |
---|---|
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 Summary | |
---|---|
AffineTransformation(int dim)
Constructor for an identity transformation. |
|
AffineTransformation(int dim,
Matrix trans,
Matrix inv)
Trivial constructor with all fields, mostly for cloning |
Method Summary | |
---|---|
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(Vector v)
Add a translation operation to the matrix |
Vector |
apply(Vector v)
Apply the transformation onto a vector |
Vector |
applyInverse(Vector v)
Apply the inverse transformation onto a vector |
Vector |
applyRelative(Vector v)
Apply the 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 |
Vector |
homogeneRelativeVector(Vector v)
Transform a relative 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. |
Vector |
unhomogeneRelativeVector(Vector 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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int dim
private Matrix trans
private Matrix inv
Constructor Detail |
---|
public AffineTransformation(int dim)
dim
- dimensionalitypublic AffineTransformation(int dim, Matrix trans, Matrix inv)
dim
- dimensionalitytrans
- transformation matrixinv
- inverse matrixMethod Detail |
---|
public 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 axes
public AffineTransformation clone()
clone
in class Object
public int getDimensionality()
public void addTranslation(Vector 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 vector
public Vector homogeneRelativeVector(Vector v)
v
- initial vector
public Vector unhomogeneVector(Vector v)
v
- Matrix of 1 x dim+1 containing the homogeneous vector
public Vector unhomogeneRelativeVector(Vector v)
v
- Matrix of 1 x dim+1 containing the homogeneous vector
public Vector apply(Vector v)
v
- vector of dimensionality dim
public Vector applyInverse(Vector v)
v
- vector of dimensionality dim
public Vector applyRelative(Vector v)
v
- vector of dimensionality dim
public Vector applyRelativeInverse(Vector v)
v
- vector of dimensionality dim
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |