game.geom
Class CAffineTransform

java.lang.Object
  extended by game.geom.CAffineTransform

public class CAffineTransform
extends java.lang.Object

Provides all affine transformations matrixes (zoom, rotation...).
Generated matrixes have their values in fixed point values.

Author:
seb
See Also:
CFixedPoint

Field Summary
private static int M
           
 int[][] m_fpMat
           
 
Constructor Summary
CAffineTransform()
           
 
Method Summary
static int[][] getID()
          Comodity function.
static int[][] getNullMatrix()
          Comodity function.
static int[][] getRotationMatrix(float alpha, float x, float y)
          Generates a rotation matrix.
static int[][] getZoomMatrix(float lambda, float x, float y)
          Generates a zoom matrix.
 int[] mul(int[] fpV)
          Transforms a vector
 void mul(int[][] fpMat)
          Multiplies the member matrix by another.
static int[] mul(int[][] A, int[] v)
           
static int[][] mul(int[][] A, int[][] B)
          Multiplies two matrixes.
 void rotate(float alpha, float x, float y)
          Generate a rotation matrix and multiplies the member matrix by it.
 void zoom(float lambda, float x, float y)
          Generate a zoom matrix and multiplies the member matrix by it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M

private static final int M
See Also:
Constant Field Values

m_fpMat

public int[][] m_fpMat
Constructor Detail

CAffineTransform

public CAffineTransform()
Method Detail

getID

public static final int[][] getID()
Comodity function.

Returns:
a new identity matrix (in fixed point values).

getNullMatrix

public static final int[][] getNullMatrix()
Comodity function.

Returns:
a new null matrix.

mul

public static final int[][] mul(int[][] A,
                                int[][] B)
Multiplies two matrixes.

Parameters:
A -
B -
Returns:
the result matrix.

mul

public static final int[] mul(int[][] A,
                              int[] v)

getRotationMatrix

public static final int[][] getRotationMatrix(float alpha,
                                              float x,
                                              float y)
Generates a rotation matrix.
Function params are of float type for ease of use, but all inner calculations are on ints for efficiency (fixed point arithmetics).

Parameters:
alpha - angle of the rotation
x - center of the rotation
y -
Returns:
the rotation matrix in fixed point values.
See Also:
CFixedPoint

getZoomMatrix

public static final int[][] getZoomMatrix(float lambda,
                                          float x,
                                          float y)
Generates a zoom matrix.
Function params are of float type for ease of use, but all inner calculations are on ints for efficiency (fixed point arithmetics).

Parameters:
lambda - the zooming factor
x - center of the zoom
y -
Returns:
the zoom matrix in fixed point values.
See Also:
CFixedPoint

mul

public final void mul(int[][] fpMat)
Multiplies the member matrix by another.

Parameters:
fpMat -

mul

public final int[] mul(int[] fpV)
Transforms a vector

Parameters:
fpV -
Returns:
the transformed vector

rotate

public final void rotate(float alpha,
                         float x,
                         float y)
Generate a rotation matrix and multiplies the member matrix by it.
Function params are of float type for ease of use, but all inner calculations are on ints for efficiency (fixed point arithmetics).

Parameters:
alpha -
x -
y -
See Also:
CFixedPoint

zoom

public final void zoom(float lambda,
                       float x,
                       float y)
Generate a zoom matrix and multiplies the member matrix by it.
Function params are of float type for ease of use, but all inner calculations are on ints for efficiency (fixed point arithmetics).

Parameters:
lambda -
x -
y -
See Also:
CFixedPoint