Package org.gephi.lib.gleem.linalg
Class Mat3f
- java.lang.Object
-
- org.gephi.lib.gleem.linalg.Mat3f
-
public class Mat3f extends Object
3x3 matrix class useful for simple linear algebra. Representation is (as Mat4f) in row major order and assumes multiplication by column vectors on the right.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
data
-
Constructor Summary
Constructors Constructor Description Mat3f()
Creates new matrix initialized to the zero matrix
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
determinant()
Return the determinant.float
get(int i, int j)
Gets the (i,j)th element of this matrix, where i is the row index and j is the column indexboolean
invert()
Full matrix inversion in place.void
makeIdent()
Initialize to the identity matrix.Mat3f
mul(Mat3f b)
Returns this * b; creates new matrixvoid
mul(Mat3f a, Mat3f b)
this = a * bvoid
set(int i, int j, float val)
Sets the (i,j)th element of this matrix, where i is the row index and j is the column indexvoid
setCol(int i, Vec3f v)
Set column i (i=[0..2]) to vector v.void
setRow(int i, Vec3f v)
Set row i (i=[0..2]) to vector v.Matf
toMatf()
String
toString()
void
transpose()
Transpose this matrix in place.void
xformVec(Vec3f src, Vec3f dest)
Multiply a 3D vector by this matrix.
-
-
-
Method Detail
-
makeIdent
public void makeIdent()
Initialize to the identity matrix.
-
get
public float get(int i, int j)
Gets the (i,j)th element of this matrix, where i is the row index and j is the column index
-
set
public void set(int i, int j, float val)
Sets the (i,j)th element of this matrix, where i is the row index and j is the column index
-
setCol
public void setCol(int i, Vec3f v)
Set column i (i=[0..2]) to vector v.
-
setRow
public void setRow(int i, Vec3f v)
Set row i (i=[0..2]) to vector v.
-
transpose
public void transpose()
Transpose this matrix in place.
-
determinant
public float determinant()
Return the determinant. Computed across the zeroth row.
-
invert
public boolean invert()
Full matrix inversion in place. If matrix is singular, returns false and matrix contents are untouched. If you know the matrix is orthonormal, you can call transpose() instead.
-
xformVec
public void xformVec(Vec3f src, Vec3f dest)
Multiply a 3D vector by this matrix. NOTE: src and dest must be different vectors.
-
toMatf
public Matf toMatf()
-
-