|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object smithers.java3d.Transformation
public class Transformation
Represents a transformation between two real vector spaces. For example, from 3-dimensional space to 2-dimensional space. This class is general enough to include all affine linear transformations, as well as perspective transformations.
Constructor Summary | |
---|---|
Transformation(int n,
int m)
Constructs a new matrix representing an identity/projection/inclusion. |
Method Summary | |
---|---|
float[] |
apply(float[] vector)
Apply this transformation to a vector. |
float[][] |
apply(float[][] vector,
float[][] result)
Apply this transformation to an array of vectors. |
static Transformation |
composition(Transformation mat1,
Transformation mat2)
Computes the transformation obtained by performing the transformation mat1 after the transformation mat2 . |
float |
getFactor(float[] vector)
|
float[][] |
invert(float[] vector)
|
static Transformation |
perspective(int m)
Creates a perspective transformation. |
void |
postCompose(Transformation other)
Appends the given operation onto this one. |
void |
preCompose(Transformation other)
Prepends the given operation onto this one. |
static Transformation |
rotation(int n,
int axis1,
int axis2,
float theta)
Creates a rotation transformation. |
static Transformation |
rotation2D(float theta)
|
static Transformation |
rotation3DFromIntrinsicXYZ(float theta1,
float theta2,
float theta3)
|
static Transformation |
rotation3DFromIntrinsicZXZ(float theta1,
float theta2,
float theta3)
|
static Transformation |
scale(int n,
float scale)
|
static Transformation |
translation(float... vector)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Transformation(int n, int m)
n==m
this is an identity transformation, if n<m
this
is a projection onto the first n
coordinates and if n>m
then this is an inclusion of the subspace specified by the first m
coordinates.
n
- the dimension of the space to map tom
- the dimension of the space to map fromMethod Detail |
---|
public static Transformation perspective(int m)
m
dimensions down to m-1
. The transformation is to
project onto the first m-1
coordinates and then divide by the
final coordinate.
m
- the dimension to map from
public static Transformation translation(float... vector)
public static Transformation scale(int n, float scale)
public static Transformation rotation(int n, int axis1, int axis2, float theta)
n
-dimensional space which rotates the axis indexed
by axis1
towards the axis indexed by axis2
by an angle
of theta
radians.
n
- the number of dimensionsaxis1
- the axis to rotate fromaxis2
- the axis to rotate towardstheta
- the angle to rotate by
public static Transformation rotation2D(float theta)
public static Transformation rotation3DFromIntrinsicZXZ(float theta1, float theta2, float theta3)
public static Transformation rotation3DFromIntrinsicXYZ(float theta1, float theta2, float theta3)
public static Transformation composition(Transformation mat1, Transformation mat2)
mat1
after the transformation mat2
. This is in keeping
with the order in the mathematical meaning of the composition mat1
ˆ mat2
. mat1
must map from the same number of
dimensiona that mat2
maps to.
mat1
- the operation to apply secondmat2
- the operation to apply first
public void preCompose(Transformation other)
other
- the transformation to be prependedpublic void postCompose(Transformation other)
other
- the transformation to be appendedpublic float getFactor(float[] vector)
public float[] apply(float[] vector)
vector
- the vector to transform
public float[][] apply(float[][] vector, float[][] result)
vector
must be the same as the dimension this transformation maps from.
If result
is not null
, the result vectors will be stored
in it. In this case it must have the same length as vector
, and
each element must have the length of the dimension that this
transformation maps to.
vector
- the vectors to transformresult
- if not null
, the result will be stored here
public float[][] invert(float[] vector)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |