MLIB
Loading...
Searching...
No Matches
rotmat.h
Go to the documentation of this file.
1/*
2 Copyright (c) Mircea Neacsu (2014-2025) Licensed under MIT License.
3 This file is part of MLIB project. See LICENSE file for full license terms.
4*/
5
7
8#pragma once
9
10#if __has_include("defs.h")
11#include "defs.h"
12#endif
13
14namespace mlib {
15
17class RotMat
18{
19public:
21 RotMat ();
22
24 RotMat (double rx, double ry, double rz);
25
27 void x_rotation (double angle);
28
30 void y_rotation (double angle);
31
33 void z_rotation (double angle);
34
36 void rotate (double& x, double& y, double& z) const;
37
39 void rotate (double* vec) const;
40
42 double (&matrix ())[3][3];
43
44private:
45 double r[3][3];
46 void multiply (double m[3][3]);
47};
48
49inline double (&RotMat::matrix ())[3][3]
50{
51 return r;
52}
53
54} // namespace mlib
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:49
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