OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::Plane Class Reference

Defines a plane in 3D space. More...

#include <OgrePlane.h>

+ Inheritance diagram for Ogre::Plane:
+ Collaboration diagram for Ogre::Plane:

Public Types

enum  Side { NO_SIDE, POSITIVE_SIDE, NEGATIVE_SIDE, BOTH_SIDE }
 The "positive side" of the plane is the half space to which the plane normal points. More...
 

Public Member Functions

 Plane ()
 Default constructor - sets everything to 0. More...
 
 Plane (const Plane &rhs)
 
 Plane (const Vector3 &rkNormal, Real fConstant)
 Construct a plane through a normal, and a distance to move the plane along the normal. More...
 
 Plane (Real a, Real b, Real c, Real d)
 Construct a plane using the 4 constants directly. More...
 
 Plane (const Vector3 &rkNormal, const Vector3 &rkPoint)
 
 Plane (const Vector3 &rkPoint0, const Vector3 &rkPoint1, const Vector3 &rkPoint2)
 
Real getDistance (const Vector3 &rkPoint) const
 This is a pseudodistance. More...
 
Side getSide (const Vector3 &rkPoint) const
 
Side getSide (const AxisAlignedBox &rkBox) const
 Returns the side where the alignedBox is. More...
 
Side getSide (const Vector3 &centre, const Vector3 &halfSize) const
 Returns which side of the plane that the given box lies on. More...
 
Real normalise (void)
 Normalises the plane. More...
 
bool operator!= (const Plane &rhs) const
 
bool operator== (const Plane &rhs) const
 Comparison operator. More...
 
Vector3 projectVector (const Vector3 &v) const
 Project a vector onto the plane. More...
 
void redefine (const Vector3 &rkPoint0, const Vector3 &rkPoint1, const Vector3 &rkPoint2)
 Redefine this plane based on 3 points. More...
 
void redefine (const Vector3 &rkNormal, const Vector3 &rkPoint)
 Redefine this plane based on a normal and a point. More...
 

Public Attributes

Real d
 
Vector3 normal
 

Friends

_OgreExport friend std::ostream & operator<< (std::ostream &o, const Plane &p)
 

Detailed Description

Defines a plane in 3D space.

Remarks
A plane is defined in 3D space by the equation Ax + By + Cz + D = 0
This equates to a vector (the normal of the plane, whose x, y and z components equate to the coefficients A, B and C respectively), and a constant (D) which is the distance along the normal you have to go to move the plane back to the origin.

Definition at line 61 of file OgrePlane.h.

Member Enumeration Documentation

The "positive side" of the plane is the half space to which the plane normal points.

The "negative side" is the other half space. The flag "no side" indicates the plane itself.

Enumerator
NO_SIDE 
POSITIVE_SIDE 
NEGATIVE_SIDE 
BOTH_SIDE 

Definition at line 80 of file OgrePlane.h.

Constructor & Destructor Documentation

Ogre::Plane::Plane ( )

Default constructor - sets everything to 0.

Ogre::Plane::Plane ( const Plane rhs)
Ogre::Plane::Plane ( const Vector3 rkNormal,
Real  fConstant 
)

Construct a plane through a normal, and a distance to move the plane along the normal.

Ogre::Plane::Plane ( Real  a,
Real  b,
Real  c,
Real  d 
)

Construct a plane using the 4 constants directly.

Ogre::Plane::Plane ( const Vector3 rkNormal,
const Vector3 rkPoint 
)
Ogre::Plane::Plane ( const Vector3 rkPoint0,
const Vector3 rkPoint1,
const Vector3 rkPoint2 
)

Member Function Documentation

Real Ogre::Plane::getDistance ( const Vector3 rkPoint) const

This is a pseudodistance.

The sign of the return value is positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane.

The absolute value of the return value is the true distance only when the plane normal is a unit length vector.

Referenced by Ogre::PlaneBoundedVolume::intersects().

Side Ogre::Plane::getSide ( const Vector3 rkPoint) const
Side Ogre::Plane::getSide ( const AxisAlignedBox rkBox) const

Returns the side where the alignedBox is.

The flag BOTH_SIDE indicates an intersecting box. One corner ON the plane is sufficient to consider the box and the plane intersecting.

Side Ogre::Plane::getSide ( const Vector3 centre,
const Vector3 halfSize 
) const

Returns which side of the plane that the given box lies on.

The box is defined as centre/half-size pairs for effectively.

Parameters
centreThe centre of the box.
halfSizeThe half-size of the box.
Returns
POSITIVE_SIDE if the box complete lies on the "positive side" of the plane, NEGATIVE_SIDE if the box complete lies on the "negative side" of the plane, and BOTH_SIDE if the box intersects the plane.
Real Ogre::Plane::normalise ( void  )

Normalises the plane.

Remarks
This method normalises the plane's normal and the length scale of d is as well.
Note
This function will not crash for zero-sized vectors, but there will be no changes made to their components.
Returns
The previous length of the plane's normal.
bool Ogre::Plane::operator!= ( const Plane rhs) const
inline

Definition at line 152 of file OgrePlane.h.

References d, and normal.

bool Ogre::Plane::operator== ( const Plane rhs) const
inline

Comparison operator.

Definition at line 148 of file OgrePlane.h.

References d, and normal.

Vector3 Ogre::Plane::projectVector ( const Vector3 v) const

Project a vector onto the plane.

Remarks
This gives you the element of the input vector that is perpendicular to the normal of the plane. You can get the element which is parallel to the normal of the plane by subtracting the result of this method from the original vector, since parallel + perpendicular = original.
Parameters
vThe input vector
void Ogre::Plane::redefine ( const Vector3 rkPoint0,
const Vector3 rkPoint1,
const Vector3 rkPoint2 
)

Redefine this plane based on 3 points.

void Ogre::Plane::redefine ( const Vector3 rkNormal,
const Vector3 rkPoint 
)

Redefine this plane based on a normal and a point.

Friends And Related Function Documentation

_OgreExport friend std::ostream& operator<< ( std::ostream &  o,
const Plane p 
)
friend

Member Data Documentation

Real Ogre::Plane::d

Definition at line 145 of file OgrePlane.h.

Referenced by operator!=(), Ogre::Matrix4::operator*(), and operator==().

Vector3 Ogre::Plane::normal

Definition at line 144 of file OgrePlane.h.

Referenced by operator!=(), Ogre::Matrix4::operator*(), and operator==().


The documentation for this class was generated from the following file: