PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members | Public Member Functions
GMSPolygon Class Reference

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.
 
const Point3d & GetPoint (const size_t _i) const noexcept
 
Vector3d & GetNormal () noexcept
 Get the polygon's normal.
 
const Vector3d & GetNormal () const noexcept
 
double GetArea () const noexcept
 Get the polygon's area.
 
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.
 
void ComputeNormal ()
 Compute the normal and area for this polygon.
 
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.
 
const Point3d FindCenter () const noexcept
 Find the centroid of this polygon.
 
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
 

Public Types

Local Types
typedef std::vector< Point3d > PointList
 
typedef std::vector< int > IndexList
 
typedef IndexList::const_iterator const_iterator
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GMSPolygon() [1/3]

GMSPolygon::GMSPolygon ( )
default

Default construction is provided for compatibility with STL containers only. It should not be called otherwise.

◆ GMSPolygon() [2/3]

GMSPolygon::GMSPolygon ( const int  _v1,
const int  _v2,
const int  _v3,
const PointList &  _pts 
)

Construct a polygon (triangle) from three vertex indexes.

Parameters
_v1The first vertex index.
_v2The second vertex index.
_v3The third vertex index.
_ptsThe vector holding the vertex data.

◆ GMSPolygon() [3/3]

GMSPolygon::GMSPolygon ( const_iterator  _begin,
const_iterator  _end,
const PointList &  _pts 
)

Construct a polygon from a range of vertex indexes.

Parameters
_beginAn iterator to the front of the range (first index).
_endAn iterator to one-past-the-last of the range.
_ptsThe vector holding the vertex data.

Member Function Documentation

◆ operator[]()

const int & GMSPolygon::operator[] ( const size_t  _i) const
noexcept

Access a vertex index in the polygon.

Parameters
_iThe vertex index in range [0 : n - 1].
Returns
The _i'th vertex index in this polygon.

◆ GetPoint()

const Point3d & GMSPolygon::GetPoint ( const size_t  _i) const
noexcept

Get the vertex referenced by the _i'th index in the vertex list.

Parameters
_iThe vertex index in range [0 : n - 1].
Returns
The vertex which is the _i'th point in this polygon.

◆ PointIsAbove()

const bool GMSPolygon::PointIsAbove ( const Point3d &  _p) const
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.

Parameters
_pThe point to check.

◆ CommonVertex()

const int GMSPolygon::CommonVertex ( const GMSPolygon _p) const
noexcept

Find a common vertex between two polygons.

Parameters
_pThe other polygon under consideration.
Returns
A common vertex index, or -1 if none exists.

◆ CommonEdge()

const std::pair< int, int > GMSPolygon::CommonEdge ( const GMSPolygon _p) const
noexcept

Find the common edge between two polygons.

Parameters
_pThe other polygon under consideration.
Returns
A pair of vertex indexes if a common edge exists. If not, at least one of the indexes will be -1.

The documentation for this class was generated from the following files: