mirror of https://github.com/CGAL/cgal
Add an input for the radius when loading
This commit is contained in:
parent
0db011256a
commit
54b71f6cf3
|
|
@ -14,10 +14,10 @@ Viewer::Viewer(QWidget* parent )
|
||||||
{
|
{
|
||||||
draw_balls = true;
|
draw_balls = true;
|
||||||
draw_inputs = false;
|
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.);
|
trivial_center.push_back(0.);
|
||||||
trivial_center.push_back(0.);
|
trivial_center.push_back(0.);
|
||||||
|
radius_ = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::compile_shaders()
|
void Viewer::compile_shaders()
|
||||||
|
|
@ -222,6 +222,9 @@ void Viewer::compute_elements()
|
||||||
{
|
{
|
||||||
pos_sphere_inter.clear();
|
pos_sphere_inter.clear();
|
||||||
normals_inter.clear();
|
normals_inter.clear();
|
||||||
|
pos_sphere.clear();
|
||||||
|
normals.clear();
|
||||||
|
create_flat_sphere(static_cast<float>(radius_), pos_sphere, normals, 9);
|
||||||
create_flat_sphere(0.05f, pos_sphere_inter, normals_inter, 36);
|
create_flat_sphere(0.05f, pos_sphere_inter, normals_inter, 36);
|
||||||
|
|
||||||
pos_points.resize(0);
|
pos_points.resize(0);
|
||||||
|
|
@ -256,6 +259,8 @@ void Viewer::compute_elements()
|
||||||
pos_lines.push_back(arc[i+1].z());
|
pos_lines.push_back(arc[i+1].z());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setSceneRadius(radius_*1.3);
|
||||||
|
showEntireScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::attrib_buffers(CGAL::QGLViewer* viewer)
|
void Viewer::attrib_buffers(CGAL::QGLViewer* viewer)
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ public:
|
||||||
normals_inter.clear();
|
normals_inter.clear();
|
||||||
normals_lines.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));
|
std::copy(begin, end, std::back_inserter(inputs));
|
||||||
build_the_boundary(tos);
|
build_the_boundary(tos);
|
||||||
|
|
@ -162,6 +163,7 @@ private:
|
||||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
||||||
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
PFNGLDRAWARRAYSINSTANCEDARBPROC glDrawArraysInstanced;
|
||||||
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
PFNGLVERTEXATTRIBDIVISORARBPROC glVertexAttribDivisor;
|
||||||
|
double radius_;
|
||||||
|
|
||||||
void initialize_buffers();
|
void initialize_buffers();
|
||||||
void compute_elements();
|
void compute_elements();
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QInputDialog>
|
||||||
|
|
||||||
#include <boost/iterator/transform_iterator.hpp>
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ public slots:
|
||||||
read_points(filename.toUtf8().data(), std::back_inserter(lst_pt));
|
read_points(filename.toUtf8().data(), std::back_inserter(lst_pt));
|
||||||
|
|
||||||
const Point_3 center(0,0,0);
|
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);
|
Projection_traits traits(center, radius);
|
||||||
Projected_DToS2 dtos(lst_pt.begin(), lst_pt.end(), traits);
|
Projected_DToS2 dtos(lst_pt.begin(), lst_pt.end(), traits);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue