CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.geom3d
Interface Transform3DModel

All Known Implementing Classes:
DefaultTransform3DModel, RotatedTransform3DModel

public interface Transform3DModel

The Transform3DModel wraps a Transform3D object and makes it observable.

Version:
2.0 2007-11-15 Upgraded to Java 1.4.
1.0 2002-05-09 Created.
Author:
Werner Randelshofer

Method Summary
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a ChangeListener to the listener list.
 void concatenate(Transform3D t)
          Concatenates a transform Tx to this transform Cx.
 Transform3D getTransform()
          Returns the current state of the model.
 Transform3D getTransform(Transform3D t)
          Copies the current state of the model into the given Transform3D object and returns it.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes a ChangeListener from the listener list.
 void rotate(double rx, double ry, double rz)
          Concatenates this transform with a rotation transformation.
 void rotateX(double rx)
          Concatenates this transform with a rotation transformation.
 void rotateY(double ry)
          Concatenates this transform with a rotation transformation.
 void rotateZ(double rz)
          Concatenates this transform with a rotation transformation.
 void scale(double sx, double sy, double sz)
          Concatenates this transform with a scaling transformation.
 void setToIdentity()
          Resets this transform to the Identity transform.
 void setTransform(Transform3D Tx)
          Sets this transform to a copy of the transform in the specified Transform3D object.
 void translate(double tx, double ty, double tz)
          Concatenates this transform with a translation transformation.
 

Method Detail

setToIdentity

void setToIdentity()
Resets this transform to the Identity transform.


rotate

void rotate(double rx,
            double ry,
            double rz)
Concatenates this transform with a rotation transformation. This is equivalent to calling concatenate0(R), where R is an Transform3D represented by the following matrix:
    [ cos(rz)*cos(ry)     cos(rz)*sin(ry)*sin(rx)     cos(rz)*-sin(ry)*cos(rx)    0 ]
                            +sin(rz)*cos(rx)            +sin(rz)*-sin(ry)*cos(rx)

    [ -sin(rz)*cos(ry)    -sin(rz)*sin(ry)*sin(rx)    -sin(rz)*-sin(ry)*cos(rx)   0 ]
                            +cos(rz)*cos(rx)            +cos(rz)*sin(rx)

    [ sin(ry)             cos(ry)*-sin(rx)            cos(ry)*cos(rx)            0 ]

      [ 0                   0                           0                        1 ]
 
Positive values rotate counterclockwise.

Parameters:
rx - Rotation along the x axis in radians.
ry - Rotation along the y axis in radians.
rz - Rotation along the z axis in radians.

rotateX

void rotateX(double rx)
Concatenates this transform with a rotation transformation. This is equivalent to calling concatenate0(R), where R is an Transform3D represented by the following matrix:
    [ 1   0         0        0 ]
    [ 0   cos(rx)    sin(rx)   0 ]
    [ 0   -sin(rx)   cos(rx)   0 ]
      [ 0   0         0        1 ]
 
Positive values rotate counterclockwise.

Parameters:
rx - Rotation along the x axis in radians.

rotateY

void rotateY(double ry)
Concatenates this transform with a rotation transformation. This is equivalent to calling concatenate0(R), where R is an Transform3D represented by the following matrix:
    [ cos(ry)   0   -sin(ry)   0 ]
    [ 0        1   0         0 ]
    [ sin(ry)   0   cos(ry)    0 ]
      [ 0        0   0         1 ]
 
Positive values rotate counterclockwise.

Parameters:
ry - Rotation along the y axis in radians.

rotateZ

void rotateZ(double rz)
Concatenates this transform with a rotation transformation. This is equivalent to calling concatenate0(R), where R is an Transform3D represented by the following matrix:
    [ cos(rz)    sin(rz)   0   0 ]
    [ -sin(rz)   cos(rz)   0   0 ]
    [ 0         0        1   0 ]
      [ 0         0        0   1 ]
 
Positive values rotate counterclockwise.

Parameters:
rz - Rotation along the z axis in radians.

scale

void scale(double sx,
           double sy,
           double sz)
Concatenates this transform with a scaling transformation. This is equivalent to calling concatenate0(S), where S is an Transform3D represented by the following matrix:
    [   sx   0    0    0   ]
    [   0    sy   0    0   ]
    [   0    0    sz   0   ]
    [   0    0    0    1   ]
 


translate

void translate(double tx,
               double ty,
               double tz)
Concatenates this transform with a translation transformation. This is equivalent to calling concatenate0(T), where T is an Transform3D represented by the following matrix:
    [   1    0    0    tx  ]
    [   0    1    0    ty  ]
    [   0    0    1    tz  ]
    [   0    0    0    1   ]
 


concatenate

void concatenate(Transform3D t)
Concatenates a transform Tx to this transform Cx. Cx is updated to perform the combined transformation. Transforming a point p by the updated transform Cx' is equivalent to first transforming p by Tx and then transforming the result by the original transform Cx. In other words, Cx'(p) = Cx(Tx(p)). In matrix notation, if this transform Cx is represented by the matrix [this] and Tx is represented by the matrix [Tx], then this method does the following:
    [this] = [this] x [Tx]
 

Parameters:
t - The transform object to be concatenated with this transform object.

getTransform

Transform3D getTransform()
Returns the current state of the model.


getTransform

Transform3D getTransform(Transform3D t)
Copies the current state of the model into the given Transform3D object and returns it.


setTransform

void setTransform(Transform3D Tx)
Sets this transform to a copy of the transform in the specified Transform3D object.

Parameters:
Tx - the Transform3D object from which to copy the transform

addChangeListener

void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to the listener list.


removeChangeListener

void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener from the listener list.


(c) Werner Randelshofer.
All rights reserved.