Parasol Planning Library (PPL)
|
#include <GMSPolygon.h>
Public Types | |
Local Types | |
typedef std::vector< Point3d > | PointList |
typedef std::vector< int > | IndexList |
typedef IndexList::const_iterator | const_iterator |
Public Member Functions | |
const int & | operator[] (const size_t _i) const noexcept |
size_t | GetNumVertices () const noexcept |
Get the number of vertices in the polygon. More... | |
const Point3d & | GetPoint (const size_t _i) const noexcept |
Vector3d & | GetNormal () noexcept |
Get the polygon's normal. More... | |
const Vector3d & | GetNormal () const noexcept |
double | GetArea () const noexcept |
Get the polygon's area. More... | |
Construction | |
GMSPolygon () | |
GMSPolygon (const int _v1, const int _v2, const int _v3, const PointList &_pts) | |
GMSPolygon (const_iterator _begin, const_iterator _end, const PointList &_pts) | |
Iterators | |
Iterate over the vertex indices in this polygon. | |
const_iterator | begin () const noexcept |
const_iterator | end () const noexcept |
Modifiers | |
void | Reverse () |
Reverse the facing of this polygon. More... | |
void | ComputeNormal () |
Compute the normal and area for this polygon. More... | |
Equality | |
bool | operator== (const GMSPolygon &_p) const noexcept |
bool | operator!= (const GMSPolygon &_p) const noexcept |
Ordering | |
Define an ordering of polygons based on surface area. | |
bool | operator< (const GMSPolygon &_other) const noexcept |
bool | operator> (const GMSPolygon &_other) const noexcept |
Queries | |
const bool | IsTriangle () const noexcept |
Test for three unique vertex indexes. More... | |
const Point3d | FindCenter () const noexcept |
Find the centroid of this polygon. More... | |
const bool | PointIsAbove (const Point3d &_p) const noexcept |
const int | CommonVertex (const GMSPolygon &_p) const noexcept |
const std::pair< int, int > | CommonEdge (const GMSPolygon &_p) const noexcept |
Geometric structure for polygons, including vertex indexes, normal, and area. The vertex indexes refer to an external vertex list, which is required for accessing the points through this object.
Since we require triangulated models, this usually represents a triangle.
typedef IndexList::const_iterator GMSPolygon::const_iterator |
typedef std::vector<int> GMSPolygon::IndexList |
typedef std::vector<Point3d> GMSPolygon::PointList |
|
default |
Default construction is provided for compatibility with STL containers only. It should not be called otherwise.
GMSPolygon::GMSPolygon | ( | const int | _v1, |
const int | _v2, | ||
const int | _v3, | ||
const PointList & | _pts | ||
) |
Construct a polygon (triangle) from three vertex indexes.
_v1 | The first vertex index. |
_v2 | The second vertex index. |
_v3 | The third vertex index. |
_pts | The vector holding the vertex data. |
GMSPolygon::GMSPolygon | ( | const_iterator | _begin, |
const_iterator | _end, | ||
const PointList & | _pts | ||
) |
Construct a polygon from a range of vertex indexes.
_begin | An iterator to the front of the range (first index). |
_end | An iterator to one-past-the-last of the range. |
_pts | The vector holding the vertex data. |
|
noexcept |
|
noexcept |
Find the common edge between two polygons.
_p | The other polygon under consideration. |
|
noexcept |
Find a common vertex between two polygons.
_p | The other polygon under consideration. |
void GMSPolygon::ComputeNormal | ( | ) |
Compute the normal and area for this polygon.
|
noexcept |
|
noexcept |
Find the centroid of this polygon.
|
noexcept |
Get the polygon's area.
|
noexcept |
|
noexcept |
Get the polygon's normal.
|
noexcept |
Get the number of vertices in the polygon.
|
noexcept |
Get the vertex referenced by the _i'th index in the vertex list.
_i | The vertex index in range [0 : n - 1]. |
|
noexcept |
Test for three unique vertex indexes.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Access a vertex index in the polygon.
_i | The vertex index in range [0 : n - 1]. |
|
noexcept |
Test whether a point lies above or below the polygon plane. A point is considered above the plane when it is on the side where the normal faces outward.
_p | The point to check. |
void GMSPolygon::Reverse | ( | ) |
Reverse the facing of this polygon.