Emini Physics Engine 1.3.5a API Documentation

at.emini.physics2D.util
Class FXMatrix

java.lang.Object
  extended by at.emini.physics2D.util.FXMatrix

public class FXMatrix
extends java.lang.Object

The FXMatrix class represents a 2x2 matrix.
The matrix uses Fixpoint arithmetic. In order to optimize rotation matrices, which are its main use, the values are shifted by FXUtil.DECIMAL + FXUtil.ADD_MATRIX_DECIMAL.

Author:
Alexander Adensamer
See Also:
FXUtil

Field Summary
 float mCol1xFX
          a11 (MatFX)
 float mCol1yFX
          a12 (MatFX)
 float mCol2xFX
          a21 (MatFX)
 float mCol2yFX
          a22 (MatFX)
 
Constructor Summary
FXMatrix()
          Empty constructor.
FXMatrix(FXMatrix other)
          Copy constructor.
FXMatrix(int precision)
           
 
Method Summary
 void assign(FXMatrix other)
           
static FXMatrix createRotationMatrix(float rotation2FX)
          Creates a 2D rotation matrix.
 void invert()
          Inverts the matrix.
 FXVector mult(float xFX, float yFX)
          Multiplies the matrix with vector given as two coordinates (FX).
 void mult(float xFX, float yFX, FXVector target)
          Multiplies the matrix with vector given as two coordinates (FX).
 FXVector mult(FXVector vector)
          Multiplies the matrix with vector.
 void mult(FXVector vector, FXVector target)
          Multiplies the matrix with a vector (without object creation).
 float normMatFX()
          Calculates the 1 norm.
 void setRotationMatrix(float rotation2FX)
          Sets the matrix to a rotation matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCol1xFX

public float mCol1xFX
a11 (MatFX)


mCol1yFX

public float mCol1yFX
a12 (MatFX)


mCol2xFX

public float mCol2xFX
a21 (MatFX)


mCol2yFX

public float mCol2yFX
a22 (MatFX)

Constructor Detail

FXMatrix

public FXMatrix()
Empty constructor.


FXMatrix

public FXMatrix(int precision)

FXMatrix

public FXMatrix(FXMatrix other)
Copy constructor.

Parameters:
other - the matrix to copy.
Method Detail

assign

public void assign(FXMatrix other)

createRotationMatrix

public static FXMatrix createRotationMatrix(float rotation2FX)
Creates a 2D rotation matrix.

Parameters:
rotation2FX - rotation angle in radians (2FX).

setRotationMatrix

public void setRotationMatrix(float rotation2FX)
Sets the matrix to a rotation matrix.

Parameters:
rotation2FX - rotation angle in radians (2FX).

mult

public final FXVector mult(FXVector vector)
Multiplies the matrix with vector.

Parameters:
vector - the vector to multiply
Returns:
a new vector, that is the result of the matrix multiplication.

mult

public final FXVector mult(float xFX,
                           float yFX)
Multiplies the matrix with vector given as two coordinates (FX).

Parameters:
xFX - x coordinate (FX).
yFX - y coordinate (FX).
Returns:
a new vector, that is the result of the matrix multiplication.

mult

public final void mult(float xFX,
                       float yFX,
                       FXVector target)
Multiplies the matrix with vector given as two coordinates (FX).

Parameters:
xFX - x coordinate (FX).
yFX - y coordinate (FX).
target - the result vector.

mult

public final void mult(FXVector vector,
                       FXVector target)
Multiplies the matrix with a vector (without object creation). Uses the supplied target vector as result vector. Note: Do not supply the same vector in both arguments! This will lead to wrong results!

Parameters:
vector - the vector to multiply.
target - the result vector.

invert

public final void invert()
Inverts the matrix.


normMatFX

public float normMatFX()
Calculates the 1 norm.

Returns:
the 1 norm of the matrix.

Emini Physics Engine 1.3.5a API Documentation

Emini Physics Engine 1.3.5a API Documentation - Copyright 2014 Alexander Adensamer