Class com.oroinc.math.geometry.SquareMatrix
All Packages Class Hierarchy This Package Previous Next Index
Class com.oroinc.math.geometry.SquareMatrix
java.lang.Object
|
+----com.oroinc.math.geometry.SquareMatrix
- public final class SquareMatrix
- extends Object
- implements Cloneable
The SquareMatrix class represents a matrix with equal numbers of
rows and columns. It is used to perform transformations on points
and vectors.
Copyright © 1996, 1997 Original Reusable Objects, Inc.
All rights reserved.
- Author:
- Daniel F. Savarese
-
SquareMatrix(int)
- Creates a n x n matrix with all cells initialized to zero.
-
SquareMatrix(SquareMatrix)
- Creates a copy of a matrix.
-
assign(SquareMatrix)
- Assigns the parameter matrix to the calling matrix.
-
clone()
- Returns a deep copy of the Tuple.
-
determinant()
- Calculates the determinant of the matrix and returns its value.
-
element(int, int)
- Returns the element at the indicated location in the matrix.
-
identity()
- Turns the matrix into the identity matrix.
-
invert()
- Inverts the matrix.
-
invert(SquareMatrix)
- Sets the parameter matrix to the inverse of the calling matrix.
-
multiply(float)
- Multiplies the matrix by a scalar and returns the resulting
SquareMatrix.
-
multiply(SquareMatrix)
- Multiplies the matrix by another matrix and returns the resulting
SquareMatrix.
-
multiply(Tuple)
- Multiplies the matrix by a Tuple and returns the resulting
tuple.
-
multiplyBy(float)
- This method is the equivalent of the *= operator.
-
setElement(int, int, float)
- Assigns a value to the Tuple element at the indicated row and
column.
-
toString()
- Returns a string representation of the matrix.
-
transpose()
- Transposes the matrix.
-
transpose(SquareMatrix)
- Sets the parameter matrix to the transpose of the calling matrix.
-
zero()
- Sets all the elements of the matrix to zero.
SquareMatrix
public SquareMatrix(SquareMatrix matrix)
- Creates a copy of a matrix.
- Parameters:
- matrix - The matrix to copy.
SquareMatrix
public SquareMatrix(int dimension)
- Creates a n x n matrix with all cells initialized to zero.
- Parameters:
- dimension - The number of rows and columns in the matrix.
clone
public Object clone()
- Returns a deep copy of the Tuple. Essentially just returns
new SquareMatrix(this);
SquareMatrix implements the Cloneable interface principally as a
convenience.
- Returns:
- A deep copy of the SquareMatrix.
- Overrides:
- clone in class Object
assign
public void assign(SquareMatrix matrix)
- Assigns the parameter matrix to the calling matrix. Assumes
matrices are of equal dimension.
- Parameters:
- matrix - The value to assign to the caller.
multiplyBy
public void multiplyBy(float scalar)
- This method is the equivalent of the *= operator.
It multiplies the SquareMatrix by the argument.
- Parameters:
- scalar - The value by which to mulitply the matrix.
multiply
public SquareMatrix multiply(float scalar)
- Multiplies the matrix by a scalar and returns the resulting
SquareMatrix.
- Parameters:
- scalar - The value by which to multiply the matrix.
- Returns:
- The result of the multiplication.
multiply
public SquareMatrix multiply(SquareMatrix matrix)
- Multiplies the matrix by another matrix and returns the resulting
SquareMatrix.
- Parameters:
- tuple - The value by which to multiply the matrix.
- Returns:
- The result of the multiplication.
multiply
public Tuple multiply(Tuple tuple)
- Multiplies the matrix by a Tuple and returns the resulting
tuple.
- Parameters:
- tuple - The value by which to multiply the matrix.
- Returns:
- The result of the multiplication.
element
public float element(int row,
int column)
- Returns the element at the indicated location in the matrix.
No bounds checking is done.
- Parameters:
- column - The column of the matrix element to return.
- Throws: ArrayIndexOutOfBoundsException
- If the row and column
do not occur within the matrix.
setElement
public void setElement(int row,
int column,
float scalar)
- Assigns a value to the Tuple element at the indicated row and
column.
- Parameters:
- row - The row of the element to change.
- column - The row of the element to change.
- scalar - The new value to assign.
determinant
public float determinant()
- Calculates the determinant of the matrix and returns its value.
- Returns:
- The determinant of the matrix.
zero
public void zero()
- Sets all the elements of the matrix to zero.
identity
public void identity()
- Turns the matrix into the identity matrix. That is, all of the
matrix cells become equal to zero, except for the diagonal, which
becomes equal to 1.
invert
public void invert()
- Inverts the matrix.
invert
public void invert(SquareMatrix matrix)
- Sets the parameter matrix to the inverse of the calling matrix.
Assumes matrices are of equal dimension.
- Parameters:
- matrix - This parameter is set to the inverse of the matrix.
The calling matrix is left unchanged.
transpose
public void transpose()
- Transposes the matrix.
transpose
public void transpose(SquareMatrix matrix)
- Sets the parameter matrix to the transpose of the calling matrix.
Assumes matrices are of equal dimension.
- Parameters:
- matrix - This parameter is set to the transpose of the matrix.
The calling matrix is left unchanged.
toString
public final String toString()
- Returns a string representation of the matrix.
- Returns:
- A string representation of the matrix.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index