Loading...
Searching...
No Matches
Ogre::Plane Class Reference
Core » Math

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

`#include <OgrePlane.h>`

Inheritance diagram for Ogre::Plane:
[legend]

## 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.
| Plane (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
| Plane (const Vector3 &rkNormal, const Vector3 &rkPoint)
| Plane (const Vector3 &rkNormal, Real fConstant)
| Construct a plane through a normal, and a distance to move the plane along the normal.
| Plane (const Vector4 &v)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Plane (Real a, Real b, Real c, Real _d)
| Construct a plane using the 4 constants directly.
Real | getDistance (const Vector3 &rkPoint) const
| This is a pseudodistance.
Side | getSide (const AxisAlignedBox &box) const
| Returns the side where the alignedBox is.
Side | getSide (const Vector3 &centre, const Vector3 &halfSize) const
| Returns which side of the plane that the given box lies on.
Side | getSide (const Vector3 &rkPoint) const
Real | normalise (void)
| Normalises the plane.
bool | operator!= (const Plane &rhs) const
Plane | operator- () const
| Get flipped plane, with same location but reverted orientation.
bool | operator== (const Plane &rhs) const
| Comparison operator.
Vector3 | projectVector (const Vector3 &v) const
| Project a vector onto the plane.
void | redefine (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2)
| Redefine this plane based on 3 points.
void | redefine (const Vector3 &rkNormal, const Vector3 &rkPoint)
| Redefine this plane based on a normal and a point.

## Public Attributes

Real | d
Vector3 | normal

## Detailed Description

Defines a plane in 3D space.

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.

## Member Enumeration Documentation

## Side

enum Ogre::Plane::Side

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 |

## Constructor & Destructor Documentation

## Plane() [1/6]

Ogre::Plane::Plane | ( |  | ) |

inline

Default constructor - sets everything to 0.

References d, and normal.

Referenced by Ogre::MovablePlane::MovablePlane(), Ogre::PCPlane::PCPlane(), Ogre::MovablePlane::_getDerivedPlane(), operator!=(), operator-(), operator<<, operator==(), and Ogre::PCPlane::setFromOgrePlane().

## Plane() [2/6]

Ogre::Plane::Plane | ( | const Vector3 & | rkNormal,
|  | Real | fConstant )

inline

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

References d, and normal.

## Plane() [3/6]

Ogre::Plane::Plane | ( | Real | a,
|  | Real | b,
|  | Real | c,
|  | Real | _d )

inline

Construct a plane using the 4 constants directly.

References d, and normal.

## Plane() [4/6]

Ogre::Plane::Plane | ( | const Vector4 & | v | ) |

inline explicit

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References d, and normal.

## Plane() [5/6]

Ogre::Plane::Plane | ( | const Vector3 & | rkNormal,
|  | const Vector3 & | rkPoint )

inline

References redefine().

## Plane() [6/6]

Ogre::Plane::Plane | ( | const Vector3 & | p0,
|  | const Vector3 & | p1,
|  | const Vector3 & | p2 )

inline

References redefine().

## Member Function Documentation

## getSide() [1/3]

Side Ogre::Plane::getSide | ( | const Vector3 & | rkPoint | ) | const

inline

References getDistance(), NEGATIVE_SIDE, NO_SIDE, and POSITIVE_SIDE.

Referenced by getSide(), Ogre::Math::intersects(), and Ogre::PlaneBoundedVolume::intersects().

## getSide() [2/3]

Side Ogre::Plane::getSide | ( | const AxisAlignedBox & | box | ) | const

inline

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.

References BOTH_SIDE, Ogre::AxisAlignedBox::getCenter(), Ogre::AxisAlignedBox::getHalfSize(), getSide(), Ogre::AxisAlignedBox::isInfinite(), Ogre::AxisAlignedBox::isNull(), and NO_SIDE.

## getSide() [3/3]

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

inline

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

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

Parameters

  centre | The centre of the box.
  halfSize | The 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.

References BOTH_SIDE, getDistance(), NEGATIVE_SIDE, normal, and POSITIVE_SIDE.

## getDistance()

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

inline

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.

References d, and normal.

Referenced by getSide(), getSide(), Ogre::PlaneBoundedVolume::intersects(), and Ogre::Sphere::intersects().

## redefine() [1/2]

void Ogre::Plane::redefine | ( | const Vector3 & | p0,
|  | const Vector3 & | p1,
|  | const Vector3 & | p2 )

inline

Redefine this plane based on 3 points.

References Ogre::Math::calculateBasicFaceNormal(), d, and normal.

Referenced by Plane(), and Plane().

## redefine() [2/2]

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

inline

Redefine this plane based on a normal and a point.

References d, Ogre::Vector< dims, T >::dotProduct(), and normal.

## projectVector()

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

inline

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

  v | The input vector

References normal.

## normalise()

Real Ogre::Plane::normalise | ( | void |  | ) |

inline

Normalises the plane.

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.

References d, and normal.

## operator-()

Plane Ogre::Plane::operator- | ( |  | ) | const

inline

Get flipped plane, with same location but reverted orientation.

References Plane(), d, and normal.

## operator==()

bool Ogre::Plane::operator== | ( | const Plane & | rhs | ) | const

inline

Comparison operator.

References Plane(), d, and normal.

## operator!=()

bool Ogre::Plane::operator!= | ( | const Plane & | rhs | ) | const

inline

References Plane(), d, and normal.

## Member Data Documentation

## normal

Vector3 Ogre::Plane::normal

Referenced by Plane(), Plane(), Plane(), Plane(), getDistance(), getSide(), Ogre::Ray::intersects(), normalise(), operator!=(), Ogre::operator*(), operator-(), operator<<, Ogre::StaticFaceGroup::operator<<, operator==(), projectVector(), redefine(), and redefine().

## d

Real Ogre::Plane::d

Referenced by Plane(), Plane(), Plane(), Plane(), getDistance(), Ogre::Ray::intersects(), normalise(), operator!=(), Ogre::operator*(), operator-(), operator<<, operator==(), redefine(), and redefine().

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

- OgrePlane.h