hx3d  1
2D/3D Simple Game Framework
vector_utils.hpp
1 /*
2  Vector helper methods.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_MATH_VECTORUTILS
22 #define HX3D_MATH_VECTORUTILS
23 
24 #include <glm/glm.hpp>
25 
26 namespace hx3d {
27 namespace math {
28 
38 glm::vec3 rotate(glm::vec3 vector, float angle, glm::vec3 axis);
39 
48 glm::vec2 cross(glm::vec2 vec, float v);
49 
58 glm::vec2 cross(float v, glm::vec2 vec);
59 
68 float cross(glm::vec2 vec1, glm::vec2 vec2);
69 
77 glm::vec2 normalize(glm::vec2 vec);
78 
86 float squareLength(glm::vec2 vec);
87 
96 float angleBetweenVecs(const glm::vec2 vec1, const glm::vec2 vec2);
97 
106 template <class T>
107 inline bool epsEqual(T v1, T v2);
108 
109 } /* math */
110 } /* hx3d */
111 
112 #include "hx3d/math/_inline/vector_utils.inl.hpp"
113 
114 #endif
bool epsEqual(T v1, T v2)
Test values equality with epsilon.
hx3d framework namespace
Definition: audio.hpp:26
float squareLength(glm::vec2 vec)
Compute the square length of a 2D vector.
glm::vec3 rotate(glm::vec3 vector, float angle, glm::vec3 axis)
Rotate a vector of an angle on one/multiple axis.
float angleBetweenVecs(const glm::vec2 vec1, const glm::vec2 vec2)
Compute the angle between two 2D vectors.
glm::vec2 normalize(glm::vec2 vec)
Normalize a 2D vector.
glm::vec2 cross(glm::vec2 vec, float v)
Calculate the cross product vector between a 2D vector and a scalar.