triptracker.client.map.core
Class SimpleMatrixOps

java.lang.Object
  extended by triptracker.client.map.core.SimpleMatrixOps

public class SimpleMatrixOps
extends Object


Field Summary
static double[][] flip3x3
          Flip matrix.
static double[][] identity3x3
          3x3 identity matrix.
static double[][] mirror3x3
          Mirror matrix.
static double[][] rotate180d3x3
          180 degrees rotation matrix.
static double[][] rotate270d3x3
          270 degrees (anti-clockwise?) rotation matrix
static double[][][] rotate3x3
          All rotation matrices.
static double[][] rotate90d3x3
          90 degrees (anti-clockwise?) rotation matrix.
static double[][][] scale3x3
          Both scaling matrices.
static double[][] scalex3x3
          X-axis scaling matrix.
static double[][] scaley3x3
          Y-axis scaling matrix.
static double[][][] translate3x3
          Both translation matrices.
static double[][] translatex3x3
          X-axis translation matrix.
static double[][] translatey3x3
          Y-axis translation matrix.
 
Constructor Summary
SimpleMatrixOps()
           
 
Method Summary
static double[][] add(double[][]... matrices)
          Perform a matrix addition operation on an abitrary number of matrices.
static Matrix2D<? extends Number> add(Matrix2D<? extends Number>... matrices)
           
static boolean[][] expandToSquare(boolean[][] layout)
          Expand a matrix until it becomes square.
static Matrix2D<Number> expandToSquares(Matrix2D<Number> mat, Number defaultValue)
           
static boolean[][] minimize(boolean[][] layout)
          Minimize the matrix by removing rows and columns from either of the four sides where all the elements are false.
static double[][] multiply(double[][] mat1, double[][] mat2)
          Perform a matrix multiplication operation.
static double[][] multiply(double factor, double[][] matrix)
          Multiply a matrix by a factor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

identity3x3

public static final double[][] identity3x3
3x3 identity matrix.


rotate90d3x3

public static final double[][] rotate90d3x3
90 degrees (anti-clockwise?) rotation matrix.


rotate180d3x3

public static final double[][] rotate180d3x3
180 degrees rotation matrix.


rotate270d3x3

public static final double[][] rotate270d3x3
270 degrees (anti-clockwise?) rotation matrix


scalex3x3

public static final double[][] scalex3x3
X-axis scaling matrix.


scaley3x3

public static final double[][] scaley3x3
Y-axis scaling matrix.


translatex3x3

public static final double[][] translatex3x3
X-axis translation matrix.


translatey3x3

public static final double[][] translatey3x3
Y-axis translation matrix.


flip3x3

public static final double[][] flip3x3
Flip matrix. Scale -1 about the y-axis (invert all x values)


mirror3x3

public static final double[][] mirror3x3
Mirror matrix. Scale -1 about the x-axis (invert all y values)


rotate3x3

public static final double[][][] rotate3x3
All rotation matrices.


scale3x3

public static final double[][][] scale3x3
Both scaling matrices.


translate3x3

public static final double[][][] translate3x3
Both translation matrices.

Constructor Detail

SimpleMatrixOps

public SimpleMatrixOps()
Method Detail

multiply

public static double[][] multiply(double[][] mat1,
                                  double[][] mat2)
Perform a matrix multiplication operation. In matrix multiplication the order of the matrices is essential to the final result.

Parameters:
mat1 - the first matrix
mat2 - the second matrix
Returns:
resulting multiplied matrix
Throws:
IllegalArgumentException - if not all matrices are the same size

multiply

public static double[][] multiply(double factor,
                                  double[][] matrix)
Multiply a matrix by a factor.

Parameters:
factor -
matrix -
Returns:
matrix with elements multiplied by the factor

add

public static double[][] add(double[][]... matrices)
Perform a matrix addition operation on an abitrary number of matrices.

Parameters:
matrices - matrices to perform the addition operation on
Returns:
matrix with all the elements added
Throws:
IllegalArgumentException - if matrix dimensions are incompatible

add

public static Matrix2D<? extends Number> add(Matrix2D<? extends Number>... matrices)

expandToSquare

public static boolean[][] expandToSquare(boolean[][] layout)
Expand a matrix until it becomes square. The extra rows or columns added, to give the matrix an equal amount of rows and columns, will be filled with the value false.

Parameters:
layout - matrix
Returns:
squared matrix

expandToSquares

public static Matrix2D<Number> expandToSquares(Matrix2D<Number> mat,
                                               Number defaultValue)

minimize

public static boolean[][] minimize(boolean[][] layout)
Minimize the matrix by removing rows and columns from either of the four sides where all the elements are false.



Copyright © 2006 Team Trip Tracker. All Rights Reserved.