jumbo.euclid
Class Transform2

java.lang.Object
  |
  +--jumbo.euclid.Status
        |
        +--jumbo.euclid.RealMatrix
              |
              +--jumbo.euclid.RealSquareMatrix
                    |
                    +--jumbo.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.


Field Summary
static int ROT_ORIG
           
static int ROT_TRANS
           
static int ROT_TRANS_AXIAL_SCALE
           
static int ROT_TRANS_SCALE
           
static int ROT_TRANS_SCALE_PERSP
           
static int TRFORM3_ANY
           
static int TRFORM3_NULL
           
 
Fields inherited from class jumbo.euclid.RealMatrix
cols, flmat, rows
 
Constructor Summary
Transform2()
          default is a unit matrix
Transform2(Angle zrot)
          rotation about z- axis
Transform2(double[] array)
          Formed by feeding in an existing array to a cols*cols matrix.
Transform2(int t)
          This gives a default unit matrix of type t (default ROT_ORIG).
Transform2(Real2 v1, Real2 v2)
          from 2 vector components - NOT checked for validity
Transform2(RealSquareMatrix m)
          from a 2x2 or 3x3 matrix
Transform2(RealSquareMatrix m, Vector2 v)
          from a 2x2 rotation matrix and a translation vector
Transform2(Transform2 m)
          copy constructors - assumed to be an OK matrix
Transform2(Transform2 t, Real2 p)
          from rotation about a point, given a matrix NOT CHECKED
Transform2(Vector2 v)
          identity matrix with translation component
Transform2(Vector2 v1, Vector2 v2)
          rotation of one vector onto another
 
Method Summary
 int checkMatrix()
          get new matrix type
 Transform2 clone(Transform2 m)
          clone
 Transform2 concatenate(Transform2 m2)
          concatenate
 boolean equals(Transform2 m)
           
static Transform2 flipAboutVector(Real2 r)
          get Transformation to mirror ('flip') across an axis NOT YET CHECKED
 Angle getAngleOfRotation()
          interpret current matrix as rotation about axis NOT YET CHECKED; only worsk for orthornormal matrices
 Point3 getCentreOfRotation()
          get centre of rotation
 RealSquareMatrix getRotationMatrix()
          get Unitary matrix (i.e.
 int getTransformationType()
          get transformation type
 Real2 getTranslation()
          get translation component only
static void main(java.lang.String[] args)
          tests Transform2 routines
 int setTransformationType(int option)
          set transformation type
 java.lang.String toString()
          output matrix - very crude...
 
Methods inherited from class jumbo.euclid.RealSquareMatrix
copyLowerToUpper, copyUpperToLower, determinant, diagonal, diagonaliseAndReturnRank, equals, getInverse, isImproperRotation, isLowerTriangular, isOrthogonal, isOrthonormal, isSymmetric, isUnit, isUnitary, isUpperTriangular, lowerTriangle, multiply, orthogonalise, orthonormalise, outerProduct, plus, shallowCopy, subtract, trace, transpose
 
Methods inherited from class jumbo.euclid.RealMatrix
appendColumnData, appendColumnData, appendRowData, appendRowData, clearMatrix, clone, columnwiseDivide, deleteColumn, deleteColumns, deleteRow, deleteRows, elementAt, elementAt, elementsInRange, equals, euclideanColumnLength, euclideanColumnLengths, euclideanRowLength, euclideanRowLengths, extractColumnData, extractRowData, extractSubMatrixData, getCols, getMatrix, getMatrixAsArray, getRows, getTranspose, indexOfLargestElement, indexOfLargestElementInColumn, indexOfLargestElementInRow, indexOfSmallestElement, indexOfSmallestElementInColumn, indexOfSmallestElementInRow, insertColumnData, insertColumnData, insertColumns, insertRowData, insertRowData, insertRows, isSquare, largestElement, largestElementInColumn, largestElementInRow, multiply, multiply, multiplyBy, negative, normaliseByColumns, normaliseByRows, plus, reorderColumnsBy, reorderRowsBy, replaceColumnData, replaceColumnData, replaceColumnData, replaceRowData, replaceRowData, replaceRowData, replaceSubMatrixData, setAllElements, setElementAt, shallowCopy, smallestElement, smallestElementInColumn, smallestElementInRow, subtract
 
Methods inherited from class jumbo.euclid.Status
NYI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRFORM3_NULL

public static final int TRFORM3_NULL

ROT_ORIG

public static final int ROT_ORIG

ROT_TRANS

public static final int ROT_TRANS

ROT_TRANS_SCALE

public static final int ROT_TRANS_SCALE

ROT_TRANS_AXIAL_SCALE

public static final int ROT_TRANS_AXIAL_SCALE

ROT_TRANS_SCALE_PERSP

public static final int ROT_TRANS_SCALE_PERSP

TRFORM3_ANY

public static final int TRFORM3_ANY
Constructor Detail

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 ZeroVectorException
rotation of one vector onto another
Throws:
ZeroVectorException - 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 BadArgumentException
Formed by feeding in an existing array to a cols*cols matrix. array is or type m00, m01, m02, m10 ...
Throws:
BadArgumentException - array must have 9 elements

Transform2

public Transform2(Transform2 m)
copy constructors - assumed to be an OK matrix

Transform2

public Transform2(RealSquareMatrix m)
           throws UnequalArraysException
from a 2x2 or 3x3 matrix
Throws:
UnequalArraysException - m must be 2*2 or 3*3

Transform2

public Transform2(RealSquareMatrix m,
                  Vector2 v)
           throws UnequalArraysException
from a 2x2 rotation matrix and a translation vector
Throws:
UnequalArraysException - m must be 2*2
Method Detail

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 ZeroVectorException
get Transformation to mirror ('flip') across an axis NOT YET CHECKED
Throws:
ZeroVectorException - 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 java.lang.String toString()
Description copied from class: RealMatrix
output matrix - very crude...
Overrides:
toString in class RealMatrix

main

public static void main(java.lang.String[] args)
tests Transform2 routines