MathWorx

Class AffineTransform

Object
   |
   +--AffineTransform

class AffineTransform


This is a class that specifies special matrices that are affine transformations of homogeneous coordinates and allows them to be applied to point2D and point3D objectss. This class is primarily used internally by the point2D and point3D classes, but can also be called as such, for example:
var T = new AffineTransform(3).rotationX(Math.PI);
var p3D = T.applyTo(new point3D(1,1,1));
The transformation methods return the current AffineTransform object, allowing compound transformation. Compound transformations are handled in reverse order. For example:
var T = new AffineTransform(3).rotationX(Math.PI).translate3D(1,1,1);
var p3D = T.applyTo(new point3D(1,1,1));

represents the following operation:
p3D = (translate3D(1,1,1) x rotationX(Math.PI)) x (1,1,1,1);
p3D =
([1 0 0 1] [1 0 0 0] ) [1]
([0 1 0 1] [0 -1 0 0]) [1]
([0 0 1 1] [0 0 -1 0]) [1]
([0 0 0 1] [0 0 0 1] ) [1]
(NOTE: [1 1 1 1] is the column matrix representation of the new point3D(1,1,1) object)

Note that the transformation methods update the current AffineTransform object (allowing compound transformations) while the invert() method creates a new AffineTransform object with the opposite transformation as its matrix.
Defined in AffineTransform.js

Requires:


Field Summary
 Integer dim
          The dimension of the transformation (1 less than dimension of matrix).
 Matrix matrix
          The transformation matrix that will be created when specific methods are called.
 
Constructor Summary
AffineTransform(<Integer> dim)
            Construct a new AffineTransform object, which contains a dimension, a transformation matrix (set by instance methods), and the applyTo method.
 
Method Summary
 Object applyTo(point)
           Applies the transformation to a point2D or point3D object.
 AffineTransform invert()
           Inverts an Affine Transformation.
 Boolean invertible()
           Tests to see if an Affine Transformation is invertible.
 AffineTransform rotate2D(<Number> theta)
           Rotates a point (x,y,1) about the angle theta in the xy-plane.
 AffineTransform rotation(<Number> theta, <Object> axis)
           Creates a rotation matrix about an arbitrary axis.
 AffineTransform rotationX(<Number> phi)
           Rotates a point (x,y,z,1) through an angle phi about the x-axis.
 AffineTransform rotationY(theta)
           Rotates a point (x,y,z,1) through an angle theta about the y-axis.
 AffineTransform rotationZ(psi)
           Rotates a point (x,y,z,1) through an angle psi about the z-axis.
 String toString()
           Returns a string representation of the Affine Transformation matrix.
 AffineTransform translate2D(<Number> tx, <Number> ty)
           Creates a 2D translation matrix (3x3).
 AffineTransform translate3D(<Number> tx, <Number> ty, <Number> tz)
           Creates a 3D translation matrix (4x4).

Field Detail

dim

Integer dim

matrix

Matrix matrix

Constructor Detail

AffineTransform

AffineTransform(<Integer> dim)

Method Detail

applyTo

Object applyTo(point)

invert

AffineTransform invert()

invertible

Boolean invertible()

rotate2D

AffineTransform rotate2D(<Number> theta)

rotation

AffineTransform rotation(<Number> theta, <Object> axis)

rotationX

AffineTransform rotationX(<Number> phi)

rotationY

AffineTransform rotationY(theta)

rotationZ

AffineTransform rotationZ(psi)

toString

String toString()

translate2D

AffineTransform translate2D(<Number> tx, <Number> ty)

translate3D

AffineTransform translate3D(<Number> tx, <Number> ty, <Number> tz)

MathWorx

Documentation generated by JSDoc on Tue Aug 5 10:22:22 2008