-
Notifications
You must be signed in to change notification settings - Fork 5
/
MathFunctions.hpp
47 lines (38 loc) · 1.1 KB
/
MathFunctions.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* MathFunctions.hpp
*
* Created on: 2014/10/18
* Author: Dimitri Kourkoulis
* http://dimitros.be
* License: BSD 3-Clause License (see LICENSE file)
*/
#pragma once
#include <dimitrikourk/glm/glm/glm.hpp>
/**
* @def ROUND_2_DECIMAL(x) (floorf(100 * x + 0.5) / 100)
*
* @brief A macro that rounds a floating point number to the second decimal digit.
*
* @param x The number to be rounded.
*/
#define ROUND_2_DECIMAL(x) (floorf(100 * x + 0.5) / 100)
namespace small3d {
/**
* Rotation transformation for rotating around the X axis
* @param angle The angle to rotate by, in radians.
* @return The X rotation matrix
*/
glm::mat4x4 rotateX(const float &angle);
/**
* Rotation transformation for rotating around the Y axis
* @param angle The angle to rotate by, in radians.
* @return The Y rotation matrix
*/
glm::mat4x4 rotateY(const float &angle);
/**
* Rotation transformation for rotating around the Z axis
* @param angle The angle to rotate by, in radians.
* @return The Z rotation matrix
*/
glm::mat4x4 rotateZ(const float &angle);
}