OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgrePlane.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 // This file is based on material originally from:
29 // Geometric Tools, LLC
30 // Copyright (c) 1998-2010
31 // Distributed under the Boost Software License, Version 1.0.
32 // http://www.boost.org/LICENSE_1_0.txt
33 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
34 
35 
36 #ifndef __Plane_H__
37 #define __Plane_H__
38 
39 #include "OgrePrerequisites.h"
40 
41 #include "OgreVector3.h"
42 
43 namespace Ogre {
44 
62  {
63  public:
66  Plane ();
67  Plane (const Plane& rhs);
69  Plane (const Vector3& rkNormal, Real fConstant);
71  Plane (Real a, Real b, Real c, Real d);
72  Plane (const Vector3& rkNormal, const Vector3& rkPoint);
73  Plane (const Vector3& rkPoint0, const Vector3& rkPoint1,
74  const Vector3& rkPoint2);
75 
80  enum Side
81  {
85  BOTH_SIDE
86  };
87 
88  Side getSide (const Vector3& rkPoint) const;
89 
94  Side getSide (const AxisAlignedBox& rkBox) const;
95 
105  Side getSide (const Vector3& centre, const Vector3& halfSize) const;
106 
115  Real getDistance (const Vector3& rkPoint) const;
116 
118  void redefine(const Vector3& rkPoint0, const Vector3& rkPoint1,
119  const Vector3& rkPoint2);
120 
122  void redefine(const Vector3& rkNormal, const Vector3& rkPoint);
123 
131  Vector3 projectVector(const Vector3& v) const;
132 
142  Real normalise(void);
143 
146 
148  bool operator==(const Plane& rhs) const
149  {
150  return (rhs.d == d && rhs.normal == normal);
151  }
152  bool operator!=(const Plane& rhs) const
153  {
154  return (rhs.d != d || rhs.normal != normal);
155  }
156 
157  _OgreExport friend std::ostream& operator<< (std::ostream& o, const Plane& p);
158  };
159 
164 } // namespace Ogre
165 
166 #endif
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
Defines a plane in 3D space.
Definition: OgrePlane.h:61
A 3D box aligned with the x/y/z axes.
vector< Plane >::type PlaneList
Definition: OgrePlane.h:160
bool operator!=(const Plane &rhs) const
Definition: OgrePlane.h:152
Side
The "positive side" of the plane is the half space to which the plane normal points.
Definition: OgrePlane.h:80
bool operator==(const Plane &rhs) const
Comparison operator.
Definition: OgrePlane.h:148
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
std::ostream & operator<<(std::ostream &o, const TRect< T > &r)
Definition: OgreCommon.h:666
Vector3 normal
Definition: OgrePlane.h:144