Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

salt::Plane Class Reference

A mathematical plane is modeled by this class. More...

#include <plane.h>

Collaboration diagram for salt::Plane:

Collaboration graph
[legend]
List of all members.

Public Member Functions

f_inline Plane ()
 empty constructor for an undefined plane
f_inline Plane (const Vector3f &norm, const Vector3f &pnt)
 constructs a plane from a normal and a point on the plane
f_inline Plane (const Vector3f &norm, const float D)
 constructs a plane from normal and constant D.
f_inline Plane (const Vector3f &v1, const Vector3f &v2, const Vector3f &v3)
 constructs a plane from 3 distinct points
f_inline EPlaneSide GetOrientation (const Vector3f &v, float delta=0.0001f) const
 calculates the orientation of v to the plane
f_inline EPlane GetDominantPlane () const
 calculates the dominant plane
f_inline float GetDistanceTo (const Vector3f &v) const
 calculates the distance from v to the plane
EPlaneSide ClassifyBox (const AABB3 &bb) const
 calculates the relationship between the plane and the box
void Normalize ()
 normalizes the plane
f_inline void Set (const Vector3f &norm, const Vector3f &pnt)
 sets up a plane from a normal and a point on the plane
f_inline void Set (const Vector3f &norm, const float D)
 sets up a plane from normal and constant D.
f_inline void Set (const Vector3f &v1, const Vector3f &v2, const Vector3f &v3)
 sets up a plane from 3 distinct points
f_inline const Planeoperator= (const Plane &p)
 the assignment operator for planes

Public Attributes

Vector3f normal
 the normal vector of the modeled plane
float d
 the distance

Detailed Description

A mathematical plane is modeled by this class.

It can be used to classify points against planes (in front, on plane, etc...). Several useful functions for constructing a plane are provided. A plane is defined by the formula. Ax+By+Cz+D=0. The vector formed by the coefficients <A,B,C> is the normal vector to the plane.

Definition at line 71 of file plane.h.


Constructor & Destructor Documentation

f_inline salt::Plane::Plane  )  [inline]
 

empty constructor for an undefined plane

Definition at line 84 of file plane.h.

f_inline salt::Plane::Plane const Vector3f norm,
const Vector3f pnt
[inline]
 

constructs a plane from a normal and a point on the plane

Definition at line 87 of file plane.h.

References d, normal, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Here is the call graph for this function:

f_inline salt::Plane::Plane const Vector3f norm,
const float  D
[inline]
 

constructs a plane from normal and constant D.

If normal is a unit vector, then D is the distance to the origin

Definition at line 92 of file plane.h.

References d, and normal.

f_inline salt::Plane::Plane const Vector3f v1,
const Vector3f v2,
const Vector3f v3
[inline]
 

constructs a plane from 3 distinct points

Definition at line 95 of file plane.h.

References salt::TVector3< DATATYPE, TYPE >::Cross(), d, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), normal, and salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalized().

Here is the call graph for this function:


Member Function Documentation

EPlaneSide Plane::ClassifyBox const AABB3 bb  )  const
 

calculates the relationship between the plane and the box

Definition at line 25 of file plane.cpp.

References GetOrientation(), salt::AABB3::maxVec, salt::AABB3::minVec, normal, salt::PLANESIDE_BACK, salt::PLANESIDE_FRONT, salt::PLANESIDE_SPLIT, salt::TVector3< DATATYPE, TYPE >::Set(), salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Referenced by salt::Frustum::Intersects().

Here is the call graph for this function:

f_inline float salt::Plane::GetDistanceTo const Vector3f v  )  const [inline]
 

calculates the distance from v to the plane

Definition at line 106 of file plane.h.

References d, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), and normal.

Here is the call graph for this function:

f_inline EPlane salt::Plane::GetDominantPlane  )  const [inline]
 

calculates the dominant plane

Definition at line 103 of file plane.h.

References salt::gAbs(), normal, salt::PLANE_XY, salt::PLANE_XZ, salt::PLANE_YZ, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Here is the call graph for this function:

f_inline EPlaneSide salt::Plane::GetOrientation const Vector3f v,
float  delta = 0.0001f
const [inline]
 

calculates the orientation of v to the plane

Definition at line 100 of file plane.h.

References d, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), normal, salt::PLANESIDE_BACK, salt::PLANESIDE_FRONT, and salt::PLANESIDE_ONPLANE.

Referenced by ClassifyBox().

Here is the call graph for this function:

void Plane::Normalize  ) 
 

normalizes the plane

Definition at line 86 of file plane.cpp.

References d, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), normal, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Referenced by oxygen::Camera::DescribeFrustum(), and salt::Frustum::Set().

Here is the call graph for this function:

f_inline const Plane& salt::Plane::operator= const Plane p  )  [inline]
 

the assignment operator for planes

Definition at line 129 of file plane.h.

References d, and normal.

f_inline void salt::Plane::Set const Vector3f v1,
const Vector3f v2,
const Vector3f v3
[inline]
 

sets up a plane from 3 distinct points

Definition at line 126 of file plane.h.

References salt::TVector3< DATATYPE, TYPE >::Cross(), d, salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), normal, and salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalized().

Here is the call graph for this function:

f_inline void salt::Plane::Set const Vector3f norm,
const float  D
[inline]
 

sets up a plane from normal and constant D.

If normal is a unit vector, then D is the distance to the origin

Definition at line 123 of file plane.h.

References d, and normal.

f_inline void salt::Plane::Set const Vector3f norm,
const Vector3f pnt
[inline]
 

sets up a plane from a normal and a point on the plane

Definition at line 117 of file plane.h.

References d, normal, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Here is the call graph for this function:


Member Data Documentation

float salt::Plane::d
 

the distance

Definition at line 79 of file plane.h.

Referenced by oxygen::Camera::DescribeFrustum(), salt::Frustum::Dump(), GetDistanceTo(), GetOrientation(), Normalize(), operator=(), Plane(), Set(), and salt::Frustum::Set().

Vector3f salt::Plane::normal
 

the normal vector of the modeled plane

Definition at line 76 of file plane.h.

Referenced by ClassifyBox(), oxygen::Camera::DescribeFrustum(), salt::Frustum::Dump(), GetDistanceTo(), GetDominantPlane(), GetOrientation(), Normalize(), operator=(), Plane(), Set(), and salt::Frustum::Set().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:49:21 2006 for rcssserver3d by  doxygen 1.4.4