public class Matrix3d
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
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 |
|---|---|
double |
m00
The element in row 0, column 0.
|
double |
m01
The element in row 0, column 1.
|
double |
m02
The element in row 0, column 2.
|
double |
m10
The element in row 1, column 0.
|
double |
m11
The element in row 1, column 1.
|
double |
m12
The element in row 1, column 2.
|
double |
m20
The element in row 2, column 0.
|
double |
m21
The element in row 2, column 1.
|
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 |
addLocal(Matrix3d add)
Adds the argument and returns the (modified) current instance.
|
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.
|
Vec3d |
getColumn(int i)
Returns the indexed column.
|
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 |
mult(Matrix3d mat)
Multiplies by the argument and returns the product as a new instance.
|
Vec3d |
mult(Vec3d v)
Multiplies by the specified column vector and returns the product as a
new column vector.
|
Matrix3d |
multLocal(double scale)
Multiplies by the scalar argument and returns the (modified) current
instance.
|
Matrix3d |
multLocal(Matrix3d mat)
Multiplies by the argument and returns the (modified) current instance.
|
Matrix3d |
set(Matrix3d mat)
Copies all elements of the argument to the current instance.
|
Matrix3d |
setColumn(int i,
Vec3d col)
Alters the indexed column and returns the (modified) current instance.
|
Matrix3d |
setSkewSymmetric(Vec3d v) |
java.lang.String |
toString()
Returns a string representation of the matrix, which is unaffected.
|
Matrix3d |
transpose()
Returns the transpose.
|
public double m00
public double m01
public double m02
public double m10
public double m11
public double m12
public double m20
public double m21
public 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 Vec3d getColumn(int i)
i - 0, 1, or 2ith columnjava.lang.IndexOutOfBoundsException - if i is not 0, 1, or 2public Matrix3d setColumn(int i, Vec3d col)
i - 0, 1, or 2col - the desired value (not null, unaffected)java.lang.IndexOutOfBoundsException - if i is not 0, 1, or 2public Matrix3d mult(Matrix3d mat)
mat - the right factor (not null, unaffected)public Vec3d mult(Vec3d v)
v - the right factor (not null, unaffected)public Matrix3d multLocal(Matrix3d mat)
It IS safe for mat and this to be the same object.
mat - the right factor (not null, unaffected unless it's
this)public Matrix3d multLocal(double scale)
scale - the scaling factorpublic double determinant()
public Matrix3d invert()
public Matrix3d transpose()
public Matrix3d addLocal(Matrix3d add)
It IS safe for add and this to be the same object.
add - the matrix to add (not null, unaffected unless it's
this)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