![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Represents a 3D rotation matrix and provides operations for rotation and matrix manipulation. More...
#include <RotationMatrix.h>
Public Member Functions | |
Vector3D | ConvertCoordinateToVector () |
Converts the current coordinate system to a vector representation. | |
void | ReadjustMatrix () |
Recalculates and adjusts the rotation matrix axes to maintain orthogonality. | |
Vector3D | Rotate (Vector3D rotation) |
Rotates the matrix by a given rotation vector. | |
Vector3D | RotateX (float theta) |
Rotates the matrix around the X-axis. | |
Vector3D | RotateY (float theta) |
Rotates the matrix around the Y-axis. | |
Vector3D | RotateZ (float theta) |
Rotates the matrix around the Z-axis. | |
void | RotateRelative (RotationMatrix rM) |
Rotates this matrix relative to another rotation matrix. | |
RotationMatrix () | |
Default constructor. Initializes the matrix to the identity matrix. | |
RotationMatrix (Vector3D axes) | |
Constructs a rotation matrix from a single vector. | |
RotationMatrix (Vector3D X, Vector3D Y, Vector3D Z) | |
Constructs a rotation matrix from three orthogonal vectors. | |
RotationMatrix | Multiply (float d) |
Multiplies the rotation matrix by a scalar. | |
RotationMatrix | Multiply (RotationMatrix rM) |
Multiplies the rotation matrix by another rotation matrix. | |
RotationMatrix | Normalize () |
Normalizes the rotation matrix to ensure orthogonality. | |
RotationMatrix | Transpose () |
Transposes the rotation matrix. | |
RotationMatrix | Inverse () |
Inverts the rotation matrix. | |
bool | IsEqual (RotationMatrix rM) |
Checks if two rotation matrices are equal. | |
float | Determinant () |
Computes the determinant of the rotation matrix. | |
String | ToString () |
Converts the rotation matrix to a string representation. | |
RotationMatrix | operator= (RotationMatrix rM) |
Assignment operator for rotation matrices. | |
Static Public Member Functions | |
static Vector3D | RotateVector (Vector3D rotate, Vector3D coordinates) |
Rotates a vector using the rotation matrix. | |
Public Attributes | |
Vector3D | XAxis |
X-axis vector of the rotation matrix. | |
Vector3D | YAxis |
Y-axis vector of the rotation matrix. | |
Vector3D | ZAxis |
Z-axis vector of the rotation matrix. | |
Private Attributes | |
Vector3D | InitialVector |
Initial vector used for transformations. | |
bool | didRotate |
Tracks whether the matrix has been rotated. | |
Represents a 3D rotation matrix and provides operations for rotation and matrix manipulation.
Definition at line 23 of file RotationMatrix.h.
RotationMatrix | ( | ) |
Default constructor. Initializes the matrix to the identity matrix.
Definition at line 86 of file RotationMatrix.cpp.
References XAxis, YAxis, and ZAxis.
Referenced by RotateVector().
RotationMatrix | ( | Vector3D | axes | ) |
Constructs a rotation matrix from a single vector.
axes | A vector representing the axes for rotation. |
Definition at line 92 of file RotationMatrix.cpp.
RotationMatrix | ( | Vector3D | X, |
Vector3D | Y, | ||
Vector3D | Z | ||
) |
Constructs a rotation matrix from three orthogonal vectors.
X | X-axis vector. |
Y | Y-axis vector. |
Z | Z-axis vector. |
Definition at line 98 of file RotationMatrix.cpp.
Vector3D ConvertCoordinateToVector | ( | ) |
Converts the current coordinate system to a vector representation.
Definition at line 3 of file RotationMatrix.cpp.
References didRotate, InitialVector, Vector3D::X, XAxis, Vector3D::Y, YAxis, Vector3D::Z, and ZAxis.
Referenced by Rotate(), RotateX(), RotateY(), and RotateZ().
float Determinant | ( | ) |
Computes the determinant of the rotation matrix.
Definition at line 156 of file RotationMatrix.cpp.
References Vector3D::X, XAxis, Vector3D::Y, YAxis, Vector3D::Z, and ZAxis.
Referenced by Inverse().
RotationMatrix Inverse | ( | ) |
Inverts the rotation matrix.
Definition at line 139 of file RotationMatrix.cpp.
References Vector3D::CrossProduct(), Determinant(), Multiply(), Transpose(), XAxis, YAxis, and ZAxis.
bool IsEqual | ( | RotationMatrix | rM | ) |
Checks if two rotation matrices are equal.
rM | The rotation matrix to compare with. |
Definition at line 152 of file RotationMatrix.cpp.
References Vector3D::IsEqual(), XAxis, YAxis, and ZAxis.
RotationMatrix Multiply | ( | float | d | ) |
Multiplies the rotation matrix by a scalar.
d | The scalar value to multiply. |
Definition at line 104 of file RotationMatrix.cpp.
References Vector3D::Multiply(), XAxis, YAxis, and ZAxis.
Referenced by Inverse(), and RotateRelative().
RotationMatrix Multiply | ( | RotationMatrix | rM | ) |
Multiplies the rotation matrix by another rotation matrix.
rM | The rotation matrix to multiply by. |
Definition at line 112 of file RotationMatrix.cpp.
References Vector3D::Multiply(), XAxis, YAxis, and ZAxis.
RotationMatrix Normalize | ( | ) |
Normalizes the rotation matrix to ensure orthogonality.
Definition at line 120 of file RotationMatrix.cpp.
References Vector3D::CrossProduct(), Vector3D::UnitSphere(), XAxis, and YAxis.
RotationMatrix operator= | ( | RotationMatrix | rM | ) |
Assignment operator for rotation matrices.
rM | The rotation matrix to assign. |
Definition at line 184 of file RotationMatrix.cpp.
void ReadjustMatrix | ( | ) |
Recalculates and adjusts the rotation matrix axes to maintain orthogonality.
Definition at line 12 of file RotationMatrix.cpp.
References Vector3D::X, XAxis, Vector3D::Y, YAxis, Vector3D::Z, and ZAxis.
Referenced by Rotate().
Rotates the matrix by a given rotation vector.
rotation | A vector representing the rotation in radians for each axis. |
Definition at line 22 of file RotationMatrix.cpp.
References ConvertCoordinateToVector(), didRotate, ReadjustMatrix(), RotateX(), RotateY(), RotateZ(), Vector3D::X, Vector3D::Y, and Vector3D::Z.
void RotateRelative | ( | RotationMatrix | rM | ) |
Rotates this matrix relative to another rotation matrix.
rM | The rotation matrix to apply. |
Definition at line 82 of file RotationMatrix.cpp.
References Multiply().
Rotates a vector using the rotation matrix.
rotate | The vector to rotate. |
coordinates | The rotation coordinates. |
Definition at line 162 of file RotationMatrix.cpp.
References RotationMatrix().
Referenced by Rotation::DirectionAngleToQuaternion().
Rotates the matrix around the X-axis.
theta | The angle in radians to rotate. |
Definition at line 49 of file RotationMatrix.cpp.
References ConvertCoordinateToVector(), Mathematics::DegreesToRadians(), Vector3D::Multiply(), XAxis, YAxis, and ZAxis.
Referenced by Rotate().
Rotates the matrix around the Y-axis.
theta | The angle in radians to rotate. |
Definition at line 60 of file RotationMatrix.cpp.
References ConvertCoordinateToVector(), Mathematics::DegreesToRadians(), Vector3D::Multiply(), XAxis, YAxis, and ZAxis.
Referenced by Rotate().
Rotates the matrix around the Z-axis.
theta | The angle in radians to rotate. |
Definition at line 71 of file RotationMatrix.cpp.
References ConvertCoordinateToVector(), Mathematics::DegreesToRadians(), Vector3D::Multiply(), XAxis, YAxis, and ZAxis.
Referenced by Rotate().
String ToString | ( | ) |
Converts the rotation matrix to a string representation.
Definition at line 176 of file RotationMatrix.cpp.
References Vector3D::ToString(), XAxis, YAxis, and ZAxis.
RotationMatrix Transpose | ( | ) |
Transposes the rotation matrix.
Definition at line 131 of file RotationMatrix.cpp.
References Vector3D::X, XAxis, Vector3D::Y, YAxis, Vector3D::Z, and ZAxis.
Referenced by Inverse().
|
private |
Tracks whether the matrix has been rotated.
Definition at line 26 of file RotationMatrix.h.
Referenced by ConvertCoordinateToVector(), and Rotate().
|
private |
Initial vector used for transformations.
Definition at line 25 of file RotationMatrix.h.
Referenced by ConvertCoordinateToVector().
Vector3D XAxis |
X-axis vector of the rotation matrix.
Definition at line 29 of file RotationMatrix.h.
Referenced by ConvertCoordinateToVector(), Determinant(), Inverse(), IsEqual(), Multiply(), Multiply(), Normalize(), operator=(), ReadjustMatrix(), RotateX(), RotateY(), RotateZ(), RotationMatrix(), RotationMatrix(), RotationMatrix(), ToString(), and Transpose().
Vector3D YAxis |
Y-axis vector of the rotation matrix.
Definition at line 30 of file RotationMatrix.h.
Referenced by ConvertCoordinateToVector(), Determinant(), Inverse(), IsEqual(), Multiply(), Multiply(), Normalize(), operator=(), ReadjustMatrix(), RotateX(), RotateY(), RotateZ(), RotationMatrix(), RotationMatrix(), RotationMatrix(), ToString(), and Transpose().
Vector3D ZAxis |
Z-axis vector of the rotation matrix.
Definition at line 31 of file RotationMatrix.h.
Referenced by ConvertCoordinateToVector(), Determinant(), Inverse(), IsEqual(), Multiply(), Multiply(), operator=(), ReadjustMatrix(), RotateX(), RotateY(), RotateZ(), RotationMatrix(), RotationMatrix(), RotationMatrix(), ToString(), and Transpose().