41 #ifndef PCL_SURFACE_ORGANIZED_FAST_MESH_H_
42 #define PCL_SURFACE_ORGANIZED_FAST_MESH_H_
57 template <
typename Po
intInT>
78 : max_edge_length_squared_ (0.025f)
79 , triangle_pixel_size_ (1)
81 , store_shadowed_faces_ (false)
82 , cos_angle_tolerance_ (fabsf (cosf (pcl::
deg2rad (12.5f))))
96 max_edge_length_squared_ = max_edge_length * max_edge_length;
106 triangle_pixel_size_ = std::max (1, (triangle_size - 1));
116 triangulation_type_ = type;
125 store_shadowed_faces_ = enable;
130 float max_edge_length_squared_;
133 int triangle_pixel_size_;
139 bool store_shadowed_faces_;
141 float cos_angle_tolerance_;
147 reconstructPolygons (std::vector<pcl::Vertices>& polygons);
153 performReconstruction (std::vector<pcl::Vertices> &polygons);
173 addTriangle (
int a,
int b,
int c,
int idx, std::vector<pcl::Vertices>& polygons)
175 assert (idx < static_cast<int> (polygons.size ()));
176 polygons[idx].vertices.resize (3);
177 polygons[idx].vertices[0] = a;
178 polygons[idx].vertices[1] = b;
179 polygons[idx].vertices[2] = c;
191 addQuad (
int a,
int b,
int c,
int d,
int idx, std::vector<pcl::Vertices>& polygons)
193 assert (idx < static_cast<int> (polygons.size ()));
194 polygons[idx].vertices.resize (4);
195 polygons[idx].vertices[0] = a;
196 polygons[idx].vertices[1] = b;
197 polygons[idx].vertices[2] = c;
198 polygons[idx].vertices[3] = d;
210 resetPointData (
const int &point_index,
pcl::PolygonMesh &mesh,
const float &value = 0.0f,
211 int field_x_idx = 0,
int field_y_idx = 1,
int field_z_idx = 2)
213 float new_value = value;
224 isShadowed (
const PointInT& point_a,
const PointInT& point_b)
226 Eigen::Vector3f viewpoint = Eigen::Vector3f::Zero ();
227 Eigen::Vector3f dir_a = viewpoint - point_a.getVector3fMap ();
228 Eigen::Vector3f dir_b = point_b.getVector3fMap () - point_a.getVector3fMap ();
229 float distance_to_points = dir_a.norm ();
230 float distance_between_points = dir_b.norm ();
231 float cos_angle = dir_a.dot (dir_b) / (distance_to_points*distance_between_points);
232 if (cos_angle != cos_angle)
234 return (fabs (cos_angle) >= cos_angle_tolerance_);
244 isValidTriangle (
const int& a,
const int& b,
const int& c)
258 isShadowedTriangle (
const int& a,
const int& b,
const int& c)
260 if (isShadowed (input_->points[a], input_->points[b]))
return (
true);
261 if (isShadowed (input_->points[b], input_->points[c]))
return (
true);
262 if (isShadowed (input_->points[c], input_->points[a]))
return (
true);
273 isValidQuad (
const int& a,
const int& b,
const int& c,
const int& d)
289 isShadowedQuad (
const int& a,
const int& b,
const int& c,
const int& d)
291 if (isShadowed (input_->points[a], input_->points[b]))
return (
true);
292 if (isShadowed (input_->points[b], input_->points[c]))
return (
true);
293 if (isShadowed (input_->points[c], input_->points[d]))
return (
true);
294 if (isShadowed (input_->points[d], input_->points[a]))
return (
true);
302 makeQuadMesh (std::vector<pcl::Vertices>& polygons);
308 makeRightCutMesh (std::vector<pcl::Vertices>& polygons);
314 makeLeftCutMesh (std::vector<pcl::Vertices>& polygons);
320 makeAdaptiveCutMesh (std::vector<pcl::Vertices>& polygons);
324 #endif // PCL_SURFACE_ORGANIZED_FAST_MESH_H_