csPlane3 Class Reference
[Geometry utilities]
A plane in 3D space.
More...
#include <plane3.h>
Public Methods | |
csPlane3 () | |
Initialize to the xy plane (0,0,1,0). | |
csPlane3 (const csVector3 &plane_norm, float d=0) | |
Initialize the plane with the given norm and D component. | |
csPlane3 (float a, float b, float c, float d=0) | |
Initialize the plane to the given components. | |
csPlane3 (const csVector3 &v1, const csVector3 &v2, const csVector3 &v3) | |
Initialize the plane through the three given points. | |
csPlane3 (const csVector3 &v2, const csVector3 &v3) | |
Initialize the plane through 0 and the two given points. | |
csVector3 & | Normal () |
Return the normal vector of this plane. | |
const csVector3 & | Normal () const |
Return the normal vector of this plane. | |
float | A () const |
Return the A component of this plane. | |
float | B () const |
Return the B component of this plane. | |
float | C () const |
Return the C component of this plane. | |
float | D () const |
Return the D component of this plane. | |
float & | A () |
Return the A component of this plane. | |
float & | B () |
Return the B component of this plane. | |
float & | C () |
Return the C component of this plane. | |
float & | D () |
Return the D component of this plane. | |
void | Set (float a, float b, float c, float d) |
Set the value of the four plane components. | |
void | Set (const csVector3 &normal, float d) |
Set the value of the plane using a normal and D component. | |
void | Set (const csVector3 &v1, const csVector3 &v2, const csVector3 &v3) |
Initialize the plane through the three given points. | |
void | Set (const csVector3 &v2, const csVector3 &v3) |
Initialize the plane through 0 and the two given points. | |
float | Classify (const csVector3 &pt) const |
Classify the given vector with regards to this plane. | |
float | Distance (const csVector3 &pt) const |
Compute the distance from the given vector to this plane. | |
void | Invert () |
Reverses the direction of the plane while maintianing the plane itself. | |
void | Normalize () |
Normalizes the plane equation so that 'norm' is a unit vector. | |
bool | ClipPolygon (csVector3 *&pverts, int &num_verts, bool reversed=false) |
Clip the polygon in pverts (having num_verts vertices) to this plane. | |
Static Public Methods | |
float | Classify (float A, float B, float C, float D, const csVector3 &pt) |
This static function classifies a vector with regards to four given plane components. | |
Public Attributes | |
csVector3 | norm |
The normal vector (or the (A,B,C) components). | |
float | DD |
The D component of the plane. |
Detailed Description
A plane in 3D space.The plane is given by the equation AAx + BBy + CCz + DD = 0, Where (AA,BB,CC) is given by the vector 'norm'.
Definition at line 40 of file plane3.h.
Constructor & Destructor Documentation
|
Initialize to the xy plane (0,0,1,0).
Definition at line 52 of file plane3.h. References DD. |
|
Initialize the plane with the given norm and D component.
Definition at line 57 of file plane3.h. References DD. |
|
Initialize the plane to the given components.
Definition at line 62 of file plane3.h. References DD. |
|
Initialize the plane through the three given points. If the plane is expressed as (N,D) with N the A,B,C components of the plane then this will initialize the plane to (N',-N'*v1) with N' equal to (v1-v2)%(v1-v3). |
|
Initialize the plane through 0 and the two given points. If the plane is expressed as (N,D) with N the A,B,C components of the plane then this will initialize the plane to (v2v3,0). Definition at line 77 of file plane3.h. References DD. |
Member Function Documentation
|
Return the A component of this plane.
Definition at line 97 of file plane3.h. References csVector3::x. |
|
Return the A component of this plane.
Definition at line 88 of file plane3.h. References csVector3::x. Referenced by Classify(). |
|
Return the B component of this plane.
Definition at line 99 of file plane3.h. References csVector3::y. |
|
Return the B component of this plane.
Definition at line 90 of file plane3.h. References csVector3::y. Referenced by Classify(). |
|
Return the C component of this plane.
Definition at line 101 of file plane3.h. References csVector3::z. |
|
Return the C component of this plane.
Definition at line 92 of file plane3.h. References csVector3::z. Referenced by Classify(). |
|
This static function classifies a vector with regards to four given plane components. This will calculate and return A*pt.x+B*pt.y+C*pt.z+D. Definition at line 147 of file plane3.h. References A(), B(), C(), D(), csVector3::x, csVector3::y, and csVector3::z. |
|
Classify the given vector with regards to this plane. If the plane is expressed as (N,D) with N the A,B,C components of the plane then this will calculate and return N*pt+D. Note that in the Crystal Space engine this function will return negative if used on the visible side of a polygon. i.e. if you take the world space plane of the polygon, then Classify() will return a negative value if the camera is located at a point from which you can see the polygon. Back-face culling will make the polygon invisible on the other side. Definition at line 141 of file plane3.h. References DD. Referenced by Distance(), csSquaredDist::PointPlane(), and csMath3::Visible(). |
|
Clip the polygon in pverts (having num_verts vertices) to this plane. The vertices are expected in camera space. Method returns true if there is something visible, false otherwise. Note that this function returns a pointer to a static array in csPlane3. The contents of this array will only be valid until the next call to ClipPolygon. Normally this function will consider the polygon visible if it is on the negative side of the plane (Classify()). If 'reversed' is set to true then the positive side will be used instead. |
|
Return the D component of this plane.
Definition at line 103 of file plane3.h. References DD. |
|
Return the D component of this plane.
Definition at line 94 of file plane3.h. References DD. Referenced by Classify(). |
|
Compute the distance from the given vector to this plane. This function assumes that 'norm' is a unit vector. If not, the function returns distance times the magnitude of 'norm'. This function corresponds exactly to the absolute value of Classify(). Definition at line 159 of file plane3.h. References Classify(). |
|
Reverses the direction of the plane while maintianing the plane itself. This will basically reverse the result of Classify(). Definition at line 166 of file plane3.h. References DD. |
|
Return the normal vector of this plane.
|
|
Return the normal vector of this plane.
|
|
Normalizes the plane equation so that 'norm' is a unit vector.
Definition at line 171 of file plane3.h. References DD, and csVector3::Norm(). |
|
Initialize the plane through 0 and the two given points. If the plane is expressed as (N,D) with N the A,B,C components of the plane then this will initialize the plane to (v2v3,0). Definition at line 126 of file plane3.h. References DD. |
|
Initialize the plane through the three given points. If the plane is expressed as (N,D) with N the A,B,C components of the plane then this will initialize the plane to (N',-N'*v1) with N' equal to (v1-v2)%(v1-v3). |
|
Set the value of the plane using a normal and D component.
Definition at line 110 of file plane3.h. References DD. |
|
Set the value of the four plane components.
Definition at line 106 of file plane3.h. References DD, csVector3::x, csVector3::y, and csVector3::z. |
Member Data Documentation
|
The D component of the plane.
Definition at line 47 of file plane3.h. Referenced by Classify(), csPlane3(), D(), Invert(), Normalize(), csMath3::PlanesEqual(), and Set(). |
|
The normal vector (or the (A,B,C) components).
Definition at line 44 of file plane3.h. Referenced by csMath3::PlanesEqual(). |
The documentation for this class was generated from the following file:
- csgeom/plane3.h
Generated for Crystal Space by doxygen 1.2.18