25     std::vector<TSegment2D> sgs;
    31     double distance = std::numeric_limits<double>::max();
    33     for (
auto it = sgs.begin(); it != sgs.end(); ++it)
    35         double d = (*it).distance(point);
    44     ASSERTMSG_(!this->
empty(), 
"getBoundingBox() called on an empty polygon!");
    45     min_coords.
x = min_coords.
y = std::numeric_limits<double>::max();
    46     max_coords.
x = max_coords.
y = -std::numeric_limits<double>::max();
    47     for (
size_t i = 0; i < 
size(); i++)
    66     return ((P1.
x - P0.
x) * (P2.
y - P0.
y) - (P2.
x - P0.
x) * (P1.
y - P0.
y));
    74     const size_t n = this->
size();
    75     for (
size_t i = 0; i < n; i++)  
    77         if ((*
this)[i].y <= P.
y)
    80             if ((*
this)[(i + 1) % n].y > P.
y)  
    81                 if (
isLeft((*
this)[i], (*
this)[(i + 1) % n], P) >
    88             if ((*
this)[(i + 1) % n].y <= P.
y)  
    89                 if (
isLeft((*
this)[i], (*
this)[(i + 1) % n], P) <
   101     for (
size_t i = 0; i < N - 1; i++)
   102         v[i] = 
TSegment2D(
operator[](i), 
operator[](i + 1));
   103     v[N - 1] = 
TSegment2D(
operator[](N - 1), 
operator[](0));
   120     if (N <= 3) 
return true;
   121     vector<TSegment2D> sgms;
   123     for (
size_t i = 0; i < N; i++)
   127         for (
size_t j = 0; j < N; j++)
   129             double d = l.evaluatePoint(
operator[](j));
   133                 s = (d > 0) ? 1 : -1;
   134             else if (s != ((d > 0) ? 1 : -1))
   147     std::vector<double>& x, std::vector<double>& y)
 const   152     for (
size_t i = 0; i < N; i++)
   164     for (
size_t i = 0; i < N; i++) 
operator[](i) = 
TPoint2D(p[i]);
   167     size_t numEdges, 
double radius, 
TPolygon2D& poly)
   169     if (numEdges < 3 || std::abs(radius) < 
getEpsilon())
   170         throw std::logic_error(
   171             "Invalid arguments for regular polygon creations");
   172     poly.resize(numEdges);
   173     for (
size_t i = 0; i < numEdges; i++)
   175         double angle = i * 
M_PI * 2 / numEdges;
   176         poly[i] = 
TPoint2D(radius * cos(angle), radius * sin(angle));
   184     for (
size_t i = 0; i < numEdges; i++) poly[i] = pose.
composePoint(poly[i]);
 void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
 
Auxiliary functor class to compute polygon's center. 
 
TPoint2D_< double > TPoint2D
Lightweight 2D point. 
 
#define THROW_EXCEPTION(msg)
 
size_t size(const MATRIXLIKE &m, const int dim)
 
static void createRegularPolygon(size_t numEdges, double radius, TPolygon2D &poly)
Static method to create a regular polygon, given its size and radius. 
 
void getCenter(TPoint2D &p) const
Polygon's central point. 
 
void removeRepVertices(T &poly)
 
bool contains(const TPoint2D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge). 
 
VALUE & operator[](const KEY &key)
Write/read via [i] operator, that creates an element if it didn't exist already. 
 
void removeRepeatedVertices()
Erase repeated vertices. 
 
void removeRedundantVertices()
Erase every redundant vertex from the polygon, saving space. 
 
This base provides a set of functions for maths stuff. 
 
2D segment, consisting of two points. 
 
void getAsSegmentList(std::vector< TSegment2D > &v) const
Gets as set of segments, instead of points. 
 
bool isConvex() const
Checks whether is convex. 
 
double distance(const TPoint2D &point) const
Distance to a point (always >=0) 
 
void getPlotData(std::vector< double > &x, std::vector< double > &y) const
Gets plot data, ready to use on a 2D plot. 
 
TPolygon2D()
Default constructor. 
 
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism. 
 
void getBoundingBox(TPoint2D &min_coords, TPoint2D &max_coords) const
Get polygon bounding box. 
 
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
 
double isLeft(const mrpt::math::TPoint2D &P0, const mrpt::math::TPoint2D &P1, const mrpt::math::TPoint2D &P2)
 
void removeUnusedVertices(T &poly)
 
const_iterator end() const
 
const_iterator begin() const
 
double getEpsilon()
Gets the value of the geometric epsilon (default = 1e-5) 
 
mrpt::math::TPoint2D composePoint(const TPoint2D l) const
 
void generate3DObject(TPolygon3D &p) const
Projects into 3D space, zeroing the z. 
 
2D polygon, inheriting from std::vector<TPoint2D>. 
 
3D polygon, inheriting from std::vector<TPoint3D> 
 
2D line without bounds, represented by its equation .