Class pmr.euclid.Transform2
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.Transform2
java.lang.Object
|
+----pmr.euclid.Status
|
+----pmr.euclid.RealMatrix
|
+----pmr.euclid.RealSquareMatrix
|
+----pmr.euclid.Transform2
- public class Transform2
- extends RealSquareMatrix
Transform2 - 2-D transformation matrix class
Transform2 represents a transformation matrix for 2-D objects.
Its actual form may be implementation-dependent, but we have started
with 3x3 matrices. The following transformations will be supported
as the class is developed:
TRFORM2_NULL no transformation allowed
ROT_ORIG rotation about the origin
ROT_TRANS rotation and translation
ROT_TRANS_SCALE rotation, translation and single scale factor
ROT_TRANS_AXIAL_SCALE rotation, translation + 3 axial scale factors
ROT_TRANS_SCALE_PERSP rotation, translation, scale, perspective
TRFORM3_ANY any matrix at all - user beware!
The basic stuff is all there - the user will do best to look at
examples.
NOTE; this has been hacked in a hurry from Transform3. Many of the internal
routines are grossly overcomplicated. I'll clean it up some time.
- Author:
- (C) P. Murray-Rust, 1996
-
ROT_ORIG
-
-
ROT_TRANS
-
-
ROT_TRANS_AXIAL_SCALE
-
-
ROT_TRANS_SCALE
-
-
ROT_TRANS_SCALE_PERSP
-
-
TRFORM3_ANY
-
-
TRFORM3_NULL
-
-
Transform2()
- default is a unit matrix
-
Transform2(Angle)
- rotation about z- axis
-
Transform2(double[])
- Formed by feeding in an existing array to a cols*cols matrix.
-
Transform2(int)
- This gives a default unit matrix of type t (default ROT_ORIG).
-
Transform2(Real2, Real2)
- from 2 vector components - NOT checked for validity
-
Transform2(RealSquareMatrix)
- from a 2x2 or 3x3 matrix
-
Transform2(RealSquareMatrix, Vector2)
- from a 2x2 rotation matrix and a translation vector
-
Transform2(Transform2)
- copy constructors - assumed to be an OK matrix
-
Transform2(Transform2, Real2)
- from rotation about a point, given a matrix
NOT CHECKED
-
Transform2(Vector2)
- identity matrix with translation component
-
Transform2(Vector2, Vector2)
- rotation of one vector onto another
-
checkMatrix()
- get new matrix type
-
clone(Transform2)
- clone
-
concatenate(Transform2)
- concatenate
-
equals(Transform2)
-
-
flipAboutVector(Real2)
- get Transformation to mirror ('flip') across an axis
NOT YET CHECKED
-
getAngleOfRotation()
- interpret current matrix as rotation about axis
NOT YET CHECKED; only worsk for orthornormal matrices
-
getCentreOfRotation()
- get centre of rotation
-
getRotationMatrix()
- get Unitary matrix (i.e.
-
getTransformationType()
- get transformation type
-
getTranslation()
- get translation component only
-
main(String[])
- tests Transform2 routines
-
setTransformationType(int)
- set transformation type
-
toString()
- output matrix - very crude...
TRFORM3_NULL
public final static int TRFORM3_NULL
ROT_ORIG
public final static int ROT_ORIG
ROT_TRANS
public final static int ROT_TRANS
ROT_TRANS_SCALE
public final static int ROT_TRANS_SCALE
ROT_TRANS_AXIAL_SCALE
public final static int ROT_TRANS_AXIAL_SCALE
ROT_TRANS_SCALE_PERSP
public final static int ROT_TRANS_SCALE_PERSP
TRFORM3_ANY
public final static int TRFORM3_ANY
Transform2
public Transform2()
- default is a unit matrix
Transform2
public Transform2(int t)
- This gives a default unit matrix of type t (default ROT_ORIG).
Transform2
public Transform2(Vector2 v)
- identity matrix with translation component
Transform2
public Transform2(Angle zrot)
- rotation about z- axis
Transform2
public Transform2(Transform2 t,
Real2 p)
- from rotation about a point, given a matrix
NOT CHECKED
Transform2
public Transform2(Vector2 v1,
Vector2 v2) throws ZeroLengthVectorException
- rotation of one vector onto another
- Throws: ZeroLengthVectorException
- v1 or v2 is zero length
Transform2
public Transform2(Real2 v1,
Real2 v2)
- from 2 vector components - NOT checked for validity
Transform2
public Transform2(double array[]) throws InvalidArgumentException
- Formed by feeding in an existing array to a cols*cols matrix.
array is or type m00, m01, m02, m10 ...
- Throws: InvalidArgumentException
- array must have 9 elements
Transform2
public Transform2(Transform2 m)
- copy constructors - assumed to be an OK matrix
Transform2
public Transform2(RealSquareMatrix m) throws UnequalLengthArraysException
- from a 2x2 or 3x3 matrix
- Throws: UnequalLengthArraysException
- m must be 2*2 or 3*3
Transform2
public Transform2(RealSquareMatrix m,
Vector2 v) throws UnequalLengthArraysException
- from a 2x2 rotation matrix and a translation vector
- Throws: UnequalLengthArraysException
- m must be 2*2
clone
public Transform2 clone(Transform2 m)
- clone
equals
public boolean equals(Transform2 m)
concatenate
public Transform2 concatenate(Transform2 m2)
- concatenate
setTransformationType
public int setTransformationType(int option)
- set transformation type
getTransformationType
public int getTransformationType()
- get transformation type
checkMatrix
public int checkMatrix()
- get new matrix type
getAngleOfRotation
public Angle getAngleOfRotation()
- interpret current matrix as rotation about axis
NOT YET CHECKED; only worsk for orthornormal matrices
flipAboutVector
public static Transform2 flipAboutVector(Real2 r) throws ZeroLengthVectorException
- get Transformation to mirror ('flip') across an axis
NOT YET CHECKED
- Throws: ZeroLengthVectorException
- r is zero length
getTranslation
public Real2 getTranslation()
- get translation component only
getCentreOfRotation
public Point3 getCentreOfRotation() throws UnimplementedException
- get centre of rotation
- Throws: UnimplementedException
- NOT YET WORKING
getRotationMatrix
public RealSquareMatrix getRotationMatrix()
- get Unitary matrix (i.e. eliminate scales and translation)
toString
public String toString()
- output matrix - very crude...
- Overrides:
- toString in class RealMatrix
main
public static void main(String args[])
- tests Transform2 routines
All Packages Class Hierarchy This Package Previous Next Index