mirror of https://github.com/CGAL/cgal
Fix offset computation trigger.
This commit is contained in:
parent
e38dbfe3a3
commit
71a99a2700
|
|
@ -7,6 +7,7 @@
|
||||||
#include <CGAL/Three/TextRenderer.h>
|
#include <CGAL/Three/TextRenderer.h>
|
||||||
#include <CGAL/Three/exceptions.h>
|
#include <CGAL/Three/exceptions.h>
|
||||||
#include <CGAL/Qt/debug.h>
|
#include <CGAL/Qt/debug.h>
|
||||||
|
#include <CGAL/double.h>
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
@ -1007,13 +1008,17 @@ void MainWindow::computeViewerBBox(CGAL::qglviewer::Vec& min, CGAL::qglviewer::V
|
||||||
max= CGAL::qglviewer::Vec(xmax, ymax, zmax);
|
max= CGAL::qglviewer::Vec(xmax, ymax, zmax);
|
||||||
|
|
||||||
CGAL::qglviewer::Vec bbox_center((xmin+xmax)/2, (ymin+ymax)/2, (zmin+zmax)/2);
|
CGAL::qglviewer::Vec bbox_center((xmin+xmax)/2, (ymin+ymax)/2, (zmin+zmax)/2);
|
||||||
|
double bbox_diag = CGAL::approximate_sqrt(
|
||||||
|
(xmax - xmin)*(xmax - xmin)
|
||||||
|
+ (ymax - ymin)*(ymax - ymin)
|
||||||
|
+ (zmax - zmin)*(zmax - zmin));
|
||||||
|
|
||||||
CGAL::qglviewer::Vec offset(0,0,0);
|
CGAL::qglviewer::Vec offset(0,0,0);
|
||||||
|
|
||||||
double l_dist = (std::max)((std::abs)(bbox_center.x - viewer->offset().x),
|
double l_dist = (std::max)((std::abs)(bbox_center.x - viewer->offset().x),
|
||||||
(std::max)((std::abs)(bbox_center.y - viewer->offset().y),
|
(std::max)((std::abs)(bbox_center.y - viewer->offset().y),
|
||||||
(std::abs)(bbox_center.z - viewer->offset().z)));
|
(std::abs)(bbox_center.z - viewer->offset().z)));
|
||||||
if((std::log2)(l_dist) > 13.0 )
|
if((std::log2)(l_dist/bbox_diag) > 13.0 )
|
||||||
for(int i=0; i<3; ++i)
|
for(int i=0; i<3; ++i)
|
||||||
{
|
{
|
||||||
offset[i] = -bbox_center[i];
|
offset[i] = -bbox_center[i];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue