|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CPolygon Class ReferenceA polygon, with an unlimited size of vertices.
More...
#include <polygon.h>
List of all members.
Public Methods |
| CPolygon () |
| Constructor. More...
|
| CPolygon (const CVector &a, const CVector &b, const CVector &c) |
| Constructor. Init with a triangle. More...
|
sint | getNumVertices () const |
void | clip (const CPlane *planes, uint nPlanes) |
| Clip a polygon with a set of planes. Cohen-sutherland... clipPolygonBack() is used on planes. More...
|
void | clip (const std::vector< CPlane > &planes) |
| Clip a polygon with a set of planes. Cohen-sutherland clipping... clipPolygonBack() is used on planes. More...
|
void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| Serial this polygon. More...
|
bool | toConvexPolygons (std::list< CPolygon > &outputPolygons, const CMatrix &basis) const |
| Convert a concave polygon into a list of convex polygons using a 2d projection. More...
|
bool | chain (const std::vector< CPolygon > &other, const CMatrix &basis) |
| Chain the arg polygons with this polygon testing 2d intersections. More...
|
void | getBestTriplet (uint &index0, uint &index1, uint &index2) |
| get the best triplet from this poly (the one that has the highest area). More...
|
void | buildBasis (CMatrix &dest) |
| Takes the best triplet from this poly to build a normal. More...
|
void | toConvexPolygonsLocalAndBSP (std::vector< CVector > &localVertices, CBSPNode2v &root, const CMatrix &basis) const |
Static Public Methods |
bool | toConvexPolygonsEdgeIntersect (const CVector2f &a0, const CVector2f &a1, const CVector2f &b0, const CVector2f &b1) |
bool | toConvexPolygonsLeft (const std::vector< CVector > &vertex, uint a, uint b, uint c) |
bool | toConvexPolygonsLeftOn (const std::vector< CVector > &vertex, uint a, uint b, uint c) |
bool | toConvexPolygonsInCone (const std::vector< CVector > &vertex, uint a, uint b) |
bool | toConvexPolygonsDiagonal (const std::vector< CVector > &vertex, const CBSPNode2v &bsp, uint a, uint b) |
Public Attributes |
std::vector< CVector > | Vertices |
Detailed Description
A polygon, with an unlimited size of vertices.
-
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2000
Definition at line 56 of file polygon.h.
Constructor & Destructor Documentation
NLMISC::CPolygon::CPolygon |
( |
|
) |
[inline] |
|
Member Function Documentation
void NLMISC::CPolygon::buildBasis |
( |
CMatrix & |
dest |
) |
|
|
|
Takes the best triplet from this poly to build a normal.
From this normal and a points, build a basis (the normal is the K vector of the basis) This can be used to transform the poly in 2D after it has been inverted
Definition at line 141 of file polygon.cpp.
References getBestTriplet, nlassert, and Vertices. |
bool NLMISC::CPolygon::chain |
( |
const std::vector< CPolygon > & |
other, |
|
|
const CMatrix & |
basis |
|
) |
|
|
|
Chain the arg polygons with this polygon testing 2d intersections.
The 2d intersection test has been done in the XY plane of the basis passed at the function.
The polygon a-b-c-d-e chained with f-g-h-i-j will give the polygon a-b-f-g-h-i-j-f-b-c-d-e if the edge b-f is not 2d clipped by any edge plane in the XY plane of basis. -
Parameters:
-
basis |
is the basis of the polygon projection. |
-
Returns:
-
false if chain failed. else true.
Definition at line 624 of file polygon.cpp.
References CPolygon, index, toConvexPolygonsLocalAndBSP, and Vertices. |
void NLMISC::CPolygon::clip |
( |
const std::vector< CPlane > & |
planes |
) |
|
|
|
Clip a polygon with a set of planes. Cohen-sutherland clipping... clipPolygonBack() is used on planes.
Definition at line 89 of file polygon.cpp.
References clip. |
void NLMISC::CPolygon::clip |
( |
const CPlane * |
planes, |
|
|
uint |
nPlanes |
|
) |
|
|
void NLMISC::CPolygon::getBestTriplet |
( |
uint & |
index0, |
|
|
uint & |
index1, |
|
|
uint & |
index2 |
|
) |
|
|
sint NLMISC::CPolygon::getNumVertices |
( |
|
) |
const [inline] |
|
bool NLMISC::CPolygon::toConvexPolygons |
( |
std::list< CPolygon > & |
outputPolygons, |
|
|
const CMatrix & |
basis |
|
) |
const |
|
|
Convert a concave polygon into a list of convex polygons using a 2d projection.
The polygon mustn't overlap itself in the XY plane of the basis passed in parameter. The polygon must be direct in the XY plane of the basis passed in parameter. (Counter clock wise)
The subdivison is in non-constant n*log(n) with n is the number of vertices. -
Parameters:
-
outputPolygons |
is the list filled with clipped convex polygons. The list is not cleared at the begining. New polygons are just appended at the end. |
basis |
is the basis of the polygon projection. |
-
Returns:
-
true if the polygon has been subdivided. false if the polygon overlap itself in the XY plane of the basis or if the polygon is not direct (clock wise).
Definition at line 440 of file polygon.cpp.
References CPolygon, nlassert, toConvexPolygonsDiagonal, toConvexPolygonsLocalAndBSP, and Vertices. |
bool NLMISC::CPolygon::toConvexPolygonsDiagonal |
( |
const std::vector< CVector > & |
vertex, |
|
|
const CBSPNode2v & |
bsp, |
|
|
uint |
a, |
|
|
uint |
b |
|
) |
[static] |
|
bool NLMISC::CPolygon::toConvexPolygonsInCone |
( |
const std::vector< CVector > & |
vertex, |
|
|
uint |
a, |
|
|
uint |
b |
|
) |
[static] |
|
bool NLMISC::CPolygon::toConvexPolygonsLeft |
( |
const std::vector< CVector > & |
vertex, |
|
|
uint |
a, |
|
|
uint |
b, |
|
|
uint |
c |
|
) |
[static] |
|
bool NLMISC::CPolygon::toConvexPolygonsLeftOn |
( |
const std::vector< CVector > & |
vertex, |
|
|
uint |
a, |
|
|
uint |
b, |
|
|
uint |
c |
|
) |
[static] |
|
void NLMISC::CPolygon::toConvexPolygonsLocalAndBSP |
( |
std::vector< CVector > & |
localVertices, |
|
|
CBSPNode2v & |
root, |
|
|
const CMatrix & |
basis |
|
) |
const |
|
Member Data Documentation
std::vector<CVector> NLMISC::CPolygon::Vertices
|
|
|
Definition at line 59 of file polygon.h.
Referenced by buildBasis, chain, clip, CPolygon, getBestTriplet, getNumVertices, NL3D::CWaterShape::getShapeInWorldSpace, NL3D::CZoneLighter::lightWater, toConvexPolygons, toConvexPolygonsLocalAndBSP, and NL3D::CWaterRenderObs::traverse. |
The documentation for this class was generated from the following files:
|
|