diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.cpp b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.cpp index 03e188afc4d..3bcaa4f3eac 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.cpp +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.cpp @@ -14,10 +14,10 @@ Viewer::Viewer(QWidget* parent ) { draw_balls = true; draw_inputs = false; - create_flat_sphere(1.0f, pos_sphere, normals, 9); trivial_center.push_back(0.); trivial_center.push_back(0.); trivial_center.push_back(0.); + radius_ = 1.0; } void Viewer::compile_shaders() @@ -222,6 +222,9 @@ void Viewer::compute_elements() { pos_sphere_inter.clear(); normals_inter.clear(); + pos_sphere.clear(); + normals.clear(); + create_flat_sphere(static_cast(radius_), pos_sphere, normals, 9); create_flat_sphere(0.05f, pos_sphere_inter, normals_inter, 36); pos_points.resize(0); @@ -256,6 +259,8 @@ void Viewer::compute_elements() pos_lines.push_back(arc[i+1].z()); } } + setSceneRadius(radius_*1.3); + showEntireScene(); } void Viewer::attrib_buffers(CGAL::QGLViewer* viewer) diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.h b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.h index 3677a988cff..ab38432f9e8 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.h +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/Viewer.h @@ -89,7 +89,8 @@ public: normals_inter.clear(); normals_lines.clear(); - min_edge_size = 0.01 * tos.geom_traits().radius(); + radius_ = tos.geom_traits().radius(); + min_edge_size = 0.01 * radius_; std::copy(begin, end, std::back_inserter(inputs)); build_the_boundary(tos); @@ -162,6 +163,7 @@ private: typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced; PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor; + double radius_; void initialize_buffers(); void compute_elements(); diff --git a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp index 915a79233ac..7e81a3f8bf8 100644 --- a/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp +++ b/Triangulation_on_sphere_2/demo/Triangulation_on_sphere_2/main.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -62,7 +63,7 @@ public slots: read_points(filename.toUtf8().data(), std::back_inserter(lst_pt)); const Point_3 center(0,0,0); - const FT radius = 1.0; + const FT radius = QInputDialog::getDouble(nullptr, "Radius", "Radius of the sphere", 1.0, 0.0); Projection_traits traits(center, radius); Projected_DToS2 dtos(lst_pt.begin(), lst_pt.end(), traits);