The ear clipping triangulation algorithm. The code is inspired by Flavien Brebion implementation, which is in n^3 and does not handle holes. More...
#include <ear_clipping.h>
Public Member Functions | |
EarClipping () | |
Empty constructor. | |
Protected Member Functions | |
float | area (const std::vector< uint32_t > &vertices) |
Compute the signed area of a polygon. | |
float | crossProduct (const Eigen::Vector2f &p1, const Eigen::Vector2f &p2) const |
Compute the cross product between 2D vectors. | |
bool | initCompute () |
This method should get called before starting the actual computation. | |
bool | isEar (int u, int v, int w, const std::vector< uint32_t > &vertices) |
Check if the triangle (u,v,w) is an ear. | |
bool | isInsideTriangle (const Eigen::Vector2f &u, const Eigen::Vector2f &v, const Eigen::Vector2f &w, const Eigen::Vector2f &p) |
Check if p is inside the triangle (u,v,w). | |
void | performProcessing (pcl::PolygonMesh &output) |
The actual surface reconstruction method. | |
void | triangulate (const Vertices &vertices, PolygonMesh &output) |
Triangulate one polygon. | |
Protected Attributes | |
pcl::PointCloud< pcl::PointXYZ > ::Ptr | points_ |
a Pointer to the point cloud data. |
The ear clipping triangulation algorithm. The code is inspired by Flavien Brebion implementation, which is in n^3 and does not handle holes.
Definition at line 53 of file ear_clipping.h.
pcl::EarClipping::EarClipping | ( | ) | [inline] |
Empty constructor.
Definition at line 59 of file ear_clipping.h.
float pcl::EarClipping::area | ( | const std::vector< uint32_t > & | vertices | ) | [protected] |
Compute the signed area of a polygon.
[in] | vertices | the vertices representing the polygon |
Definition at line 110 of file ear_clipping.cpp.
float pcl::EarClipping::crossProduct | ( | const Eigen::Vector2f & | p1, |
const Eigen::Vector2f & | p2 | ||
) | const [inline, protected] |
Compute the cross product between 2D vectors.
[in] | p1 | the first 2D vector |
[in] | p2 | the first 2D vector |
Definition at line 117 of file ear_clipping.h.
bool pcl::EarClipping::initCompute | ( | ) | [protected, virtual] |
This method should get called before starting the actual computation.
Reimplemented from pcl::MeshProcessing.
Definition at line 44 of file ear_clipping.cpp.
bool pcl::EarClipping::isEar | ( | int | u, |
int | v, | ||
int | w, | ||
const std::vector< uint32_t > & | vertices | ||
) | [protected] |
Check if the triangle (u,v,w) is an ear.
[in] | u | the first triangle vertex |
[in] | v | the second triangle vertex |
[in] | w | the third triangle vertex |
[in] | vertices | a set of input vertices |
Definition at line 130 of file ear_clipping.cpp.
bool pcl::EarClipping::isInsideTriangle | ( | const Eigen::Vector2f & | u, |
const Eigen::Vector2f & | v, | ||
const Eigen::Vector2f & | w, | ||
const Eigen::Vector2f & | p | ||
) | [protected] |
Check if p is inside the triangle (u,v,w).
[in] | u | the first triangle vertex |
[in] | v | the second triangle vertex |
[in] | w | the third triangle vertex |
[in] | p | the point to check |
Definition at line 166 of file ear_clipping.cpp.
void pcl::EarClipping::performProcessing | ( | pcl::PolygonMesh & | output | ) | [protected, virtual] |
The actual surface reconstruction method.
[out] | output | the output polygonal mesh |
Implements pcl::MeshProcessing.
Definition at line 57 of file ear_clipping.cpp.
void pcl::EarClipping::triangulate | ( | const Vertices & | vertices, |
PolygonMesh & | output | ||
) | [protected] |
Triangulate one polygon.
[in] | vertices | the set of vertices |
[out] | output | the resultant polygonal mesh |
Definition at line 67 of file ear_clipping.cpp.
pcl::PointCloud<pcl::PointXYZ>::Ptr pcl::EarClipping::points_ [protected] |
a Pointer to the point cloud data.
Definition at line 61 of file ear_clipping.h.