Class Matrix
java.lang.Object
org.shredzone.commons.suncalc.util.Matrix
A three dimensional matrix.
Objects are immutable and threadsafe.
-
Method Summary
Modifier and TypeMethodDescriptionAdds a matrix to this matrix.boolean
double
get
(int r, int c) Gets a value from the matrix.int
hashCode()
static Matrix
identity()
Creates an identity matrix.multiply
(double scalar) Performs a scalar multiplication.Multiplies two matrices.Applies this matrix to aVector
.negate()
Negates this matrix.static Matrix
rotateX
(double angle) Creates a matrix that rotates a vector by the given angle at the X axis.static Matrix
rotateY
(double angle) Creates a matrix that rotates a vector by the given angle at the Y axis.static Matrix
rotateZ
(double angle) Creates a matrix that rotates a vector by the given angle at the Z axis.Subtracts a matrix from this matrix.toString()
Transposes this matrix.
-
Method Details
-
identity
Creates an identity matrix.- Returns:
- Identity
Matrix
-
rotateX
Creates a matrix that rotates a vector by the given angle at the X axis.- Parameters:
angle
- angle, in radians- Returns:
- Rotation
Matrix
-
rotateY
Creates a matrix that rotates a vector by the given angle at the Y axis.- Parameters:
angle
- angle, in radians- Returns:
- Rotation
Matrix
-
rotateZ
Creates a matrix that rotates a vector by the given angle at the Z axis.- Parameters:
angle
- angle, in radians- Returns:
- Rotation
Matrix
-
transpose
Transposes this matrix.- Returns:
Matrix
that is a transposition of this matrix.
-
negate
Negates this matrix.- Returns:
Matrix
that is a negation of this matrix.
-
add
Adds a matrix to this matrix. -
subtract
Subtracts a matrix from this matrix. -
multiply
Multiplies two matrices. -
multiply
Performs a scalar multiplication.- Parameters:
scalar
- Scalar to multiply with- Returns:
Matrix
that is the scalar product
-
multiply
Applies this matrix to aVector
. -
get
Gets a value from the matrix.- Parameters:
r
- Row number (0..2)c
- Column number (0..2)- Returns:
- Value at that position
-
equals
-
hashCode
-
toString
-