NGL  6.5
The NCCA Graphics Library
Plane.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 PLANE_H_
18 #define PLANE_H_
19 //----------------------------------------------------------------------------------------------------------------------
22 //----------------------------------------------------------------------------------------------------------------------
23 // must include types.h first for Real and GLEW if required
24 #include "Types.h"
25 #include "Vec3.h"
26 
27 //----------------------------------------------------------------------------------------------------------------------
34 
35 //----------------------------------------------------------------------------------------------------------------------
36 
37 
38 namespace ngl
39 {
40 
42 {
43 public :
44  //----------------------------------------------------------------------------------------------------------------------
49  //----------------------------------------------------------------------------------------------------------------------
50  Plane( const Vec3 &_v1,const Vec3 &_v2,const Vec3 &_v3 ) noexcept;
51 
52  //----------------------------------------------------------------------------------------------------------------------
54  //----------------------------------------------------------------------------------------------------------------------
55  Plane() noexcept;
56  //----------------------------------------------------------------------------------------------------------------------
58  //----------------------------------------------------------------------------------------------------------------------
59  ~Plane() noexcept;
60  //----------------------------------------------------------------------------------------------------------------------
65  //----------------------------------------------------------------------------------------------------------------------
66  void setPoints(const Vec3 &_v1,const Vec3 &_v2,const Vec3 &_v3) noexcept;
67  //----------------------------------------------------------------------------------------------------------------------
71  //----------------------------------------------------------------------------------------------------------------------
72  void setNormalPoint(const Vec3 &_normal,const Vec3 &_point) noexcept;
73  //----------------------------------------------------------------------------------------------------------------------
79 
80  //----------------------------------------------------------------------------------------------------------------------
81  void setFloats( Real _a, Real _b, Real _c, Real _d ) noexcept;
82  //----------------------------------------------------------------------------------------------------------------------
86  //----------------------------------------------------------------------------------------------------------------------
87  Real distance(const Vec3 &_p) const noexcept;
88 
89  //----------------------------------------------------------------------------------------------------------------------
92  //----------------------------------------------------------------------------------------------------------------------
93  Vec3 getNormal()const noexcept{return m_normal;}
94 
95  //----------------------------------------------------------------------------------------------------------------------
98  //----------------------------------------------------------------------------------------------------------------------
99  Vec3 getPoint()const noexcept{return m_point;}
100  //----------------------------------------------------------------------------------------------------------------------
103  //----------------------------------------------------------------------------------------------------------------------
104  Real getD()const noexcept{return m_d;}
105 
106 
107 private :
108  //----------------------------------------------------------------------------------------------------------------------
110  //----------------------------------------------------------------------------------------------------------------------
112  //----------------------------------------------------------------------------------------------------------------------
114  //----------------------------------------------------------------------------------------------------------------------
116  //----------------------------------------------------------------------------------------------------------------------
118  //----------------------------------------------------------------------------------------------------------------------
120 
121 };
122 
123 
124 } //end of NGL namespace
125 #endif
126 
127 
128 
129 
Real m_d
the co-efficient of the plane
Definition: Plane.h:119
Vec3 m_normal
the normal of the plane
Definition: Plane.h:111
main definition of types and namespace
#define NGL_DLLEXPORT
Definition: Types.h:65
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
Real getD() const noexcept
accesor to get D
Definition: Plane.h:104
a simple 3 tuple container for compatibility with glsl
GLsizei GLsizei GLfloat distance
Definition: glew.h:13921
Vec3 getNormal() const noexcept
accesor to get the normal
Definition: Plane.h:93
Vec3 getPoint() const noexcept
accesor to get the point
Definition: Plane.h:99
Vec3 m_point
the point position of the normal / plane
Definition: Plane.h:115