MRPT  2.0.4
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
mrpt::math::TPolygon3D Class Reference

Detailed Description

3D polygon, inheriting from std::vector<TPoint3D>

See also
TPolygon2D,TSegment3D,TLine3D,TPlane,TPoint3D

Definition at line 20 of file TPolygon3D.h.

#include <mrpt/math/TPolygon3D.h>

Inheritance diagram for mrpt::math::TPolygon3D:

Public Member Functions

double distance (const TPoint3D &point) const
 Distance to point (always >=0) More...
 
bool contains (const TPoint3D &point) const
 Check whether a point is inside (or within geometryEpsilon of a polygon edge). More...
 
void getAsSegmentList (std::vector< TSegment3D > &v) const
 Gets as set of segments, instead of set of points. More...
 
bool getPlane (TPlane &p) const
 Gets a plane which contains the polygon. More...
 
void getBestFittingPlane (TPlane &p) const
 Gets the best fitting plane, disregarding whether the polygon actually fits inside or not. More...
 
void generate2DObject (TPolygon2D &p) const
 Projects into a 2D space, discarding the z. More...
 
void getCenter (TPoint3D &p) const
 Get polygon's central point. More...
 
bool isSkew () const
 Check whether the polygon is skew. More...
 
void removeRepeatedVertices ()
 Remove polygon's repeated vertices. More...
 
void removeRedundantVertices ()
 Erase every redundant vertex, thus saving space. More...
 
 TPolygon3D ()
 Default constructor. More...
 
 TPolygon3D (size_t N)
 Constructor for a given size. More...
 
 TPolygon3D (const std::vector< TPoint3D > &v)
 Implicit constructor from a 3D points vector. More...
 
 TPolygon3D (const TPolygon2D &p)
 Constructor from a 2D object. More...
 

Static Public Member Functions

static void createRegularPolygon (size_t numEdges, double radius, TPolygon3D &poly)
 Static method to create a regular polygon, given its size and radius. More...
 
static void createRegularPolygon (size_t numEdges, double radius, TPolygon3D &poly, const mrpt::math::TPose3D &pose)
 Static method to create a regular polygon, given its size and radius. More...
 

Public Attributes

elements
 STL member. More...
 

Constructor & Destructor Documentation

◆ TPolygon3D() [1/4]

mrpt::math::TPolygon3D::TPolygon3D ( )
inline

Default constructor.

Creates a polygon with no vertices.

Definition at line 48 of file TPolygon3D.h.

◆ TPolygon3D() [2/4]

mrpt::math::TPolygon3D::TPolygon3D ( size_t  N)
inlineexplicit

Constructor for a given size.

Creates a polygon with a fixed number of vertices, which are initialized to garbage.

Definition at line 51 of file TPolygon3D.h.

◆ TPolygon3D() [3/4]

mrpt::math::TPolygon3D::TPolygon3D ( const std::vector< TPoint3D > &  v)
inline

Implicit constructor from a 3D points vector.

Definition at line 53 of file TPolygon3D.h.

◆ TPolygon3D() [4/4]

TPolygon3D::TPolygon3D ( const TPolygon2D p)
explicit

Constructor from a 2D object.

Zeroes the z.

Definition at line 96 of file TPolygon3D.cpp.

References resize().

Here is the call graph for this function:

Member Function Documentation

◆ contains()

bool TPolygon3D::contains ( const TPoint3D point) const

Check whether a point is inside (or within geometryEpsilon of a polygon edge).

This works for concave or convex polygons.

Definition at line 43 of file TPolygon3D.cpp.

References mrpt::math::TPolygon2D::contains(), mrpt::math::TPose3D::fromHomogeneousMatrix(), mrpt::math::TPlane::getAsPose3D(), mrpt::math::getEpsilon(), mrpt::math::TPose3D::getInverseHomogeneousMatrix(), getPlane(), mrpt::math::getPrismBounds(), mrpt::math::project3D(), mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.

Referenced by mrpt::math::intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createRegularPolygon() [1/2]

void TPolygon3D::createRegularPolygon ( size_t  numEdges,
double  radius,
TPolygon3D poly 
)
static

Static method to create a regular polygon, given its size and radius.

Exceptions
std::logic_errorif number of edges is less than three, or radius is near zero.

Definition at line 102 of file TPolygon3D.cpp.

References mrpt::math::getEpsilon(), and M_PI.

Referenced by createRegularPolygon().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createRegularPolygon() [2/2]

void TPolygon3D::createRegularPolygon ( size_t  numEdges,
double  radius,
TPolygon3D poly,
const mrpt::math::TPose3D pose 
)
static

Static method to create a regular polygon, given its size and radius.

The center will be located on the given pose.

Exceptions
std::logic_errorif number of edges is less than three, or radius is near zero.

Definition at line 115 of file TPolygon3D.cpp.

References mrpt::math::TPose3D::composePoint(), and createRegularPolygon().

Here is the call graph for this function:

◆ distance()

double TPolygon3D::distance ( const TPoint3D point) const

Distance to point (always >=0)

Definition at line 29 of file TPolygon3D.cpp.

References mrpt::math::TPolygon2D::distance(), mrpt::math::TPlane::getAsPose3DForcingOrigin(), getPlane(), mrpt::math::project3D(), and mrpt::math::TPoint3D_data< T >::z.

Here is the call graph for this function:

◆ generate2DObject()

void TPolygon3D::generate2DObject ( TPolygon2D p) const

Projects into a 2D space, discarding the z.

See also
getPlane,isSkew

Definition at line 24 of file TPolygon3D.cpp.

◆ getAsSegmentList()

void TPolygon3D::getAsSegmentList ( std::vector< TSegment3D > &  v) const

Gets as set of segments, instead of set of points.

Definition at line 68 of file TPolygon3D.cpp.

References mrpt::math::size().

Here is the call graph for this function:

◆ getBestFittingPlane()

void TPolygon3D::getBestFittingPlane ( TPlane p) const

Gets the best fitting plane, disregarding whether the polygon actually fits inside or not.

See also
getBestFittingPlane

Definition at line 77 of file TPolygon3D.cpp.

References mrpt::math::getRegressionPlane().

Referenced by mrpt::opengl::CPolyhedron::augment(), and mrpt::math::TPolygonWithPlane::TPolygonWithPlane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCenter()

void TPolygon3D::getCenter ( TPoint3D p) const

Get polygon's central point.

Definition at line 81 of file TPolygon3D.cpp.

References mrpt::containers::begin(), mrpt::containers::end(), mrpt::math::size(), mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.

Referenced by mrpt::opengl::CPolyhedron::augment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlane()

bool TPolygon3D::getPlane ( TPlane p) const

Gets a plane which contains the polygon.

Returns false if the polygon is skew and cannot be fit inside a plane.

Definition at line 76 of file TPolygon3D.cpp.

References mrpt::math::conformAPlane().

Referenced by contains(), distance(), mrpt::math::intersect(), mrpt::opengl::CPolyhedron::setNormal(), and mrpt::math::splitInConvexComponents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSkew()

bool TPolygon3D::isSkew ( ) const

Check whether the polygon is skew.

Returns true if there doesn't exist a plane in which the polygon can fit.

See also
getBestFittingPlane

Definition at line 89 of file TPolygon3D.cpp.

References mrpt::math::conformAPlane().

Here is the call graph for this function:

◆ removeRedundantVertices()

void TPolygon3D::removeRedundantVertices ( )

Erase every redundant vertex, thus saving space.

Definition at line 91 of file TPolygon3D.cpp.

References removeRepeatedVertices(), and mrpt::math::removeUnusedVertices().

Here is the call graph for this function:

◆ removeRepeatedVertices()

void TPolygon3D::removeRepeatedVertices ( )

Remove polygon's repeated vertices.

Definition at line 90 of file TPolygon3D.cpp.

References mrpt::math::removeRepVertices().

Referenced by removeRedundantVertices().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.




Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020