Main Page   Modules   Class Hierarchy   Compound List   Compound Members  

GAUGE3D::GPlane Class Reference

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

#include <gauge3d/3dmath/plane.h>

List of all members.

Public Methods

 GPlane ()
 Creates an uninitialized plane.

 GPlane (const GVector &point,const GVector &normal)
 Creates a plane with the given normal that contains the given point.

 GPlane (const GVector &normal,GCoordinate _d)
 Initialized n and d to the given values.

bool IsFacing (const GVector &point)const
 Returns true if the plane is facing the point. More...

bool FindIntersection (GVector *result,const GLine &line)const
 Finds the intersection between the plane and a line. More...

bool FindIntersection (GLine *result,const GPlane &other)const
 Finds the intersection between two planes. More...

bool FindIntersection (GVector *result,const GPlane &other1,GPlane &other2)const
 Finds the intersection between three planes. More...

bool Contains (const GVector &point)const
 Returns true if the point is on the plane.

GCoordinate FindDistance (const GVector &point)const
 Finds the shortest distance between the plane and the point.

GCoordinate FindSquareDistance (const GVector &point)const
 Finds the square of the shortest distance between the plane and the point (faster). More...

const GPlane& operator+= (const GVector &vec)
 Moves the plane a certain distance.

const GPlane& operator-= (const GVector &vec)
 Moves the plane a certain distance.


Public Attributes

GVector n
 Normal vector to plane.

GCoordinate d
 Umm... d... it's d... yeah...


Detailed Description

Represents a plane in 3D space.

The plane is represented as a normal vector and a scalar so that n * p + d = 0 for all points p on the plane.


Member Function Documentation

bool GAUGE3D::GPlane::IsFacing ( const GVector & point ) const [inline]
 

Returns true if the plane is facing the point.

The plane is considered to be "facing" the point if the normal vector of the plane points in the direction of the point from any point on the plane. In other (non-)words: (point * n + d >= 0)

bool GAUGE3D::GPlane::FindIntersection ( GVector * result,
const GLine & line ) const
 

Finds the intersection between the plane and a line.

Parameters:
result   Pointer to a vector which should be overwritten with the point of intersection. If NULL, it will not be overwritten.
line   The line with which to test for intersection.
Returns:
True if a point of intersection was found, or false if the line and plane did not intersect or if the line was on the plane.

bool GAUGE3D::GPlane::FindIntersection ( GLine * result,
const GPlane & other ) const
 

Finds the intersection between two planes.

Parameters:
result   Pointer to a line which should be overwritten with the line of intersection. If NULL, it will not be overwritten.
other   The plane with which to test for intersection.
Returns:
True if a line of intersection was found, or false if the planes did not intersect or if they were equal.

bool GAUGE3D::GPlane::FindIntersection ( GVector * result,
const GPlane & other1,
GPlane & other2 ) const
 

Finds the intersection between three planes.

Parameters:
result   Pointer to a point which should be overwritten with the point of intersection. If NULL, it will not be overwritten.
other1   One of the two planes with which to test for intersection.
other2   The other of the two planes with which to test for intersection.
Returns:
True if a point of intersection was found, or false if the planes did not intersect or if two or more of them were equal.

GCoordinate GAUGE3D::GPlane::FindSquareDistance ( const GVector & point ) const
 

Finds the square of the shortest distance between the plane and the point (faster).

This is faster because the square root of the result does not need to be found.


The documentation for this class was generated from the following file:
Generated at Tue Jan 30 17:07:34 2001 for gauge3d by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000