|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.math.Transform2D
public final class Transform2D
Represents a 2D transformation in such a way as to accelerate operations such as composition and inversion by keeping track of the nature of the transform.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
com.threerings.io.Streamable.Closure |
| Field Summary | |
|---|---|
static int |
AFFINE
An affine transformation represented by the upper two rows of a 3x3 matrix. |
static int |
GENERAL
A general transformation represented by a 3x3 matrix. |
static int |
IDENTITY
An identity transformation. |
static int |
RIGID
A rigid transformation represented by a translation vector and a rotation value. |
static int |
UNIFORM
A transformation represented by translation, rotation, and a uniform scale value. |
| Constructor Summary | |
|---|---|
Transform2D()
Creates an identity transformation. |
|
Transform2D(int type)
Creates an identity transformation of the specified type. |
|
Transform2D(Matrix3f matrix)
Creates a transformation from the values in the supplied matrix. |
|
Transform2D(Matrix3f matrix,
boolean affine)
Creates a transformation from the values in the supplied matrix. |
|
Transform2D(Transform2D transform)
Copy constructor. |
|
Transform2D(Transform3D transform)
Creates a flattened version of the supplied transform. |
|
Transform2D(Vector2f translation,
float rotation)
Creates a transformation from the values in the supplied objects. |
|
Transform2D(Vector2f translation,
float rotation,
float scale)
Creates a transformation from the values in the supplied objects. |
|
Transform2D(Vector2f translation,
float rotation,
Vector2f scale)
Creates a transformation from the values in the supplied objects. |
|
| Method Summary | |
|---|---|
float |
approximateUniformScale()
Extracts an approximation of the uniform scale from this transform. |
Transform2D |
compose(Transform2D other)
Composes this transform with another. |
Transform2D |
compose(Transform2D other,
Transform2D result)
Composes this transform with another, storing the result in the object provided. |
Transform2D |
composeLocal(Transform2D other)
Composes this transform in-place with another. |
boolean |
equals(Object other)
|
float |
extractRotation()
Extracts the rotation component of the transform. |
Vector2f |
extractTranslation()
Extracts the translation component of the transform. |
Vector2f |
extractTranslation(Vector2f result)
Extracts the translation component of the transform and places it in the provided result vector. |
Matrix3f |
getMatrix()
Returns a reference to the transformation matrix, which is only definitive when the type is AFFINE or GENERAL. |
float |
getRotation()
Returns the rotation value, which is only definitive when the type is RIGID or
UNIFORM. |
float |
getScale()
Returns the uniform scale, which is only definitive when the type is UNIFORM. |
Vector2f |
getTranslation()
Returns a reference to the translation vector, which is only definitive when the type is RIGID or UNIFORM. |
int |
getType()
Returns the type of this transformation. |
int |
hashCode()
|
Transform2D |
invert()
Inverts this transform. |
Transform2D |
invert(Transform2D result)
Inverts this transform, storing the result in the provided object. |
Transform2D |
invertLocal()
Inverts this transform in-place. |
Transform2D |
lerp(Transform2D other,
float t)
Linearly interpolates between this and the specified other transform. |
Transform2D |
lerp(Transform2D other,
float t,
Transform2D result)
Linearly interpolates between this and the specified other transform, placing the result in the transform provided. |
Transform2D |
lerpLocal(Transform2D other,
float t)
Linearly interpolates between this and the specified other transform, placing the result in this transform. |
Transform2D |
promote(int type)
Promotes this transform to the specified type, which must be greater than or equal to its current type. |
void |
readFields(Importer in)
Custom field read method. |
Transform2D |
set(Matrix3f matrix)
Sets the transform using the supplied matrix. |
Transform2D |
set(Matrix3f matrix,
boolean affine)
Sets the transform using the supplied matrix. |
Transform2D |
set(Transform2D transform)
Copies the values contained in another transform. |
Transform2D |
set(Transform3D transform)
Sets the transform to a flattened version of a 3D transform. |
Transform2D |
set(Vector2f translation,
float rotation)
Sets the transform using the supplied values. |
Transform2D |
set(Vector2f translation,
float rotation,
float scale)
Sets the transform using the supplied values. |
Transform2D |
set(Vector2f translation,
float rotation,
Vector2f scale)
Sets the transform using the supplied values. |
float |
setRotation(float rotation)
Sets the rotation. |
float |
setScale(float scale)
Sets the uniform scale. |
Transform2D |
setToIdentity()
Sets the transform to the identity transform. |
void |
setType(int type)
Sets the type of the transformation. |
String |
toString()
|
Vector2f |
transformPoint(Vector2f pt)
Transforms a point by this transform. |
Vector2f |
transformPoint(Vector2f pt,
Vector2f result)
Transforms a point by this transform and places the result in the object provided. |
Vector2f |
transformPointLocal(Vector2f pt)
Transforms a point in-place by this transform. |
Vector2f |
transformVector(Vector2f vec)
Transforms a vector by this transform. |
Vector2f |
transformVector(Vector2f vec,
Vector2f result)
Transforms a vector by this transform and places the result in the object provided. |
Vector2f |
transformVectorLocal(Vector2f vec)
Transforms a vector in-place by this transform. |
Transform2D |
update(int utype)
Updates the transform fields corresponding to the specified type. |
void |
writeFields(Exporter out)
Custom field write method. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int IDENTITY
public static final int RIGID
public static final int UNIFORM
public static final int AFFINE
public static final int GENERAL
| Constructor Detail |
|---|
public Transform2D()
public Transform2D(int type)
public Transform2D(Vector2f translation,
float rotation)
public Transform2D(Vector2f translation,
float rotation,
float scale)
public Transform2D(Vector2f translation,
float rotation,
Vector2f scale)
public Transform2D(Matrix3f matrix)
public Transform2D(Matrix3f matrix,
boolean affine)
affine - whether or not the provided matrix is known to be affine.public Transform2D(Transform3D transform)
public Transform2D(Transform2D transform)
| Method Detail |
|---|
public int getType()
public void setType(int type)
null.
To promote to a more general transform type, see promote(int).
public Vector2f getTranslation()
RIGID or UNIFORM.
public float getRotation()
RIGID or
UNIFORM.
public float setRotation(float rotation)
public float getScale()
UNIFORM.
public float setScale(float scale)
public Matrix3f getMatrix()
AFFINE or GENERAL.
public Transform2D invertLocal()
public Transform2D invert()
public Transform2D invert(Transform2D result)
public Transform2D composeLocal(Transform2D other)
public Transform2D compose(Transform2D other)
public Transform2D compose(Transform2D other,
Transform2D result)
public Transform2D lerpLocal(Transform2D other,
float t)
public Transform2D lerp(Transform2D other,
float t)
public Transform2D lerp(Transform2D other,
float t,
Transform2D result)
public Transform2D set(Transform2D transform)
public Transform2D set(Transform3D transform)
public Transform2D setToIdentity()
public Transform2D set(Vector2f translation,
float rotation)
public Transform2D set(Vector2f translation,
float rotation,
float scale)
public Transform2D set(Vector2f translation,
float rotation,
Vector2f scale)
public Transform2D set(Matrix3f matrix)
public Transform2D set(Matrix3f matrix,
boolean affine)
affine - whether or not the provided matrix is affine.
public Transform2D promote(int type)
public Transform2D update(int utype)
IDENTITY and type is RIGID, then the translation
and rotation fields are set to zero.
utype - the desired type, which must be greater than or equal to the type of this
transform.
public Vector2f transformPointLocal(Vector2f pt)
public Vector2f transformPoint(Vector2f pt)
public Vector2f transformPoint(Vector2f pt,
Vector2f result)
public Vector2f transformVectorLocal(Vector2f vec)
public Vector2f transformVector(Vector2f vec)
public Vector2f transformVector(Vector2f vec,
Vector2f result)
public Vector2f extractTranslation()
public Vector2f extractTranslation(Vector2f result)
public float extractRotation()
public float approximateUniformScale()
public void writeFields(Exporter out)
throws IOException
IOException
public void readFields(Importer in)
throws IOException
IOExceptionpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||