NGL  6.5
The NCCA Graphics Library
AABB.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef AABB_H_
18 #define AABB_H_
19 //----------------------------------------------------------------------------------------------------------------------
22 //----------------------------------------------------------------------------------------------------------------------
23 // must include types.h first for Real and GLEW if required
24 #include "Types.h"
25 #include "Vec4.h"
26 #include "BBox.h"
27 
28 //----------------------------------------------------------------------------------------------------------------------
35 
36 //----------------------------------------------------------------------------------------------------------------------
37 
38 
39 namespace ngl
40 {
41 
43 {
44 friend class BBox;
45 public :
46  //----------------------------------------------------------------------------------------------------------------------
52  //----------------------------------------------------------------------------------------------------------------------
53  AABB(const Vec4 &_corner,Real _x,Real _y, Real _z) noexcept;
54 
55  //----------------------------------------------------------------------------------------------------------------------
57  //----------------------------------------------------------------------------------------------------------------------
58  AABB() noexcept;
59  //----------------------------------------------------------------------------------------------------------------------
61  //----------------------------------------------------------------------------------------------------------------------
62  ~AABB();
63  //----------------------------------------------------------------------------------------------------------------------
69  //----------------------------------------------------------------------------------------------------------------------
70  void set(const Vec4 &_corner,Real _x, Real _y, Real _z) noexcept;
71 
72  //----------------------------------------------------------------------------------------------------------------------
75  //----------------------------------------------------------------------------------------------------------------------
76  void setFromBBox(const BBox &_b) noexcept;
77  //----------------------------------------------------------------------------------------------------------------------
78 
79  // for use in frustum computations
80  Vec3 getVertexP(const Vec3 &_normal) const noexcept;
81  Vec3 getVertexN(const Vec3 &_normal) const noexcept;
82 private :
83  //----------------------------------------------------------------------------------------------------------------------
84  Vec4 m_corner;
85  //----------------------------------------------------------------------------------------------------------------------
86  Real m_x;
87  Real m_y;
88  Real m_z;
89 };
90 
91 
92 } //end of NGL namespace
93 #endif
94 
95 
96 
97 
simple Vector class for OpenGL graphics, contains overloaded operators for most math functions...
Definition: Vec4.h:57
main definition of types and namespace
#define NGL_DLLEXPORT
Definition: Types.h:65
Definition: AABB.h:42
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
Definition: Vec3.h:51
implementation files for RibExport class
Definition: AABB.cpp:22
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
Definition: Types.h:127
encapsulates a 4d Homogenous Point / Vector object
Simple Bounding box class used in various parts of ngl and other example programs.
Definition: BBox.h:40
a simple bounding box class