|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CPolygon2D Class ReferenceA 2d convex polygon.
More...
#include <polygon.h>
List of all members.
Public Types |
typedef std::vector< CVector2f > | TVec2fVect |
typedef std::pair< sint, sint > | TRaster |
typedef std::vector< TRaster > | TRasterVect |
Public Methods |
| CPolygon2D () |
| default ctor. More...
|
| CPolygon2D (const CPolygon &src, const CMatrix &projMat=CMatrix::Identity) |
| Build a 2D polygon from this 3D polygon, by using the given projection matrix The x and y components of projected vertices are used to create the 2D polygon. More...
|
| CPolygon2D (const CTriangle &tri, const CMatrix &projMat=CMatrix::Identity) |
| Build a 2D polygon from the given triangle, by using the given projection matrix The x and y components of projected vertices are used to create the 2D polygon. More...
|
bool | isConvex () |
| Check wether this polygon is convex;. More...
|
void | buildConvexHull (CPolygon2D &dest) const |
| Build a convex hull from this polygon. More...
|
void | getBestTriplet (uint &index0, uint &index1, uint &index2) |
| get the best triplet of vector. e.g the triplet that has the best surface. More...
|
void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| Serial this polygon. More...
|
void | computeBorders (TRasterVect &borders, sint &minimumY) |
| Compute the borders of this poly with sub-pixel accuracy. More...
|
bool | intersect (const CPolygon2D &other) const |
| Test wether this polygon intersect another convex polygon. Currently not optimized. More...
|
bool | contains (const CVector2f &p) const |
| Check wether a point is contained by this poly. More...
|
bool | getNonNullSeg (uint &seg) const |
| Get the index of a segment of this poly that is a non null segment. More...
|
void | getLineEquation (uint index, float &a, float &b, float &c) const |
| Get a line equation of the seg starting at the given index. More...
|
Public Attributes |
TVec2fVect | Vertices |
Private Methods |
float | sumDPAgainstLine (float a, float b, float c) const |
| Sum the dot product of this poly vertices against a plane. More...
|
const CVector2f & | getSegRef0 (uint index) const |
| Get ref to the first vertex that start at index. More...
|
const CVector2f & | getSegRef1 (uint index) const |
Detailed Description
A 2d convex polygon.
Definition at line 126 of file polygon.h.
Member Typedef Documentation
typedef std::pair<sint, sint> NLMISC::CPolygon2D::TRaster
|
|
typedef std::vector<TRaster> NLMISC::CPolygon2D::TRasterVect
|
|
typedef std::vector<CVector2f> NLMISC::CPolygon2D::TVec2fVect
|
|
Constructor & Destructor Documentation
NLMISC::CPolygon2D::CPolygon2D |
( |
|
) |
[inline] |
|
|
Build a 2D polygon from this 3D polygon, by using the given projection matrix The x and y components of projected vertices are used to create the 2D polygon.
Definition at line 785 of file polygon.cpp.
References src, and Vertices. |
|
Build a 2D polygon from the given triangle, by using the given projection matrix The x and y components of projected vertices are used to create the 2D polygon.
Definition at line 1363 of file polygon.cpp.
References Vertices, x, and y. |
Member Function Documentation
void NLMISC::CPolygon2D::buildConvexHull |
( |
CPolygon2D & |
dest |
) |
const |
|
|
Build a convex hull from this polygon.
The result poly is ordered, so it can also be used to order a convex poly given its set of vertices. NB: require this != &dest
Definition at line 836 of file polygon.cpp.
References NLAISCRIPT::l, nlassert, and Vertices. |
void NLMISC::CPolygon2D::computeBorders |
( |
TRasterVect & |
borders, |
|
|
sint & |
minimumY |
|
) |
|
|
|
Compute the borders of this poly with sub-pixel accuracy.
No clipping is performed. Only points exactly inside or exactly on the left border of the polygon are kept. The output is in a vector of sint pairs. minimumY is filled with the minimum y value of the poly. Each pairs gives [xmin, xmax] for the current segment. if xmin > xmax, then no point is valid for this segment. Otherwise, all points from x = xmin (included) to x = xmax (included) are valids.
Definition at line 1075 of file polygon.cpp.
References NLMISC::Next, NLMISC::Prev, NLMISC::ScanEdge, TVec2fVect, and Vertices.
Referenced by NL3D::CWaterRenderObs::traverse. |
bool NLMISC::CPolygon2D::contains |
( |
const CVector2f & |
p |
) |
const |
|
void NLMISC::CPolygon2D::getBestTriplet |
( |
uint & |
index0, |
|
|
uint & |
index1, |
|
|
uint & |
index2 |
|
) |
|
|
|
get the best triplet of vector. e.g the triplet that has the best surface.
Definition at line 967 of file polygon.cpp.
References nlassert. |
void NLMISC::CPolygon2D::getLineEquation |
( |
uint |
index, |
|
|
float & |
a, |
|
|
float & |
b, |
|
|
float & |
c |
|
) |
const |
|
bool NLMISC::CPolygon2D::getNonNullSeg |
( |
uint & |
seg |
) |
const |
|
const CVector2f& NLMISC::CPolygon2D::getSegRef0 |
( |
uint |
index |
) |
const [inline, private] |
|
const CVector2f& NLMISC::CPolygon2D::getSegRef1 |
( |
uint |
index |
) |
const [inline, private] |
|
bool NLMISC::CPolygon2D::intersect |
( |
const CPolygon2D & |
other |
) |
const |
|
bool NLMISC::CPolygon2D::isConvex |
( |
|
) |
|
|
float NLMISC::CPolygon2D::sumDPAgainstLine |
( |
float |
a, |
|
|
float |
b, |
|
|
float |
c |
|
) |
const [private] |
|
|
Sum the dot product of this poly vertices against a plane.
Definition at line 1232 of file polygon.cpp.
Referenced by intersect. |
Member Data Documentation
|
Definition at line 130 of file polygon.h.
Referenced by buildConvexHull, NL3D::CWaterShape::computeBBox, computeBorders, NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater, contains, CPolygon2D, getLineEquation, getNonNullSeg, getSegRef0, getSegRef1, NL3D::CWaterShape::getShapeInWorldSpace, intersect, isConvex, NL3D::CWaterShape::setShape, and NL3D::CWaterRenderObs::traverse. |
The documentation for this class was generated from the following files:
|
|