MLIB
Loading...
Searching...
No Matches
rotmat.h
Go to the documentation of this file.
1#pragma once
8#if __has_include("defs.h")
9#include "defs.h"
10#endif
11
12namespace mlib {
13
15class RotMat
16{
17public:
19 RotMat ();
20
22 RotMat (double rx, double ry, double rz);
23
25 void x_rotation (double angle);
26
28 void y_rotation (double angle);
29
31 void z_rotation (double angle);
32
34 void rotate (double& x, double& y, double& z) const;
35
37 void rotate (double* vec) const;
38
40 double (&matrix ())[3][3];
41
42private:
43 double r[3][3];
44 void multiply (double m[3][3]);
45};
46
47inline double (&RotMat::matrix ())[3][3]
48{
49 return r;
50}
51
52} // namespace mlib
3D Rotation Calculator
Definition rotmat.h:16
void y_rotation(double angle)
Rotation by Y (pitch) axis.
Definition rotmat.cpp:40
void z_rotation(double angle)
Rotation by Z (yaw) axis.
Definition rotmat.cpp:48
RotMat()
Build an identity rotation matrix.
Definition rotmat.cpp:12
double(& matrix())[3]
Return reference to rotation matrix (3x3)
Definition rotmat.h:47
void x_rotation(double angle)
Rotation by X (roll) axis.
Definition rotmat.cpp:32
void rotate(double &x, double &y, double &z) const
Rotate a 3D point.
Definition rotmat.cpp:69