41 #ifndef PCL_SURFACE_ORGANIZED_FAST_MESH_H_
42 #define PCL_SURFACE_ORGANIZED_FAST_MESH_H_
44 #include <pcl/common/angles.h>
45 #include <pcl/surface/reconstruction.h>
64 template <
typename Po
intInT>
68 typedef boost::shared_ptr<OrganizedFastMesh<PointInT> >
Ptr;
69 typedef boost::shared_ptr<const OrganizedFastMesh<PointInT> >
ConstPtr;
209 addTriangle (
int a,
int b,
int c,
int idx, std::vector<pcl::Vertices>& polygons)
211 assert (idx < static_cast<int> (polygons.size ()));
212 polygons[idx].vertices.resize (3);
213 polygons[idx].vertices[0] = a;
214 polygons[idx].vertices[1] = b;
215 polygons[idx].vertices[2] = c;
227 addQuad (
int a,
int b,
int c,
int d,
int idx, std::vector<pcl::Vertices>& polygons)
229 assert (idx < static_cast<int> (polygons.size ()));
230 polygons[idx].vertices.resize (4);
231 polygons[idx].vertices[0] = a;
232 polygons[idx].vertices[1] = b;
233 polygons[idx].vertices[2] = c;
234 polygons[idx].vertices[3] = d;
247 int field_x_idx = 0,
int field_y_idx = 1,
int field_z_idx = 2)
249 float new_value = value;
260 isShadowed (
const PointInT& point_a,
const PointInT& point_b)
262 Eigen::Vector3f viewpoint = Eigen::Vector3f::Zero ();
263 Eigen::Vector3f dir_a = viewpoint - point_a.getVector3fMap ();
264 Eigen::Vector3f dir_b = point_b.getVector3fMap () - point_a.getVector3fMap ();
265 float distance_to_points = dir_a.norm ();
266 float distance_between_points = dir_b.norm ();
267 float cos_angle = dir_a.dot (dir_b) / (distance_to_points*distance_between_points);
268 if (cos_angle != cos_angle)
309 isValidQuad (
const int& a,
const int& b,
const int& c,
const int& d)
360 #ifdef PCL_NO_PRECOMPILE
361 #include <pcl/surface/impl/organized_fast_mesh.hpp>
364 #endif // PCL_SURFACE_ORGANIZED_FAST_MESH_H_
void reconstructPolygons(std::vector< pcl::Vertices > &polygons)
Perform the actual polygonal reconstruction.
boost::shared_ptr< OrganizedFastMesh< PointInT > > Ptr
void makeAdaptiveCutMesh(std::vector< pcl::Vertices > &polygons)
Create an adaptive cut mesh.
bool isShadowedQuad(const int &a, const int &b, const int &c, const int &d)
Check if a triangle is shadowed.
void addQuad(int a, int b, int c, int d, int idx, std::vector< pcl::Vertices > &polygons)
Add a new quad to the current polygon mesh.
Simple triangulation/surface reconstruction for organized point clouds.
float max_edge_length_squared_
max (squared) length of edge
bool isShadowed(const PointInT &point_a, const PointInT &point_b)
Check if a point is shadowed by another point.
void makeQuadMesh(std::vector< pcl::Vertices > &polygons)
Create a quad mesh.
int triangle_pixel_size_columns_
size of triangle edges (in pixels) for iterating over columns
virtual ~OrganizedFastMesh()
Destructor.
void makeLeftCutMesh(std::vector< pcl::Vertices > &polygons)
Create a left cut mesh.
OrganizedFastMesh()
Constructor.
int triangle_pixel_size_rows_
size of triangle edges (in pixels) for iterating over rows.
MeshConstruction represents a base surface reconstruction class.
TriangulationType triangulation_type_
Type of meshing scheme (quads vs.
std::vector< ::pcl::PCLPointField > fields
float deg2rad(float alpha)
Convert an angle from degrees to radians.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested.
void setTrianglePixelSize(int triangle_size)
Set the edge length (in pixels) used for constructing the fixed mesh.
virtual void performReconstruction(std::vector< pcl::Vertices > &polygons)
Create the surface.
void setTrianglePixelSizeColumns(int triangle_size)
Set the edge length (in pixels) used for iterating over columns when constructing the fixed mesh...
boost::shared_ptr< PointCloud< PointT > > Ptr
bool isValidQuad(const int &a, const int &b, const int &c, const int &d)
Check if a quad is valid.
void makeRightCutMesh(std::vector< pcl::Vertices > &polygons)
Create a right cut mesh.
boost::shared_ptr< const OrganizedFastMesh< PointInT > > ConstPtr
std::vector< pcl::Vertices > Polygons
pcl::PointCloud< PointInT >::Ptr PointCloudPtr
bool isValidTriangle(const int &a, const int &b, const int &c)
Check if a triangle is valid.
bool isShadowedTriangle(const int &a, const int &b, const int &c)
Check if a triangle is shadowed.
void setMaxEdgeLength(float max_edge_length)
Set a maximum edge length.
bool store_shadowed_faces_
Whether or not shadowed faces are stored, e.g., for exploration.
::pcl::PCLPointCloud2 cloud
void storeShadowedFaces(bool enable)
Store shadowed faces or not.
float cos_angle_tolerance_
(Cosine of the) angle tolerance used when checking whether or not an edge between two points is shado...
void resetPointData(const int &point_index, pcl::PolygonMesh &mesh, const float &value=0.0f, int field_x_idx=0, int field_y_idx=1, int field_z_idx=2)
Set (all) coordinates of a particular point to the specified value.
PointCloudConstPtr input_
The input point cloud dataset.
void setTrianglePixelSizeRows(int triangle_size)
Set the edge length (in pixels) used for iterating over rows when constructing the fixed mesh...
std::vector< pcl::uint8_t > data
bool check_tree_
A flag specifying whether or not the derived reconstruction algorithm needs the search object tree...
void setTriangulationType(TriangulationType type)
Set the triangulation type (see TriangulationType)
void addTriangle(int a, int b, int c, int idx, std::vector< pcl::Vertices > &polygons)
Add a new triangle to the current polygon mesh.