public class Matrix3d
extends java.lang.Object
implements java.lang.Cloneable
Methods with names ending in "Local" modify the current instance. They are used to avoid creating temporary objects.
By convention, indices start from zero. The conventional order of indices is (row, column).
| Modifier and Type | Field and Description |
|---|---|
protected double |
m00
The element in row 0, column 0.
|
protected double |
m01
The element in row 0, column 1.
|
protected double |
m02
The element in row 0, column 2.
|
protected double |
m10
The element in row 1, column 0.
|
protected double |
m11
The element in row 1, column 1.
|
protected double |
m12
The element in row 1, column 2.
|
protected double |
m20
The element in row 2, column 0.
|
protected double |
m21
The element in row 2, column 1.
|
protected double |
m22
The element in row 2, column 2.
|
| Constructor and Description |
|---|
Matrix3d()
Instantiates an identity matrix (diagonals = 1, other elements = 0).
|
Matrix3d(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22)
Instantiates a matrix with the specified elements.
|
| Modifier and Type | Method and Description |
|---|---|
Matrix3d |
clone()
Creates a copy of the current instance.
|
double |
determinant()
Returns the determinant.
|
boolean |
equals(java.lang.Object o)
Tests for exact equality with the argument, distinguishing -0 from 0.
|
int |
hashCode()
Returns a hash code.
|
Matrix3d |
invert()
Returns the multiplicative inverse.
|
boolean |
isIdentity()
Tests for identity.
|
Matrix3d |
makeIdentity()
Configures the matrix as an identity matrix (diagonals = 1, other
elements = 0).
|
Matrix3d |
multLocal(double scale)
Multiplies by the scalar argument and returns the (modified) current
instance.
|
Matrix3d |
set(Matrix3d mat)
Copies all elements of the argument to the current instance.
|
java.lang.String |
toString()
Returns a string representation of the matrix, which is unaffected.
|
Matrix3d |
transpose()
Returns the transpose.
|
protected double m00
protected double m01
protected double m02
protected double m10
protected double m11
protected double m12
protected double m20
protected double m21
protected double m22
public Matrix3d()
public Matrix3d(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22)
m00 - the desired value for row 0, column 0m01 - the desired value for row 0, column 1m02 - the desired value for row 0, column 2m10 - the desired value for row 1, column 0m11 - the desired value for row 1, column 1m12 - the desired value for row 1, column 2m20 - the desired value for row 2, column 0m21 - the desired value for row 2, column 1m22 - the desired value for row 2, column 2public Matrix3d clone()
clone in class java.lang.Objectpublic Matrix3d set(Matrix3d mat)
mat - the desired value (not null, unaffected)public Matrix3d makeIdentity()
public boolean isIdentity()
public Matrix3d multLocal(double scale)
scale - the scaling factorpublic double determinant()
public Matrix3d invert()
public Matrix3d transpose()
public boolean equals(java.lang.Object o)
o is null, false is returned. Either way, the current instance is
unaffected.equals in class java.lang.Objecto - the object to compare (may be null, unaffected)this and o have identical values,
otherwise falsepublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
Matrix3d[{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}]
toString in class java.lang.Object