mirror of https://github.com/CGAL/cgal
Address problems in last test suite run
https://cgal.geometryfactory.com/CGAL/testsuite/results-5.2-Ic-11.shtml#Arrangement_on_surface_2_Demo
This commit is contained in:
parent
a4530b825c
commit
a59f2d6a51
|
|
@ -30,9 +30,8 @@
|
|||
#include <CGAL/Qt/GraphicsViewNavigation.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <limits>
|
||||
|
||||
static constexpr double MAX_WIDTH =
|
||||
std::numeric_limits<double>::max() / 1048576;
|
||||
|
||||
ArrangementDemoTabBase::ArrangementDemoTabBase( QWidget* parent ) :
|
||||
QWidget( parent ),
|
||||
|
|
@ -59,6 +58,8 @@ void ArrangementDemoTabBase::setupUi( )
|
|||
this->layout->addWidget( this->graphicsView, 0, 0 );
|
||||
this->graphicsView->setScene( scene );
|
||||
|
||||
double MAX_WIDTH = std::numeric_limits<double>::max() / 1048576;
|
||||
|
||||
double xymin = -MAX_WIDTH / 2;
|
||||
double wh = MAX_WIDTH;
|
||||
scene->setSceneRect(xymin, xymin, wh, wh);
|
||||
|
|
@ -435,8 +436,8 @@ static bool isFinite(const CGAL::Bbox_2& box)
|
|||
static CGAL::Bbox_2 addMargins(const CGAL::Bbox_2& box)
|
||||
{
|
||||
// add margin to bounding box
|
||||
float x_margin;
|
||||
float y_margin;
|
||||
double x_margin;
|
||||
double y_margin;
|
||||
if (box.xmin() == box.xmax() || box.ymin() == box.ymax())
|
||||
{
|
||||
static constexpr float const_margin = 50;
|
||||
|
|
@ -445,7 +446,7 @@ static CGAL::Bbox_2 addMargins(const CGAL::Bbox_2& box)
|
|||
}
|
||||
else
|
||||
{
|
||||
static constexpr float prop_margin = 0.10;
|
||||
static constexpr double prop_margin = 0.10;
|
||||
x_margin = (box.xmax() - box.xmin()) * prop_margin;
|
||||
y_margin = (box.ymax() - box.ymin()) * prop_margin;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include <QGraphicsView>
|
||||
#include <QLabel>
|
||||
|
||||
#include <CGAL/Qt/GraphicsViewNavigation.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@
|
|||
|
||||
#include "ArrangementPainterOstream.h"
|
||||
#include "ArrangementTypes.h"
|
||||
|
||||
#ifdef CGAL_USE_CORE
|
||||
#include <CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h>
|
||||
#endif
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
|
|
@ -262,7 +265,8 @@ ArrangementPainterOstream<CGAL::Arr_Bezier_curve_traits_2<
|
|||
|
||||
std::vector<std::pair<double, double>> sampled_points;
|
||||
// TODO: get adaptive number of samples
|
||||
size_t number_of_samples = 100 * (param_range.second - param_range.first);
|
||||
unsigned int number_of_samples =
|
||||
100 * (param_range.second - param_range.first);
|
||||
sampled_points.reserve(number_of_samples);
|
||||
|
||||
supporting_curve.sample(
|
||||
|
|
@ -397,6 +401,7 @@ auto ArrangementPainterOstream<CGAL::Arr_algebraic_segment_traits_2<
|
|||
Coefficient_>>::getPointsList(const X_monotone_curve_2& curve)
|
||||
-> std::vector<Coord_vec_2>
|
||||
{
|
||||
#ifdef CGAL_USE_CORE
|
||||
typedef Curve_renderer_facade<CKvA_2> Facade;
|
||||
typedef std::pair<double, double> Coord_2;
|
||||
typedef std::vector<Coord_2> Coord_vec_2;
|
||||
|
|
@ -404,6 +409,9 @@ auto ArrangementPainterOstream<CGAL::Arr_algebraic_segment_traits_2<
|
|||
std::vector<Coord_vec_2> points;
|
||||
Facade::instance().draw(curve, points);
|
||||
return points;
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Coefficient_>
|
||||
|
|
@ -447,11 +455,13 @@ template <typename Coefficient_>
|
|||
void ArrangementPainterOstream<
|
||||
CGAL::Arr_algebraic_segment_traits_2<Coefficient_>>::setupFacade()
|
||||
{
|
||||
#ifdef CGAL_USE_CORE
|
||||
typedef Curve_renderer_facade<CKvA_2> Facade;
|
||||
QGraphicsView* view = this->getView();
|
||||
QRectF viewport = this->viewportRect();
|
||||
CGAL::Bbox_2 bbox = this->convert(viewport).bbox();
|
||||
Facade::setup(bbox, view->width(), view->height());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Instantiation of Arr_rational_function_traits_2
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ struct ConstructBoundingBox_impl
|
|||
bbox = inf_bbox;
|
||||
}
|
||||
#ifdef CGAL_USE_CORE
|
||||
catch (Zero_resultant_exception& ex)
|
||||
catch (Zero_resultant_exception&)
|
||||
{
|
||||
std::cerr << "Exception thrown of type \"Zero_resultant_exception\"\n";
|
||||
std::cerr << __FILE__ << ':' << __LINE__ << '\n';
|
||||
|
|
|
|||
Loading…
Reference in New Issue