33 #ifndef _projection_mesh_CPP_
34 #define _projection_mesh_CPP_
44 mesh.remove_incident_constraints(it);
59 std::vector<PT::Vertex_handle> vv;
61 for (
size_t i=0; i<p->size();i++)
63 pcl::PointXY pt = p->at(i);
68 vv.push_back(fh->vertex(li));
76 vh->info().weight = 0;
82 for (
size_t i=1; i<vv.size();i++)
84 mesh.insert_constraint(vv[i-1], vv[i]);
86 mesh.insert_constraint(vv[vv.size()-1], vv[0]);
97 vh->info().weight = weight;
115 std::list<PT::Edge>& border )
117 if(start->counter != -1)
121 std::list<PT::Face_handle> queue;
122 queue.push_back(start);
124 while(! queue.empty())
128 if(fh->counter == -1)
131 fh->set_in_domain(index%2 == 1);
132 for(
int i = 0; i < 3; i++)
138 if(ct.is_constrained(e))
156 std::list<PT::Edge> border;
158 while(! border.empty())
175 if (!fc1->is_in_domain())
180 cv::line(*image, cv::Point2d( CGAL::to_double(fc1->vertex(0)->point().x()), CGAL::to_double(fc1->vertex(0)->point().y())), cv::Point2d( CGAL::to_double(fc1->vertex(1)->point().x()), CGAL::to_double(fc1->vertex(1)->point().y())), color, thickness);
181 cv::line(*image, cv::Point2d( CGAL::to_double(fc1->vertex(1)->point().x()), CGAL::to_double(fc1->vertex(1)->point().y())), cv::Point2d( CGAL::to_double(fc1->vertex(2)->point().x()), CGAL::to_double(fc1->vertex(2)->point().y())), color, thickness);
182 cv::line(*image, cv::Point2d( CGAL::to_double(fc1->vertex(0)->point().x()), CGAL::to_double(fc1->vertex(0)->point().y())), cv::Point2d( CGAL::to_double(fc1->vertex(2)->point().x()), CGAL::to_double(fc1->vertex(2)->point().y())), color, thickness);
193 if (!fi->is_in_domain())
198 fi->weight = (fi->vertex(0)->info().weight + fi->vertex(1)->info().weight + fi->vertex(2)->info().weight)/3.0;
208 vertex_list->points.erase(vertex_list->points.begin(), vertex_list->points.end());
209 vertex_list->erase(vertex_list->begin(), vertex_list->end());
215 std::vector<PT::Face_handle> queue;
220 for (
size_t i=0; i<queue.size(); i++)
222 if (queue[i]->visited==
false)
227 nfh = queue[i]->neighbor(0);
228 if (nfh->visited==
false && !
mesh.is_infinite(nfh))
230 queue.push_back(nfh);
233 nfh = queue[i]->neighbor(1);
234 if (nfh->visited==
false && !
mesh.is_infinite(nfh))
236 queue.push_back(nfh);
239 nfh = queue[i]->neighbor(2);
240 if (nfh->visited==
false && !
mesh.is_infinite(nfh))
242 queue.push_back(nfh);
245 queue[i]->visited=
true;
247 if (queue[i]->is_in_domain())
249 for (
int u=0; u<3;u++)
251 pt.x = CGAL::to_double(queue[i]->vertex(u)->point().x());
252 pt.y = CGAL::to_double(queue[i]->vertex(u)->point().y());
253 pt.z = CGAL::to_double(queue[i]->vertex(u)->info().z);
254 pt.rgb = queue[i]->vertex(u)->info().rgb;
255 vertex_list->points.push_back(pt);
257 face_weights->push_back(queue[i]->weight);
259 queue.erase(queue.begin()+i);
271 vertex_list->points.erase(vertex_list->points.begin(), vertex_list->points.end());
272 vertex_list->erase(vertex_list->begin(), vertex_list->end());
278 if (!fi->is_in_domain())
283 for (
int u=0; u<3;u++)
285 pt.x = CGAL::to_double(fi->vertex(u)->point().x());
286 pt.y = CGAL::to_double(fi->vertex(u)->point().y());
287 pt.z = CGAL::to_double(fi->vertex(u)->info().z);
288 pt.rgb = fi->vertex(u)->info().rgb;
289 vertex_list->points.push_back(pt);
292 face_weights->push_back(fi->weight);
int initialize_all_faces_status(void)
int compute_face_weights(void)
void discoverComponents(const PT &ct)
CDT::All_faces_iterator All_faces_iterator
CDT::Vertex_iterator Vertex_iterator
int draw_mesh_triangles(cv::Mat *image, cv::Scalar color, int thickness)
int clear_constraints(void)
Ss::Vertex_handle Vertex_handle
void discoverComponent(const PT &ct, PT::Face_handle start, int index, std::list< PT::Edge > &border)
int initialize_visited(void)
Header for projection mesh.
int set_constraint_polygon(std::vector< pcl::PointXY > *p)
CGAL::Constrained_triangulation_plus_2< CGAL::Constrained_Delaunay_triangulation_2< K, TDS_projection_mesh, CGAL::No_intersection_tag > > PT
Delaunay::Locate_type Locate_type
int add_vertex_to_mesh(double x, double y, double z, float rgb, float weight)
int export_triangles_in_order(pcl::PointCloud< pcl::PointXYZRGB > *vertex_list, std::vector< float > *face_weights)
CDT::Finite_faces_iterator Finite_faces_iterator
CDT::Face_handle Face_handle
int export_triangles(pcl::PointCloud< pcl::PointXYZRGB > *vertex_list, std::vector< float > *face_weights)