|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CPlane Class ReferenceClass CPlane.
More...
#include <plane.h>
List of all members.
Public Methods |
|
| CPlane () |
| Constructor that does nothing. More...
|
| CPlane (float _a, float _b, float _c, float _d) |
| Constructor . More...
|
| CPlane (const CPlane &v) |
| Copy Constructor. More...
|
|
void | make (const CVector &normal, const CVector &pos) |
| Make a plane with a normal and a vertex. More...
|
void | make (const CVector &p0, const CVector &p1, const CVector &p2) |
| Make a plane with 3 vertices. More...
|
CVector | getNormal () const |
| Return the normal vector of the plane. More...
|
void | normalize () |
| Normalize the plane, such that getNormal() return a normalized vector. More...
|
CPlane | normed () const |
| return the normalized version of a plane. More...
|
|
float | distance (const CVector &p) const |
| Return the distance of p from the plane. More...
|
float | operator * (const CVector &p) const |
| Return plane*vector. More...
|
CVector | intersect (const CVector &p0, const CVector &p1) const |
| Intersect a line onto a plane. p1 is returned if line // to plane. More...
|
CVector | project (const CVector &p0) const |
| Project a point onto a plane. More...
|
bool | clipSegmentBack (CVector &p0, CVector &p1) const |
| Clip a segment onto a plane. More...
|
bool | clipSegmentFront (CVector &p0, CVector &p1) const |
| Clip a segment onto a plane. More...
|
sint | clipPolygonBack (CVector in[], CVector out[], sint nIn) const |
| Clip a polygon by a plane. More...
|
sint | clipPolygonFront (CVector in[], CVector out[], sint nIn) const |
| Clip a polygon by a plane. More...
|
|
CPlane | inverted () const |
| get the inverted version of this plane (same position, but inverted normal). More...
|
void | invert () |
| invert this plane (same position, but inverted normal). More...
|
|
void | serial (IStream &f) |
Public Attributes |
float | a |
float | b |
float | c |
float | d |
Detailed Description
Class CPlane.
a 3D Plane.
A vector v is said "front" of a plane p if p*v>0.
A "front segment" or a "front polygon" have all their vertices in front of the plane. -
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2000
Definition at line 49 of file plane.h.
Constructor & Destructor Documentation
NLMISC::CPlane::CPlane |
( |
|
) |
[inline] |
|
NLMISC::CPlane::CPlane |
( |
float |
_a, |
|
|
float |
_b, |
|
|
float |
_c, |
|
|
float |
_d |
|
) |
[inline] |
|
|
Constructor .
Definition at line 61 of file plane.h.
References a, b, c, and d. |
NLMISC::CPlane::CPlane |
( |
const CPlane & |
v |
) |
[inline] |
|
Member Function Documentation
|
Clip a polygon by a plane.
The "back polygon" is returned. Nb: Out must be allocated to nIn+1 (at less). -
Parameters:
-
in |
the input polygon |
out |
the clipped back polygon |
nIn |
number of vertices of input polygon |
-
Returns:
-
number of vertices of out. 0 is returned if In polygon entirely front, or if nIn<=2.
Definition at line 97 of file plane.cpp.
References in, intersect, and s. |
|
Clip a polygon by a plane.
The "front polygon" is returned. Nb: Out must be allocated to nIn+1 (at less). -
Parameters:
-
in |
the input polygon |
out |
the clipped front polygon |
nIn |
number of vertices of input polygon |
-
Returns:
-
number of vertices of out. 0 is returned if In polygon entirely back, or if nIn<=2.
Definition at line 125 of file plane.cpp.
References in, intersect, and s.
Referenced by NL3D::CCubeGrid::project. |
bool NLMISC::CPlane::clipSegmentBack |
( |
CVector & |
p0, |
|
|
CVector & |
p1 |
|
) |
const |
|
|
Clip a segment onto a plane.
The "back segment" is written in (p1,p2). If segment is entirely "front", (p1,p2) is not modified. -
Returns:
-
false if segment entirely front, or true.
-
See also:
-
clipSegmentFront()
Definition at line 54 of file plane.cpp. |
bool NLMISC::CPlane::clipSegmentFront |
( |
CVector & |
p0, |
|
|
CVector & |
p1 |
|
) |
const |
|
|
Clip a segment onto a plane.
The "front segment" is written in (p1,p2). If segment is entirely "back", (p1,p2) is not modified. -
Returns:
-
false if segment entirely back, or true.
-
See also:
-
clipSegmentBack()
Definition at line 74 of file plane.cpp. |
float NLMISC::CPlane::distance |
( |
const CVector & |
p |
) |
const [inline] |
|
|
Return the distance of p from the plane.
Hence, the result is >=0. Since the plane normal may not be normalized, distance() compute the distance with the normalized normal of plane. If you are sure that your plane has a normalized normal, it is much faster to do a fabs(p*v) .
Definition at line 40 of file plane_inline.h.
References CPlane, normed, and v. |
CVector NLMISC::CPlane::getNormal |
( |
|
) |
const [inline] |
|
void NLMISC::CPlane::invert |
( |
|
) |
|
|
|
invert this plane (same position, but inverted normal).
Definition at line 160 of file plane.cpp.
References a, b, c, and d. |
CPlane NLMISC::CPlane::inverted |
( |
|
) |
const |
|
|
get the inverted version of this plane (same position, but inverted normal).
Definition at line 154 of file plane.cpp.
References a, b, c, CPlane, and d. |
|
Make a plane with 3 vertices.
NB: the plane normal is normalized by make().
Definition at line 44 of file plane.cpp.
References make, and v. |
void NLMISC::CPlane::make |
( |
const CVector & |
normal, |
|
|
const CVector & |
pos |
|
) |
|
|
|
Make a plane with a normal and a vertex.
NB: the plane normal is normalized by make().
Definition at line 36 of file plane.cpp.
References a, b, c, d, and v.
Referenced by NL3D::CCubeGrid::insert, make, NL3D::CHeatHaze::performHeatHaze, NL3D::CPSZoneRectangle::performMotion, NL3D::CPSZoneDisc::performMotion, NL3D::CPSZonePlane::performMotion, NL3D::CCubeGrid::select, NL3D::CQuadTree::selectRay, NL3D::CQuadTree::selectSegment, and NL3D::CWaterRenderObs::traverse. |
void NLMISC::CPlane::normalize |
( |
|
) |
[inline] |
|
CPlane NLMISC::CPlane::normed |
( |
|
) |
const [inline] |
|
float NLMISC::CPlane::operator * |
( |
const CVector & |
p |
) |
const [inline] |
|
void NLMISC::CPlane::serial |
( |
IStream & |
f |
) |
[inline] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
|
|