OGRE  1.9.0
OgrePlane.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE 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
43namespace Ogre {
44
62 {
63 public:
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
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
132
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
163
164} // namespace Ogre
165
166#endif
#define _OgreExport
A 3D box aligned with the x/y/z axes.
Real normalise(void)
Normalises the plane.
Side getSide(const AxisAlignedBox &rkBox) const
Returns the side where the alignedBox is.
Plane()
Default constructor - sets everything to 0.
Plane(const Plane &rhs)
Side getSide(const Vector3 &centre, const Vector3 &halfSize) const
Returns which side of the plane that the given box lies on.
bool operator==(const Plane &rhs) const
Comparison operator.
Definition OgrePlane.h:148
Plane(const Vector3 &rkNormal, Real fConstant)
Construct a plane through a normal, and a distance to move the plane along the normal.
void redefine(const Vector3 &rkPoint0, const Vector3 &rkPoint1, const Vector3 &rkPoint2)
Redefine this plane based on 3 points.
Vector3 normal
Definition OgrePlane.h:144
Vector3 projectVector(const Vector3 &v) const
Project a vector onto the plane.
Side getSide(const Vector3 &rkPoint) const
bool operator!=(const Plane &rhs) const
Definition OgrePlane.h:152
Plane(Real a, Real b, Real c, Real d)
Construct a plane using the 4 constants directly.
void redefine(const Vector3 &rkNormal, const Vector3 &rkPoint)
Redefine this plane based on a normal and a point.
Real getDistance(const Vector3 &rkPoint) const
This is a pseudodistance.
Side
The "positive side" of the plane is the half space to which the plane normal points.
Definition OgrePlane.h:81
Plane(const Vector3 &rkNormal, const Vector3 &rkPoint)
Plane(const Vector3 &rkPoint0, const Vector3 &rkPoint1, const Vector3 &rkPoint2)
Standard 3-dimensional vector.
Definition OgreVector3.h:52
vector< Plane >::type PlaneList
Definition OgrePlane.h:160
float Real
Software floating point type.
std::vector< T, A > type