java.lang.Object
omix.util.math.vector.Matrix4d
public class Matrix4d extends Object
This class is a 4 × 4 matrix with double precision.
- Author:
- Dr. Peter Droste, Omix Visualization
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Matrix4d.RotationType
Describes the type of rotation matrix. -
Constructor Summary
Constructors Constructor Description Matrix4d()
4 × 4 zeros.Matrix4d(Matrix4d.RotationType type, double angle)
Initializes a rotation matrix of given type with the given angle.Matrix4d(Vec4d pos)
Transpation matrix.
The matrix has the form:
|1, 0, 0, pos.x|
|0, 1, 0, pos.y|
|0, 0, 1, pos.z|
|0, 0, 0, pos.w|Matrix4d(Vec4d axis, double angle)
Initializes a rotation matrix about the given axis with the given angle.Matrix4d(Vec4d xAxis, Vec4d yAxis, Vec4d zAxis)
Rotation matrix.
The matrix has the form:
|xAxis.x, yAxis.x, zAxis.x, 0|
|xAxis.y, yAxis.y, zAxis.y, 0|
|xAxis.z, yAxis.z, zAxis.z, 0|
|xAxis.w, yAxis.w, zAxis.w, 1| -
Method Summary
Modifier and Type Method Description Matrix4d
dot(double a)
ScaleMatrix4d
dot(Matrix4d matrix)
Scalar productVec4d
dot(Vec4d vector)
Product with a vector.double
get(int i, int j)
Returns the value of the matrix index (i,j).Matrix4d
plus(Matrix4d matrix)
Additionvoid
set(int i, int j, double value)
Sets the value of the matrix index (i,j).String
toString()
Matrix4d
transponate()
Transponates the matrix.
-
Constructor Details
-
Matrix4d
public Matrix4d()4 × 4 zeros. -
Matrix4d
Transpation matrix.
The matrix has the form:
|1, 0, 0, pos.x|
|0, 1, 0, pos.y|
|0, 0, 1, pos.z|
|0, 0, 0, pos.w|- Parameters:
pos
-
-
Matrix4d
Rotation matrix.
The matrix has the form:
|xAxis.x, yAxis.x, zAxis.x, 0|
|xAxis.y, yAxis.y, zAxis.y, 0|
|xAxis.z, yAxis.z, zAxis.z, 0|
|xAxis.w, yAxis.w, zAxis.w, 1|- Parameters:
xAxis
- Direction of the target X axisyAxis
- Direction of the target Y axiszAxis
- Direction of the target Z axis
-
Matrix4d
Initializes a rotation matrix about the given axis with the given angle.- Parameters:
axis
- rotation axisangle
- angle in radians
-
Matrix4d
Initializes a rotation matrix of given type with the given angle.- Parameters:
type
- rotation axisangle
- angle in radians
-
-
Method Details
-
transponate
Transponates the matrix.- Returns:
- thisT
-
dot
Scalar product- Parameters:
matrix
-- Returns:
- this⋅matrix
-
set
public void set(int i, int j, double value)Sets the value of the matrix index (i,j).- Parameters:
i
-j
-value
-
-
get
public double get(int i, int j)Returns the value of the matrix index (i,j).- Parameters:
i
-j
-- Returns:
- value at i,j
-
plus
Addition- Parameters:
matrix
-- Returns:
- this + matrix
-
dot
Scale- Parameters:
a
-- Returns:
- this⋅a
-
dot
Product with a vector.- Parameters:
vector
-- Returns:
- this⋅vector
-
toString
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-