Go to the documentation of this file.
33 throw std::logic_error(
"Polygon does not conform a plane");
41 return sqrt(newPoint.
z * newPoint.
z + distance2D * distance2D);
53 throw std::logic_error(
"Polygon does not conform a plane");
72 for (
size_t i = 0; i < N - 1; i++)
73 v[i] =
TSegment3D(
operator[](i),
operator[](i + 1));
74 v[N - 1] =
TSegment3D(
operator[](N - 1),
operator[](0));
100 for (
size_t i = 0; i < N; i++)
operator[](i) = p[i];
103 size_t numEdges,
double radius,
TPolygon3D& poly)
105 if (numEdges < 3 || std::abs(radius) <
getEpsilon())
106 throw std::logic_error(
107 "Invalid arguments for regular polygon creations");
108 poly.resize(numEdges);
109 for (
size_t i = 0; i < numEdges; i++)
111 double angle = i * 2 *
M_PI / numEdges;
112 poly[i] =
TPoint3D(radius * cos(angle), radius * sin(angle), 0);
119 for (
size_t i = 0; i < numEdges; i++) pose.
composePoint(poly[i], poly[i]);
void getAsSegmentList(std::vector< TSegment3D > &v) const
Gets as set of segments, instead of set of points.
TPolygon3D()
Default constructor.
void getInverseHomogeneousMatrix(mrpt::math::CMatrixDouble44 &HG) const
void getCenter(TPoint3D &p) const
Get polygon's central point.
TPoint3D_< double > TPoint3D
Lightweight 3D point.
const_iterator end() const
void removeUnusedVertices(T &poly)
Auxiliary functor class to compute polygon's center.
void generate2DObject(TPolygon2D &p) const
Projects into a 2D space, discarding the z.
double distance(const TPoint3D &point) const
Distance to point (always >=0)
void removeRepeatedVertices()
Remove polygon's repeated vertices.
double getRegressionPlane(const std::vector< TPoint3D > &points, TPlane &plane)
Using eigenvalues, gets the best fitting plane for a set of 3D points.
bool contains(const TPoint2D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
void project3D(const TPoint3D &point, const mrpt::math::TPose3D &newXYpose, TPoint3D &newPoint)
Uses the given pose 3D to project a point into a new base.
void getBestFittingPlane(TPlane &p) const
Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.
double distance(const TPoint2D &point) const
Distance to a point (always >=0)
void getPrismBounds(const std::vector< TPoint3D > &poly, TPoint3D &pMin, TPoint3D &pMax)
Gets the prism bounds of a 3D polygon or set of 3D points.
const_iterator begin() const
A compile-time fixed-size numeric matrix container.
void fromHomogeneousMatrix(const mrpt::math::CMatrixDouble44 &HG)
double getEpsilon()
Gets the value of the geometric epsilon (default = 1e-5)
size_t size(const MATRIXLIKE &m, const int dim)
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
bool conformAPlane(const std::vector< TPoint3D > &points)
Checks whether this polygon or set of points acceptably fits a plane.
bool isSkew() const
Check whether the polygon is skew.
2D polygon, inheriting from std::vector<TPoint2D>.
3D polygon, inheriting from std::vector<TPoint3D>
3D segment, consisting of two points.
void getAsPose3D(mrpt::math::TPose3D &outPose) const
bool contains(const TPoint3D &point) const
Check whether a point is inside (or within geometryEpsilon of a polygon edge).
static void createRegularPolygon(size_t numEdges, double radius, TPolygon3D &poly)
Static method to create a regular polygon, given its size and radius.
3D Plane, represented by its equation
bool getPlane(TPlane &p) const
Gets a plane which contains the polygon.
void removeRedundantVertices()
Erase every redundant vertex, thus saving space.
void removeRepVertices(T &poly)
TPoint2D_< double > TPoint2D
Lightweight 2D point.
This base provides a set of functions for maths stuff.
void composePoint(const TPoint3D &l, TPoint3D &g) const
void getAsPose3DForcingOrigin(const TPoint3D ¢er, TPose3D &pose) const
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Thu May 21 21:53:32 UTC 2020 | |