This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
maths_utils.h
81 lines (68 loc) · 2.06 KB
/
maths_utils.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef _MATHS_UTILS_H
#define _MATHS_UTILS_H
namespace MathsUtils
{
const unsigned int VERTEX_ELEMENTS_NB = 6;
/**
* @brief Reassemble all elements of a vertex in a dedicated type
* Contains, in the following order: x, y, z (position, in 3D), r, g, b (RGB colors)
*/
typedef float vertex[VERTEX_ELEMENTS_NB];
/**
* @brief Returns the x position accessor in a 3 dimensional vector
*
* @param v - the vertex array
* @return The x position
*/
const float x(const vertex *v);
/**
* @brief Returns the y position accessor in a 3 dimensional vector
*
* @param v - the vertex array
* @return The y position
*/
const float y(const vertex *v);
/**
* @brief Returns the z position accessor in a 3 dimensional vector
*
* @param v - the vertex array
* @return The z position
*/
const float z(const vertex *v);
/**
* @brief Returns the red (in RGB) color accessor
*
* @param v - the vertex array
* @return The red (in RGB) color accessor
*/
const float r(const vertex *v);
/**
* @brief Returns the green (in RGB) color accessor
*
* @param v - the vertex array
* @return The green (in RGB) color accessor
*/
const float g(const vertex *v);
/**
* @brief Returns the blue (in RGB) color accessor
*
* @param v - the vertex array
* @return The blue (in RGB) color accessor
*/
const float b(const vertex *v);
/**
* @brief Returns the number of individual vertex arrays inside a vertices array
*
* @param vertices - an array of vertex
* @return The number of the individual vertex arrays
*/
const unsigned int getNbVertex(const vertex vertices[]);
/**
* @brief Sums and returns the number of individual elements stored in the vertices array
*
* @param vertices - an array of vertex
* @return The sum of all individual elements stored in the vertices array
*/
const unsigned int getNbElements(const vertex vertices[]);
}
#endif