- All Known Implementing Classes:
SimpleMatrix
A two dimensional array of numbers. Row and column numbering begins with zero.
API note:
the API for this interface matches closely the API in various
javax.vecmath
implementations,
which should enable straightforward implementations on top of javax.vecmath
.
The later package provides matrix for the general case and optimized versions for 3×3 and 4×4 cases,
which are quite common in a transformation package.
Examples of third-party classes that can be used for implementing this Matrix
interface:
- Standard Java:
AffineTransform
- Java Advanced Imaging (JAI):
invalid @link
javax.media.jai.PerspectiveTransform
- Java3D:
invalid @link
javax.media.j3d.Transform3D
GMatrix
,Matrix4d
,Matrix3d
- Other: Jama matrix
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a modifiable copy of this matrix.double
getElement
(int row, int column) Retrieves the value at the specified row and column of this matrix.int
Returns the number of columns in this matrix.int
Returns the number of rows in this matrix.boolean
Returnstrue
if this matrix is an identity matrix.void
setElement
(int row, int column, double value) Modifies the value at the specified row and column of this matrix.
-
Method Details
-
isIdentity
boolean isIdentity()Returnstrue
if this matrix is an identity matrix.- Returns:
true
if this matrix is an identity matrix.- Departure from OGC/ISO abstract specification:
Extension for convenience without introduction of new functionality
Added as a convenience for a frequently requested operation.
-
getNumRow
int getNumRow()Returns the number of rows in this matrix.- Returns:
- the number of rows in this matrix.
- Departure from OGC/ISO abstract specification:
Departure for closer integration with the Java environment
Needed for making the matrix usable. The method signature matches the one ofGMatrix
in the vecmath package, for straightforward implementation.
-
getNumCol
int getNumCol()Returns the number of columns in this matrix.- Returns:
- the number of columns in this matrix.
- Departure from OGC/ISO abstract specification:
Departure for closer integration with the Java environment
Needed for making the matrix usable. The method signature matches the one ofGMatrix
in the vecmath package, for straightforward implementation.
-
getElement
double getElement(int row, int column) Retrieves the value at the specified row and column of this matrix.- Parameters:
row
- the row number to be retrieved (zero indexed).column
- the column number to be retrieved (zero indexed).- Returns:
- the value at the indexed element.
- Throws:
IndexOutOfBoundsException
- if the specified row or column is out of bounds.- Departure from OGC/ISO abstract specification:
Departure for closer integration with the Java environment
Needed for making the matrix usable. The method signature matches the one ofGMatrix
in the vecmath package, for straightforward implementation.
-
setElement
void setElement(int row, int column, double value) Modifies the value at the specified row and column of this matrix.- Parameters:
row
- the row number of the value to set (zero indexed).column
- the column number of the value to set (zero indexed).value
- the new matrix element value.- Throws:
IndexOutOfBoundsException
- if the specified row or column is out of bounds.UnsupportedOperationException
- if this matrix is unmodifiable.- Departure from OGC/ISO abstract specification:
Departure for closer integration with the Java environment
Needed for making the matrix usable. The method signature matches the one ofGMatrix
in the vecmath package, for straightforward implementation.
-
clone
Matrix clone()Returns a modifiable copy of this matrix.- Returns:
- a modifiable copy of this matrix.
-