Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
math_utils.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef mathutils_INCLUDE_ONCE
33 #define mathutils_INCLUDE_ONCE
34 
35 #include <vlCore/glsl_math.hpp>
36 #include <vlCore/Plane.hpp>
37 #include <cstdio>
38 #include <memory.h>
39 #include <vector>
40 
41 namespace vl
42 {
46  VLCORE_EXPORT real random(real min, real max);
47 
52 
57 
62 
67 
71  VLCORE_EXPORT void extractPlanes( Plane* planes, const mat4& modelviewproj );
72 }
73 
74 #endif
VLCORE_EXPORT i32 randomI32(i32 min, i32 max)
Returns a random number N between &#39;min&#39; and &#39;max&#39; (included) generated using MersenneTwister->randInt...
Definition: math_utils.cpp:55
VLCORE_EXPORT void extractPlanes(Plane *planes, const mat4 &modelviewproj)
Extracts the 6 frustum planes for the given model-view-projection matrix.
Definition: math_utils.cpp:82
int i32
32 bits signed integer
Definition: std_types.hpp:49
VLCORE_EXPORT real random(real min, real max)
Returns a random number N between &#39;min&#39; and &#39;max&#39; (included) with 53 bits of randomness generated usi...
Definition: math_utils.cpp:44
VLCORE_EXPORT u32 randomU32(u32 min, u32 max)
Returns a random number N between &#39;min&#39; and &#39;max&#39; (included) generated using MersenneTwister->randInt...
Definition: math_utils.cpp:50
Visualization Library main namespace.
float max(float a, float b)
Definition: Vector2.hpp:311
float min(float a, float b)
Definition: Vector2.hpp:307
unsigned int u32
32 bits unsigned integer
Definition: std_types.hpp:51
Implements the OpenGL Shading Language convenience functions for scalar and vector operations...
fmat4 mat4
Defined as: &#39;typedef fmat4 mat4&#39;. See also VL_PIPELINE_PRECISION.
Definition: Matrix4.hpp:1240
VLCORE_EXPORT int greaterEqualPow2(int n)
Returns a number N that is a power of 2 and that is equal to or greater than &#39;n&#39;. ...
Definition: math_utils.cpp:60
VLCORE_EXPORT int smallerEqualPow2(int n)
Returns a number N that is a power of 2 and that is equal to or smaller than &#39;n&#39;. ...
Definition: math_utils.cpp:71