104 int i = 0, index_down = 0, index_right = 0, index_down_right = 0, idx = 0;
116 index_down = i + y_big_incr;
117 index_down_right = i + x_big_incr;
126 if (
isValidQuad (i, index_right, index_down_right, index_down))
128 addQuad (i, index_right, index_down_right, index_down, idx++, polygons);
131 polygons.resize (idx);
141 int i = 0, index_down = 0, index_right = 0, index_down_right = 0, idx = 0;
153 index_down = i + y_big_incr;
154 index_down_right = i + x_big_incr;
165 addTriangle (i, index_down_right, index_right, idx++, polygons);
169 addTriangle (i, index_down, index_down_right, idx++, polygons);
172 polygons.resize (idx);
182 int i = 0, index_down = 0, index_right = 0, index_down_right = 0, idx = 0;
194 index_down = i + y_big_incr;
195 index_down_right = i + x_big_incr;
206 addTriangle (i, index_down, index_right, idx++, polygons);
210 addTriangle (index_right, index_down, index_down_right, idx++, polygons);
213 polygons.resize (idx);
233 int i = y *
input_->width;
235 int index_down = i + y_big_incr;
236 int index_down_right = i + x_big_incr;
245 const bool right_cut_upper =
isValidTriangle (i, index_down_right, index_right);
246 const bool right_cut_lower =
isValidTriangle (i, index_down, index_down_right);
247 const bool left_cut_upper =
isValidTriangle (i, index_down, index_right);
248 const bool left_cut_lower =
isValidTriangle (index_right, index_down, index_down_right);
250 if (right_cut_upper && right_cut_lower && left_cut_upper && left_cut_lower)
252 float dist_right_cut = std::abs ((*
input_)[index_down].z - (*
input_)[index_right].z);
253 float dist_left_cut = std::abs ((*
input_)[i].z - (*
input_)[index_down_right].z);
254 if (dist_right_cut >= dist_left_cut)
257 addTriangle (i, index_down_right, index_right, idx++, polygons);
259 addTriangle (i, index_down, index_down_right, idx++, polygons);
264 addTriangle (i, index_down, index_right, idx++, polygons);
266 addTriangle (index_right, index_down, index_down_right, idx++, polygons);
273 addTriangle (i, index_down_right, index_right, idx++, polygons);
276 addTriangle (i, index_down, index_down_right, idx++, polygons);
279 addTriangle (i, index_down, index_right, idx++, polygons);
282 addTriangle (index_right, index_down, index_down_right, idx++, polygons);
286 polygons.resize (idx);
void addTriangle(int a, int b, int c, int idx, std::vector< pcl::Vertices > &polygons)
Add a new triangle to the current polygon mesh.
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.
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.