Easy3D 2.5.3
GenericPolygon< FT > Class Template Reference

A 2D polygon representation. More...

#include <easy3d/core/polygon.h>

Inheritance diagram for GenericPolygon< FT >:

Public Member Functions

 GenericPolygon ()=default
 Default constructor.
 
 GenericPolygon (std::size_t size)
 Initializes with a know size.
 
template<class InputIterator >
 GenericPolygon (InputIterator first, InputIterator last)
 Initializes from a known range.
 
bool is_clockwise () const
 Checks if the polygon has a clockwise orientation (right-hand rule). More...
 
void reverse_orientation ()
 Reverses the orientation of the polygon. The first vertex (pointed to by p.begin(), or [0]) remains the same.
 
bool contains (const Vec< 2, FT > &point) const
 Tests if a point lies inside the polygon.
 
bool contains (const GenericPolygon< FT > &plg) const
 Tests if a polygon plg lies inside this polygon (i.e., all its vertices are inside).
 
FT signed_area () const
 Returns the signed area of the polygon. The signed area is positive for counter clockwise polygons and negative for clockwise polygons.
 
FT area () const
 Returns the area of this polygon. This is the absolute value of the signed area, so it is always positive.
 
GenericBox< 2, FT > bbox () const
 Returns the smallest axis-aligned bounding box containing this polygon.
 

Detailed Description

template<typename FT>
class easy3d::GenericPolygon< FT >

A 2D polygon representation.

Examples
Tutorial_403_PointSelection.

Member Function Documentation

◆ is_clockwise()

bool is_clockwise
inline

Checks if the polygon has a clockwise orientation (right-hand rule).

This method determines the orientation of a polygon based on the sign of its signed area:

  • negative: clockwise
  • positive: counterclockwise

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