diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizDoc_4.cpp b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizDoc_4.cpp index e26e00fe132..8d41b478710 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizDoc_4.cpp +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/GyrovizDoc_4.cpp @@ -13,6 +13,8 @@ using namespace cimg_library; #include #include +#include +#include #ifdef _DEBUG #define new DEBUG_NEW @@ -265,7 +267,7 @@ bool CGyrovizDoc_4::read_sequence(const std::string& first_image, int image_index = atoi(image_name.substr(image_base_length, image_number_of_digits).c_str()); std::ostringstream out; - out << setfill('0') << std::setw(feature_file_number_of_digits) << image_index; + out << std::setfill('0') << std::setw(feature_file_number_of_digits) << image_index; std::string feature_index = out.str(); std::string feature_file_name = feature_file_base + feature_index + feature_file_extension; diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_border_points_dt2.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_border_points_dt2.h index 2f6a30828f4..5b89a66028c 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_border_points_dt2.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_border_points_dt2.h @@ -8,10 +8,10 @@ #include #include -//#include "Gyroviz_vertex_segment_2.h" +#include "Gyroviz_vertex_segment_2.h" #include -template < class Gt, class Tds > +template < class Gt, class Tds, class Cdt2VertexHandle > class Gyroviz_border_points_dt2 : public CGAL::Delaunay_triangulation_2 { // Private types @@ -30,15 +30,16 @@ public: typedef typename Geom_traits::Segment_2 Segment_2; typedef typename Base::Face_handle Face_handle; typedef typename Base::Vertex_handle Vertex_handle; + typedef typename Base::Vertex Vertex; typedef typename Base::Edge Edge; typedef typename Base::Finite_edges_iterator Finite_edges_iterator; typedef typename Base::Finite_faces_iterator Finite_faces_iterator; typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator; - //typedef typename Gyroviz_vertex_segment_2 Gyroviz_vertex_segment_2; + typedef typename Gyroviz_vertex_segment_2 Gyroviz_vertex_segment_2; - // Data members -private: - std::vector input; +// // Data members +//private: +// std::vector input; // Public methods public: @@ -46,11 +47,13 @@ public: // Constructors Gyroviz_border_points_dt2(){} - Gyroviz_border_points_dt2(std::vector in) + Gyroviz_border_points_dt2(std::vector original_vertices) { - for(int i=0; iinsert(in[i]->point()); + Vertex_handle vh = this->insert(original_vertices[i]->point()); + //vh->info().set_ptr(&*original_vertices[i]); + vh->info() = original_vertices[i]; } } @@ -59,19 +62,22 @@ public: // this function will store as a vector of Gyroviz_vertex_segment_2 // the entire 2D Delaunay triangulation - std::vector segments_out_of_dt2() + std::vector segments_out_of_dt2() { - std::vector result; + std::vector result; Finite_edges_iterator fe = this->finite_edges_begin(); for(; fe != this->finite_edges_end(); ++fe) { - //Vertex_handle first_vertex(fe->first->vertex(ccw(fe->second))); + Vertex_handle first_vertex(fe->first->vertex(ccw(fe->second))); //result.push_back(first_vertex); - //Vertex_handle second_vertex(fe->first->vertex(cw(fe->second))); + Vertex_handle second_vertex(fe->first->vertex(cw(fe->second))); //result.push_back(second_vertex); - Segment_2 curr_segment(fe->first->vertex(ccw(fe->second))->point(), - fe->first->vertex(cw(fe->second))->point()); + //Vertex_handle original_first_vertex = (Vertex*) first_vertex->info().get_ptr(); + //Vertex_handle original_second_vertex = (Vertex*) second_vertex->info().get_ptr(); + Cdt2VertexHandle original_first_vertex = first_vertex->info(); + Cdt2VertexHandle original_second_vertex = second_vertex->info(); + Gyroviz_vertex_segment_2 curr_segment(original_first_vertex, original_second_vertex); result.push_back(curr_segment); } diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_cdt2.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_cdt2.h index 63de8a46863..20274d56b6d 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_cdt2.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_cdt2.h @@ -19,7 +19,6 @@ #include #include "Gyroviz_info_for_cdt2.h" -//#include "Gyroviz_vertex_segment_2.h" #include "Gyroviz_border_points_dt2.h" #include "Gyroviz_triangle_with_cam.h" #include "Gyroviz_constrained_triangle_soup.h" @@ -66,7 +65,7 @@ public: typedef typename Base::Finite_edges_iterator Finite_edges_iterator; typedef typename Base::Finite_faces_iterator Finite_faces_iterator; typedef typename Base::Finite_vertices_iterator Finite_vertices_iterator; - //typedef typename Gyroviz_vertex_segment_2 Gyroviz_vertex_segment_2; + typedef typename Gyroviz_vertex_segment_2 Gyroviz_vertex_segment_2; typedef typename Gyroviz_triangle_with_cam Gyroviz_triangle_with_cam; typedef typename Gyroviz_constrained_triangle_soup Gyroviz_constrained_triangle_soup; @@ -127,6 +126,8 @@ public: Vertex_handle vh = this->insert(point_2); vh->info() = Gyroviz_info_for_cdt2(point_3,image_number,false); + //vh->info().set_point3(point_3); + //vh->info().set_camera_number(image_number); number_of_vertices_pnt++; } } @@ -332,9 +333,12 @@ public: std::vector vector_of_border_points = set_on_border_2D_vertices(image); - Gyroviz_border_points_dt2 border_dt2(vector_of_border_points); + typedef CGAL::Triangulation_vertex_base_with_info_2 Gyroviz_border_points_Vb; + typedef CGAL::Constrained_triangulation_face_base_2 Gyroviz_border_points_Fb; + typedef CGAL::Triangulation_data_structure_2 Gyroviz_border_points_Tds; + Gyroviz_border_points_dt2 border_dt2(vector_of_border_points); - std::vector vector_of_vertex_segments = border_dt2.segments_out_of_dt2(); + std::vector vector_of_vertex_segments = border_dt2.segments_out_of_dt2(); Point_2 source_vertex; Point_2 end_vertex; @@ -351,18 +355,19 @@ public: // S(Border/Segment) = +1 // S(Gap/Segment) = gap_score (default : -2) - for(int i = 0; ipoint(); - //end_vertex = end_handle->point(); - //Segment_2 s = (source_vertex, end_vertex); + source_handle = vector_of_vertex_segments[i].get_source(); + end_handle = vector_of_vertex_segments[i].get_target(); + + source_vertex = source_handle->point(); + end_vertex = end_handle->point(); + Segment_2 s (source_vertex, end_vertex); - source_vertex = vector_of_vertex_segments[i].source(); + /*source_vertex = vector_of_vertex_segments[i].source(); end_vertex = vector_of_vertex_segments[i].target(); - Segment_2 s = vector_of_vertex_segments[i]; + Segment_2 s = vector_of_vertex_segments[i];*/ v = end_vertex - source_vertex; length_curr_segment = (int)ceil(sqrt(s.squared_length())); @@ -390,7 +395,7 @@ public: if(global_score >= 0) { - this->insert_constraint(source_vertex,end_vertex/*source_handle,end_handle*/); + this->insert_constraint(/*source_vertex,end_vertex*/source_handle,end_handle); vector_of_constraints.push_back(s); global_score = 0; } diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_info_for_cdt2.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_info_for_cdt2.h index 409a1828bed..924adeb8966 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_info_for_cdt2.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_info_for_cdt2.h @@ -20,19 +20,26 @@ protected: // Flag := on border or not bool flag; + //void* ptr; + public: - Gyroviz_info_for_cdt2(){} - Gyroviz_info_for_cdt2(Point_3 p, int cam_num, bool f):point(p),camera_number(cam_num),flag(f){} + Gyroviz_info_for_cdt2() : flag(false)/*, ptr(NULL)*/ {} + Gyroviz_info_for_cdt2(Point_3 p, int cam_num, bool f) + : point(p),camera_number(cam_num),flag(f) {} + //Gyroviz_info_for_cdt2(Point_3 p, int cam_num, bool f, void* pr) + // : point(p),camera_number(cam_num),flag(f),ptr(pr) {} // accessors const Point_3 get_point3() const { return point; } const int get_camera_number() const { return camera_number; } const bool get_flag() const { return flag; } + //const void* get_ptr() const { return ptr; } // modificators void set_point3(Point_3 point3) { point = point3; } - void set_camera_number(int cam_num) { camera_number = cam_num; } + void set_camera_number(int cam_num) { camera_number = cam_num; } void set_flag(bool f) { flag = f; } + //void set_ptr(void* pr) { ptr = pr; } }; #endif // _Gyroviz_info_for_cdt2_ \ No newline at end of file diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_triangle_with_cam.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_triangle_with_cam.h index 6478f6c8a9f..b2044226cdb 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_triangle_with_cam.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_triangle_with_cam.h @@ -28,11 +28,11 @@ public: Gyroviz_triangle_with_cam(Triangle_3 t, int cam_num):triangle(t),camera_number(cam_num){} // accessors - const Triangle_3& get_triangle3() const { return triangle; } + const Triangle_3& get_triangle3() const { return triangle; } const int get_camera_number() const { return camera_number; } // modificators - void set_triangle3(Triangle_3 t) { triangle = t; } + void set_triangle3(Triangle_3 t) { triangle = t; } void set_camera_number(int camera_num) { camera_number = camera_num;} diff --git a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vertex_segment_2.h b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vertex_segment_2.h index 7d0f4f99aae..87b5472c7b5 100644 --- a/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vertex_segment_2.h +++ b/Surface_reconstruction_3/demo/Surface_reconstruction_3/gyroviz/Gyroviz_vertex_segment_2.h @@ -11,15 +11,15 @@ #ifndef _Gyroviz_vertex_segment_2_ #define _Gyroviz_vertex_segment_2_ -#include - -template < class Triangulation > +template < class Cdt2VertexHandle > class Gyroviz_vertex_segment_2 { -protected: +public: - typedef typename Triangulation::Vertex_handle Vertex_handle; + typedef Cdt2VertexHandle Vertex_handle; + +protected: // Vertex_handles Vertex_handle source;