public abstract class MatrixF
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
numCols |
protected int |
numRows |
Constructor and Description |
---|
MatrixF(int numRows,
int numCols)
Creates a matrix containing the indicated number of rows and columns.
|
Modifier and Type | Method and Description |
---|---|
protected VectorF |
adaptHomogeneous(VectorF him)
Automatically adapts vectors to and from homogeneous coordinates according to the
size of the receiver matrix.
|
void |
add(float[] him) |
void |
add(MatrixF addend)
Adds a matrix, in place, to the receiver
|
void |
add(VectorF him) |
MatrixF |
added(float[] him) |
MatrixF |
added(MatrixF addend)
Returns a new matrix whose elements are the sum of the corresponding elements of
the receiver and the addend
|
MatrixF |
added(VectorF him) |
static MatrixF |
diagonalMatrix(int dim,
float scale)
Returns a new matrix which is zero everywhere except on the diagonal, where it has
an indicated value.
|
static MatrixF |
diagonalMatrix(VectorF vector)
Returns a new matrix which is zero everywhere, except on the diagonal, where its
values are taken from an indicated vector
|
protected java.lang.RuntimeException |
dimensionsError() |
protected static java.lang.RuntimeException |
dimensionsError(int numRows,
int numCols) |
abstract MatrixF |
emptyMatrix(int numRows,
int numCols)
Returns a new empty matrix of the indicated dimensions.
|
java.lang.String |
formatAsTransform()
A simple utility that extracts positioning information from a transformation matrix
and formats it in a form palatable to a human being.
|
java.lang.String |
formatAsTransform(AxesReference axesReference,
AxesOrder axesOrder,
AngleUnit unit)
A simple utility that extracts positioning information from a transformation matrix
and formats it in a form palatable to a human being.
|
abstract float |
get(int row,
int col)
Returns a particular element of this matrix
|
VectorF |
getColumn(int col)
Returns a vector containing data of a particular column of the receiver.
|
VectorF |
getRow(int row)
Returns a vector containing data of a particular row of the receiver.
|
VectorF |
getTranslation()
Assumes that the receiver is non-perspective transformation matrix.
|
static MatrixF |
identityMatrix(int dim)
Returns an identity matrix of the indicated dimension.
|
MatrixF |
inverted()
Returns a matrix which is the matrix-multiplication inverse of the receiver.
|
MatrixF |
multiplied(float scale)
Returns a new matrix in which all the entries of the receiver have been scaled
by an indicated value.
|
VectorF |
multiplied(float[] him)
Multiplies the receiver by the indicated vector, considered as a column matrix.
|
MatrixF |
multiplied(MatrixF him)
Returns a matrix which is the multiplication of the recevier with another matrix.
|
VectorF |
multiplied(VectorF him)
Multiplies the receiver by the indicated vector, considered as a column matrix.
|
void |
multiply(float scale) |
void |
multiply(float[] him) |
void |
multiply(MatrixF him)
Updates the receiver to be the product of itself and another matrix.
|
void |
multiply(VectorF him) |
int |
numCols()
Returns the number of columns in this matrix
|
int |
numRows()
Returns the number of rows in this matrix
|
abstract void |
put(int row,
int col,
float value)
Updates a particular element of this matrix
|
SliceMatrixF |
slice(int numRows,
int numCols)
Returns a matrix which is a submatrix of the receiver starting at (0,0)
|
SliceMatrixF |
slice(int row,
int col,
int numRows,
int numCols)
Returns a matrix which a submatrix of the receiver.
|
void |
subtract(float[] him) |
void |
subtract(MatrixF subtrahend)
Subtracts a matrix, in place, from the receiver.
|
void |
subtract(VectorF him) |
MatrixF |
subtracted(float[] him) |
MatrixF |
subtracted(MatrixF subtrahend)
Returns a new matrix whose elements are the difference of the corresponding elements of
the receiver and the subtrahend
|
MatrixF |
subtracted(VectorF him) |
java.lang.String |
toString() |
VectorF |
toVector()
If the receiver is one-dimensional in one of its dimensions, returns a vector
containing the data of the receiver; otherwise, an exception is thrown.
|
VectorF |
transform(VectorF him)
Transforms the vector according to this matrix interpreted as a transformation matrix.
|
MatrixF |
transposed()
Returns a matrix which is the transposition of the receiver matrix.
|
public MatrixF(int numRows, int numCols)
@Const public SliceMatrixF slice(int row, int col, int numRows, int numCols)
row
- the row in the receiver at which the submatrix is to startcol
- the column in the receiver at which the submatrix is to startnumRows
- the number of rows in the submatrixnumCols
- the number of columns in the submatrixslice(int, int)
@Const public SliceMatrixF slice(int numRows, int numCols)
numRows
- the number of rows in the submatrixnumCols
- the number of columns in the submatrixslice(int, int, int, int)
public static MatrixF identityMatrix(int dim)
dim
- the size of the indentity matrix to returnpublic static MatrixF diagonalMatrix(int dim, float scale)
dim
- the size of the matrix to returnscale
- the value to place on its diagonalpublic static MatrixF diagonalMatrix(VectorF vector)
vector
- the values to place on the diagonal@Const public abstract MatrixF emptyMatrix(int numRows, int numCols)
OpenGLMatrix.emptyMatrix(int, int)
@Const public int numRows()
@Const public int numCols()
@Const public abstract float get(int row, int col)
row
- the index of the row of the element to returncol
- the index of the column of the element to returnput(int, int, float)
@NonConst public abstract void put(int row, int col, float value)
row
- the index of the row of the element to updatecol
- the index of the column of the element to updatevalue
- the new value for the indicated element@Const public VectorF getRow(int row)
row
- the row to extract@Const public VectorF getColumn(int col)
col
- the column to extract@Const public java.lang.String toString()
toString
in class java.lang.Object
@Const public VectorF transform(VectorF him)
him
- the 3D coordinate or 3D homogeneous coordinate that is to be transformedVectorF.normalized3D()
@Const protected VectorF adaptHomogeneous(VectorF him)
transform(VectorF)
,
Homogeneous coordinatespublic java.lang.String formatAsTransform()
formatAsTransform(AxesReference, AxesOrder, AngleUnit)
,
Transformation Matrixpublic java.lang.String formatAsTransform(AxesReference axesReference, AxesOrder axesOrder, AngleUnit unit)
axesReference
- the reference frame of the angles to use in reporting the transformationaxesOrder
- the order of the angles to use in reporting the transformationunit
- the angular unit to use in reporting the transformationformatAsTransform()
,
Transformation Matrix@Const public MatrixF transposed()
@NonConst public void multiply(MatrixF him)
him
- the matrix with which the receiver is to be multiplied.@Const public MatrixF multiplied(MatrixF him)
him
- the matrix with which the receiver is to be multiplied.@Const public MatrixF multiplied(float scale)
scale
- the factor with which to scale each entry of the receiver@NonConst public void multiply(float scale)
@Const public VectorF multiplied(VectorF him)
him
- the vector with which the receiver is to be multiplied@Const public VectorF multiplied(float[] him)
him
- the vector with which the receiver is to be multiplied@NonConst public void multiply(float[] him)
@Const public VectorF toVector()
@Const public MatrixF added(MatrixF addend)
addend
- the matrix which is to be added to the receiver@NonConst public void add(MatrixF addend)
addend
- the matrix which is to be added to the receiver@Const public MatrixF subtracted(MatrixF subtrahend)
subtrahend
- the matrix which is to be subtracted from the receiver@NonConst public void subtract(MatrixF subtrahend)
subtrahend
- the matrix which is to be subtracted from the receiver@Const public MatrixF added(VectorF him)
added(MatrixF)
@Const public MatrixF added(float[] him)
added(VectorF)
@Const public MatrixF subtracted(VectorF him)
subtracted(MatrixF)
@Const public MatrixF subtracted(float[] him)
subtracted(VectorF)
@NonConst public void add(VectorF him)
add(MatrixF)
@NonConst public void add(float[] him)
add(VectorF)
@NonConst public void subtract(VectorF him)
subtract(MatrixF)
@NonConst public void subtract(float[] him)
subtract(VectorF)
@Const public VectorF getTranslation()
protected java.lang.RuntimeException dimensionsError()
protected static java.lang.RuntimeException dimensionsError(int numRows, int numCols)