omegalib  13.1
omicron::Plane Class Reference

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

#include <Plane.h>

Public Member Functions

 Plane ()
 Default constructor - sets everything to 0. More...
 
 Plane (const Plane &rhs)
 
 Plane (const Vector3f &rkNormal, float fConstant)
 Construct a plane through a normal, and a distance to move the plane along the normal. More...
 
 Plane (float a, float b, float c, float d)
 Construct a plane using the 4 constants directly. More...
 
 Plane (const Vector3f &rkNormal, const Vector3f &rkPoint)
 
 Plane (const Vector3f &rkPoint0, const Vector3f &rkPoint1, const Vector3f &rkPoint2)
 
PlaneSide getSide (const Vector3f &rkPoint) const
 
PlaneSide getSide (const Vector3f &centre, const Vector3f &halfSize) const
 returns the side where the aligneBox is. More...
 
float getDistance (const Vector3f &rkPoint) const
 This is a pseudodistance. More...
 
void redefine (const Vector3f &rkPoint0, const Vector3f &rkPoint1, const Vector3f &rkPoint2)
 Redefine this plane based on 3 points. More...
 
void redefine (const Vector3f &rkNormal, const Vector3f &rkPoint)
 Redefine this plane based on a normal and a point. More...
 
Vector3f projectVector (const Vector3f &v) const
 Project a vector onto the plane. More...
 
float normalise (void)
 Normalises the plane. More...
 
bool operator== (const Plane &rhs) const
 Comparison operator. More...
 
bool operator!= (const Plane &rhs) const
 

Public Attributes

Vector3f normal
 
float d
 

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.

Constructor & Destructor Documentation

omicron::Plane::Plane ( )
inline

Default constructor - sets everything to 0.

omicron::Plane::Plane ( const Plane rhs)
inline
omicron::Plane::Plane ( const Vector3f rkNormal,
float  fConstant 
)
inline

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

omicron::Plane::Plane ( float  a,
float  b,
float  c,
float  d 
)
inline

Construct a plane using the 4 constants directly.

omicron::Plane::Plane ( const Vector3f rkNormal,
const Vector3f rkPoint 
)
inline
omicron::Plane::Plane ( const Vector3f rkPoint0,
const Vector3f rkPoint1,
const Vector3f rkPoint2 
)
inline

Member Function Documentation

float omicron::Plane::getDistance ( const Vector3f 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.
PlaneSide omicron::Plane::getSide ( const Vector3f rkPoint) const
inline
PlaneSide omicron::Plane::getSide ( const Vector3f centre,
const Vector3f halfSize 
) const
inline

returns the side where the aligneBox is.

the flag BOTH_SIDE indicates an intersecting box. one corner ON the plane is sufficient to consider the box and the plane intersecting. 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.
float omicron::Plane::normalise ( void  )
inline

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 omicron::Plane::operator!= ( const Plane rhs) const
inline
bool omicron::Plane::operator== ( const Plane rhs) const
inline

Comparison operator.

Vector3f omicron::Plane::projectVector ( const Vector3f 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
vThe input vector
void omicron::Plane::redefine ( const Vector3f rkPoint0,
const Vector3f rkPoint1,
const Vector3f rkPoint2 
)
inline

Redefine this plane based on 3 points.

void omicron::Plane::redefine ( const Vector3f rkNormal,
const Vector3f rkPoint 
)
inline

Redefine this plane based on a normal and a point.

Member Data Documentation

float omicron::Plane::d
Vector3f omicron::Plane::normal

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