uavsim.flightdynamicsmodel
Class Matrix

java.lang.Object
  extended by uavsim.flightdynamicsmodel.Matrix
All Implemented Interfaces:
java.lang.Cloneable

public class Matrix
extends java.lang.Object
implements java.lang.Cloneable

Defines a general-purpose 3x3 mathematical matrix. For compatibility with the other classes derived from the original source (Physics for Game Developers by David Bourg), the member variables are public and mutable. Eventually they will be protected appropriately. In addition, some methods inconsistently operate in place, while others behave as expected and return a new affected instance of the matrix.

Author:
Dan Tappan [17.08.11]

Field Summary
 double _e11
          the elements with row/column indexing with (1,1) as top left
 double _e12
          the elements with row/column indexing with (1,1) as top left
 double _e13
          the elements with row/column indexing with (1,1) as top left
 double _e21
          the elements with row/column indexing with (1,1) as top left
 double _e22
          the elements with row/column indexing with (1,1) as top left
 double _e23
          the elements with row/column indexing with (1,1) as top left
 double _e31
          the elements with row/column indexing with (1,1) as top left
 double _e32
          the elements with row/column indexing with (1,1) as top left
 double _e33
          the elements with row/column indexing with (1,1) as top left
 
Constructor Summary
Matrix()
          Creates a matrix with all entries zero.
Matrix(double e11, double e12, double e13, double e21, double e22, double e23, double e31, double e32, double e33)
          Creates a matrix with the entries in row/column format.
 
Method Summary
 Matrix add(Matrix matrix)
          Calculates the sum of this matrix and another.
 Matrix clone()
          
 double determinant()
          Calculates the determinant of this matrix.
 Matrix divide(double scale)
          Calculates the scaled entries of this matrix.
 Matrix inverse()
          Calculates the inverse of this matrix.
 Matrix multiply(double scale)
          Calculates the scaled entries of this matrix.
 Matrix multiply(Matrix matrix)
          Calculates the product of this matrix and another.
 Vector multiply(Vector vector)
          Calculates the product of this matrix and a vector.
 Matrix subtract(Matrix matrix)
          Calculates the difference of this matrix and another.
 java.lang.String toString()
          
 Matrix transpose()
          Calculates the transpose of this matrix.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_e11

public double _e11
the elements with row/column indexing with (1,1) as top left


_e12

public double _e12
the elements with row/column indexing with (1,1) as top left


_e13

public double _e13
the elements with row/column indexing with (1,1) as top left


_e21

public double _e21
the elements with row/column indexing with (1,1) as top left


_e22

public double _e22
the elements with row/column indexing with (1,1) as top left


_e23

public double _e23
the elements with row/column indexing with (1,1) as top left


_e31

public double _e31
the elements with row/column indexing with (1,1) as top left


_e32

public double _e32
the elements with row/column indexing with (1,1) as top left


_e33

public double _e33
the elements with row/column indexing with (1,1) as top left

Constructor Detail

Matrix

public Matrix()
Creates a matrix with all entries zero.


Matrix

public Matrix(double e11,
              double e12,
              double e13,
              double e21,
              double e22,
              double e23,
              double e31,
              double e32,
              double e33)
Creates a matrix with the entries in row/column format.

Parameters:
e11 - - element row 1, column 1
e12 - - element row 1, column 2
e13 - - element row 1, column 3
e21 - - element row 2, column 1
e22 - - element row 2, column 2
e23 - - element row 2, column 3
e31 - - element row 3, column 1
e32 - - element row 3, column 2
e33 - - element row 3, column 3
Method Detail

add

public Matrix add(Matrix matrix)
Calculates the sum of this matrix and another.

Parameters:
matrix - - the other matrix
Returns:
the result as a new matrix

clone

public Matrix clone()

Overrides:
clone in class java.lang.Object

determinant

public double determinant()
Calculates the determinant of this matrix.

Returns:
the result

divide

public Matrix divide(double scale)
Calculates the scaled entries of this matrix.

Parameters:
scale - - the scale
Returns:
the result as a new matrix

inverse

public Matrix inverse()
Calculates the inverse of this matrix.

Returns:
the result as a new matrix

multiply

public Matrix multiply(double scale)
Calculates the scaled entries of this matrix.

Parameters:
scale - - the scale
Returns:
the result as a new matrix

multiply

public Matrix multiply(Matrix matrix)
Calculates the product of this matrix and another.

Parameters:
matrix - - the other matrix
Returns:
the result as a new matrix

multiply

public Vector multiply(Vector vector)
Calculates the product of this matrix and a vector.

Parameters:
vector - - the vector
Returns:
the result as a new vector

subtract

public Matrix subtract(Matrix matrix)
Calculates the difference of this matrix and another.

Parameters:
matrix - - the other matrix
Returns:
the result as a new matrix

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

transpose

public Matrix transpose()
Calculates the transpose of this matrix.

Returns:
the result as a new matrix