A wrapper of a TPolygon2D class, implementing CSerializable.
Definition at line 25 of file CPolygon.h.
#include <mrpt/math/CPolygon.h>
Public Member Functions | |
CPolygon () | |
Constructor cx and cy are the "central" point coordinates (laser sensor location if applicable) This parameters are NOT used in PointIntoPolygon, so they can be ignored. | |
void | AddVertex (double x, double y) |
Add a new vertex to polygon: | |
double | GetVertex_x (size_t i) const |
Methods for accessing the vertexs: | |
double | GetVertex_y (size_t i) const |
size_t | verticesCount () const |
Returns the vertices count in the polygon: | |
void | setAllVertices (const std::vector< double > &x, const std::vector< double > &y) |
Set all vertices at once. | |
void | setAllVertices (size_t nVertices, const double *xs, const double *ys) |
Set all vertices at once. | |
void | setAllVertices (size_t nVertices, const float *xs, const float *ys) |
Set all vertices at once. | |
void | getAllVertices (std::vector< double > &x, std::vector< double > &y) const |
Get all vertices at once. | |
void | Clear () |
Clear the polygon, erasing all vertexs. | |
bool | PointIntoPolygon (double x, double y) const |
Check if a point is inside the polygon: | |
double | distance (const TPoint2D &point) const |
Distance to a point. | |
bool | contains (const TPoint2D &point) const |
Check whether a point is inside the polygon. | |
void | getAsSegmentList (std::vector< TSegment2D > &v) const |
Gets as set of segments, instead of points. | |
void | generate3DObject (TPolygon3D &p) const |
Projects into 3D space, zeroing the z. | |
void | getCenter (TPoint2D &p) const |
Polygon's central point. | |
bool | isConvex () const |
Checks whether is convex. | |
void | removeRepeatedVertices () |
Erase repeated vertices. | |
void | removeRedundantVertices () |
Erase every redundant vertex from the polygon, saving space. | |
void | getPlotData (std::vector< double > &x, std::vector< double > &y) const |
Gets plot data, ready to use on a 2D plot. | |
Static Public Member Functions | |
static void | createRegularPolygon (size_t numEdges, double radius, TPolygon2D &poly) |
Static method to create a regular polygon, given its size and radius. | |
static void | createRegularPolygon (size_t numEdges, double radius, TPolygon2D &poly, const mrpt::poses::CPose2D &pose) |
Static method to create a regular polygon from its size and radius. | |
Public Attributes | |
T | elements |
STL member. | |
Protected Member Functions | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const MRPT_OVERRIDE |
void | readFromStream (mrpt::utils::CStream &in, int version) MRPT_OVERRIDE |
RTTI stuff <br> | |
typedef CPolygonPtr | SmartPtr |
static mrpt::utils::CLASSINIT | _init_CPolygon |
static mrpt::utils::TRuntimeClassId | classCPolygon |
static const mrpt::utils::TRuntimeClassId * | classinfo |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const MRPT_OVERRIDE |
virtual mrpt::utils::CObject * | duplicate () const MRPT_OVERRIDE |
static mrpt::utils::CObject * | CreateObject () |
static CPolygonPtr | Create () |
A typedef for the associated smart pointer
Definition at line 28 of file CPolygon.h.
|
inline |
Constructor cx and cy are the "central" point coordinates (laser sensor location if applicable) This parameters are NOT used in PointIntoPolygon, so they can be ignored.
Definition at line 36 of file CPolygon.h.
|
staticprotected |
|
inline |
Add a new vertex to polygon:
Definition at line 41 of file CPolygon.h.
|
inline |
Clear the polygon, erasing all vertexs.
Definition at line 65 of file CPolygon.h.
|
inherited |
Check whether a point is inside the polygon.
Referenced by PointIntoPolygon().
|
static |
|
static |
|
staticinherited |
Static method to create a regular polygon, given its size and radius.
std::logic_error | if radius is near zero or the number of edges is less than three. |
|
inlinestaticinherited |
Static method to create a regular polygon from its size and radius.
The center will correspond to the given pose.
std::logic_error | if radius is near zero or the number of edges is less than three. |
|
inherited |
Distance to a point.
|
virtual |
|
inherited |
Projects into 3D space, zeroing the z.
void mrpt::math::CPolygon::getAllVertices | ( | std::vector< double > & | x, |
std::vector< double > & | y | ||
) | const |
Get all vertices at once.
|
inherited |
Gets as set of segments, instead of points.
|
inherited |
Polygon's central point.
|
inherited |
Gets plot data, ready to use on a 2D plot.
|
virtual |
|
inline |
Methods for accessing the vertexs:
Definition at line 48 of file CPolygon.h.
References ASSERT_.
|
inline |
Definition at line 49 of file CPolygon.h.
References ASSERT_.
|
inherited |
Checks whether is convex.
|
inline |
Check if a point is inside the polygon:
Definition at line 69 of file CPolygon.h.
References mrpt::math::TPolygon2D::contains().
|
protected |
|
inherited |
Erase every redundant vertex from the polygon, saving space.
|
inherited |
Erase repeated vertices.
void mrpt::math::CPolygon::setAllVertices | ( | const std::vector< double > & | x, |
const std::vector< double > & | y | ||
) |
Set all vertices at once.
void mrpt::math::CPolygon::setAllVertices | ( | size_t | nVertices, |
const double * | xs, | ||
const double * | ys | ||
) |
Set all vertices at once.
Please use the std::vector version whenever possible unless efficiency is really an issue
void mrpt::math::CPolygon::setAllVertices | ( | size_t | nVertices, |
const float * | xs, | ||
const float * | ys | ||
) |
Set all vertices at once.
Please use the std::vector version whenever possible unless efficiency is really an issue
|
inline |
Returns the vertices count in the polygon:
Definition at line 52 of file CPolygon.h.
|
protected |
|
staticprotected |
Definition at line 28 of file CPolygon.h.
|
static |
Definition at line 28 of file CPolygon.h.
|
static |
Definition at line 28 of file CPolygon.h.
|
inherited |
STL member.
Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Tue Jan 17 22:27:43 UTC 2023 |