com.planeth.common.math
Class Transform

java.lang.Object
  extended bycom.planeth.common.math.Transform

public class Transform
extends java.lang.Object

2D Transformation Wrapper Module

Author:
Andreas Grässer, gal@planet-h.com.
created May 15, 2005
See Also:
Matrix, Vector2D

Field Summary
static int X_AXIS
           
static int Y_AXIS
           
 
Constructor Summary
Transform()
           
 
Method Summary
 void addFlip(Vector2D flipCenter, boolean xAxis, boolean yAxis)
          Adds flipping to the Transform stack
 void addMovement(Vector2D movementVector)
          Adds movement to the Transform stack
 void addRotation(Vector2D rotationCenter, double theta)
          Adds rotation to the Transform stack
 void addScale(double scaleFactor)
          Adds scaling to the Transform stack
 void flipX(double flipAxisX, Vector2D[] vertexes)
          Executes a simple X-flip on the passed vertexes
 void flipXY(Vector2D flipCenter, Vector2D[] vertexes)
          Executes a simple X- and Y-flip on the passed vertexes
 void flipY(double flipAxisY, Vector2D[] vertexes)
          Executes a simple Y-flip on the passed vertexes
 void move(Vector2D movementVector, Vector2D vector)
          Executes a simple rotation on the passed Vector
 void move(Vector2D movementVector, Vector2D[] vertexes)
          Executes a simple movememt on the passed vertexes
 void rotate(Vector2D rotationCenter, double theta, Vector2D vector)
          Executes a simple rotation on the passed Vector
 void rotate(Vector2D rotationCenter, double theta, Vector2D[] vertexes)
          Executes a simple rotation on the passed vertexes
 void scale(double scaleFactor, Vector2D[] vertexes)
          Executes a simple scaling on the passed vertexes
 void transform(Vector2D vector)
          Executes the transformation on the passed Vector and resets the Transform Object.
 void transform(Vector2D[] vertexes)
          Executes the transformation on the passed vertexes and resets the Transform Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_AXIS

public static final int X_AXIS
See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
See Also:
Constant Field Values
Constructor Detail

Transform

public Transform()
Method Detail

addMovement

public void addMovement(Vector2D movementVector)
Adds movement to the Transform stack

Parameters:
movementVector -

addRotation

public void addRotation(Vector2D rotationCenter,
                        double theta)
Adds rotation to the Transform stack

Parameters:
rotationCenter -
theta -

addScale

public void addScale(double scaleFactor)
Adds scaling to the Transform stack

Parameters:
scaleFactor -

addFlip

public void addFlip(Vector2D flipCenter,
                    boolean xAxis,
                    boolean yAxis)
Adds flipping to the Transform stack

Parameters:
flipCenter -
xAxis -
yAxis -

transform

public void transform(Vector2D vector)
Executes the transformation on the passed Vector and resets the Transform Object.

Parameters:
vector - Vector to transform

transform

public void transform(Vector2D[] vertexes)
Executes the transformation on the passed vertexes and resets the Transform Object.

Parameters:
vertexes - Vertexes to transform

rotate

public void rotate(Vector2D rotationCenter,
                   double theta,
                   Vector2D[] vertexes)
Executes a simple rotation on the passed vertexes

Parameters:
rotationCenter -
theta - angle in radians
vertexes - vertexes to rotate

rotate

public void rotate(Vector2D rotationCenter,
                   double theta,
                   Vector2D vector)
Executes a simple rotation on the passed Vector

Parameters:
rotationCenter -
theta - angle in radians
vector - Vector to rotate

move

public void move(Vector2D movementVector,
                 Vector2D[] vertexes)
Executes a simple movememt on the passed vertexes

Parameters:
movementVector - Bewegung, die ausgeführt werden soll
vertexes - vertexes to move

move

public void move(Vector2D movementVector,
                 Vector2D vector)
Executes a simple rotation on the passed Vector

Parameters:
movementVector - movement
vector - Vector to move

scale

public void scale(double scaleFactor,
                  Vector2D[] vertexes)
Executes a simple scaling on the passed vertexes

Parameters:
scaleFactor -
vertexes - vertexes to scale

flipX

public void flipX(double flipAxisX,
                  Vector2D[] vertexes)
Executes a simple X-flip on the passed vertexes

Parameters:
flipAxisX - X-axis for flip
vertexes - vertexes to flip

flipY

public void flipY(double flipAxisY,
                  Vector2D[] vertexes)
Executes a simple Y-flip on the passed vertexes

Parameters:
flipAxisY - Y-axis for flip
vertexes - vertexes to flip

flipXY

public void flipXY(Vector2D flipCenter,
                   Vector2D[] vertexes)
Executes a simple X- and Y-flip on the passed vertexes

Parameters:
flipCenter - center for flip
vertexes - vertexes to flip