mirror of https://github.com/CGAL/cgal
Check if arr is model of ArrangementOpenBoundaryTraits instead of try and catch
This commit is contained in:
parent
1cf11730a9
commit
6d91abc9e8
|
|
@ -24,7 +24,35 @@ struct ConstructBoundingBox_impl
|
|||
CGAL::Bbox_2
|
||||
operator()(const X_monotone_curve_2& curve)
|
||||
{
|
||||
return curve.bbox();
|
||||
using Zero_resultant_exception = CGAL::internal::Zero_resultant_exception<
|
||||
typename demo_types::Alg_seg_traits::Polynomial_2>;
|
||||
|
||||
CGAL::Bbox_2 bbox;
|
||||
try
|
||||
{
|
||||
bbox= curve.bbox();
|
||||
}
|
||||
// algebraic traits sometimes when calling bbox
|
||||
// example: xy=0
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
std::cerr << ex.what() << '\n';
|
||||
std::cerr << __FILE__ << ':' << __LINE__ << '\n';
|
||||
bbox = inf_bbox;
|
||||
}
|
||||
catch (Zero_resultant_exception& ex)
|
||||
{
|
||||
std::cerr << "Exception thrown of type \"Zero_resultant_exception\"\n";
|
||||
std::cerr << __FILE__ << ':' << __LINE__ << '\n';
|
||||
bbox = inf_bbox;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Exception thrown of unknown type!\n";
|
||||
std::cerr << __FILE__ << ':' << __LINE__ << '\n';
|
||||
bbox = inf_bbox;
|
||||
}
|
||||
return bbox;
|
||||
}
|
||||
|
||||
CGAL::Bbox_2
|
||||
|
|
|
|||
|
|
@ -136,12 +136,13 @@ void EnvelopeCallback< Arr_>::updateEnvelope( bool lower )
|
|||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cerr << ex.what() << '\n';
|
||||
if (lower)
|
||||
this->showLowerEnvelope(false);
|
||||
else
|
||||
this->showUpperEnvelope(false);
|
||||
return;
|
||||
std::cerr << ex.what() << '\n';
|
||||
std::cerr << __FILE__ << ':' << __LINE__ << '\n';
|
||||
if (lower)
|
||||
this->showLowerEnvelope(false);
|
||||
else
|
||||
this->showUpperEnvelope(false);
|
||||
return;
|
||||
}
|
||||
|
||||
envelopeToUpdate->clear( );
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ void SplitEdgeCallback<Arr_>::curveInputDoneEvent(
|
|||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cerr << ex.what() << '\n';
|
||||
std::cerr << __FILE__ << ':' << __LINE__ << '\n';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,7 +384,8 @@ Construct_x_monotone_subcurve_2<ArrTraits>::Construct_x_monotone_subcurve_2(
|
|||
compare_x_2(this->traits->compare_x_2_object()),
|
||||
compute_y_at_x(this->traits),
|
||||
construct_min_vertex_2(this->traits->construct_min_vertex_2_object()),
|
||||
construct_max_vertex_2(this->traits->construct_max_vertex_2_object())
|
||||
construct_max_vertex_2(this->traits->construct_max_vertex_2_object()),
|
||||
parameter_space_in_x_2(this->traits)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -396,10 +397,16 @@ auto Construct_x_monotone_subcurve_2<ArrTraits>::operator()(
|
|||
Point_2 pMin, pMax;
|
||||
bool unbounded_min = false;
|
||||
bool unbounded_max = false;
|
||||
try { pMin = this->construct_min_vertex_2(curve); }
|
||||
catch (...) { unbounded_min = true; }
|
||||
try { pMax = this->construct_max_vertex_2(curve); }
|
||||
catch (...) { unbounded_max = true; }
|
||||
|
||||
if (this->parameter_space_in_x_2(curve, CGAL::ARR_MIN_END) != CGAL::INTERIOR)
|
||||
unbounded_min = true;
|
||||
else
|
||||
pMin = this->construct_min_vertex_2(curve);
|
||||
|
||||
if (this->parameter_space_in_x_2(curve, CGAL::ARR_MAX_END) != CGAL::INTERIOR)
|
||||
unbounded_max = true;
|
||||
else
|
||||
pMax = this->construct_max_vertex_2(curve);
|
||||
|
||||
X_monotone_curve_2 subcurve;
|
||||
X_monotone_curve_2 unusedTrimmings;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "GraphicsSceneMixin.h"
|
||||
#include "ArrTraitsAdaptor.h"
|
||||
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/Arr_enums.h>
|
||||
#include <type_traits>
|
||||
|
||||
class QGraphicsScene;
|
||||
|
||||
template <typename ArrTraits >
|
||||
|
|
@ -276,23 +280,73 @@ public:
|
|||
double operator()(const Point_2& p, const X_monotone_curve_2& c) const;
|
||||
};
|
||||
|
||||
// chcek if arrangement is a model of the concept ArrangementOpenBoundaryTraits_2
|
||||
template <typename ArrTraits>
|
||||
struct IsOpenBoundaryArrangement :
|
||||
public CGAL::Boolean_tag<
|
||||
std::is_convertible<
|
||||
typename ArrTraits::Left_side_category,
|
||||
CGAL::Arr_open_side_tag>::value &&
|
||||
std::is_convertible<
|
||||
typename ArrTraits::Bottom_side_category,
|
||||
CGAL::Arr_open_side_tag>::value &&
|
||||
std::is_convertible<
|
||||
typename ArrTraits::Top_side_category,
|
||||
CGAL::Arr_open_side_tag>::value &&
|
||||
std::is_convertible<
|
||||
typename ArrTraits::Right_side_category,
|
||||
CGAL::Arr_open_side_tag>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename ArrTraits, typename=void>
|
||||
class Param_space_in_x_2
|
||||
{
|
||||
public:
|
||||
typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
||||
Param_space_in_x_2(const ArrTraits*) {}
|
||||
CGAL::Arr_parameter_space
|
||||
operator()(const X_monotone_curve_2&, CGAL::Arr_curve_end)
|
||||
{
|
||||
return CGAL::INTERIOR;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ArrTraits>
|
||||
class Param_space_in_x_2<
|
||||
ArrTraits, std::enable_if_t<IsOpenBoundaryArrangement<ArrTraits>::value>>
|
||||
{
|
||||
public:
|
||||
typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename ArrTraits::Parameter_space_in_x_2 Parameter_space_in_x_2;
|
||||
|
||||
Param_space_in_x_2(const ArrTraits* traits) :
|
||||
parameter_space_in_x_2(traits->parameter_space_in_x_2_object())
|
||||
{
|
||||
}
|
||||
|
||||
CGAL::Arr_parameter_space
|
||||
operator()(const X_monotone_curve_2& curve, CGAL::Arr_curve_end curve_end)
|
||||
{
|
||||
return this->parameter_space_in_x_2(curve, curve_end);
|
||||
}
|
||||
|
||||
private:
|
||||
Parameter_space_in_x_2 parameter_space_in_x_2;
|
||||
};
|
||||
|
||||
template <typename ArrTraits>
|
||||
class Construct_x_monotone_subcurve_2
|
||||
{
|
||||
public:
|
||||
typedef typename ArrTraitsAdaptor<ArrTraits>::Kernel Kernel;
|
||||
typedef typename ArrTraits::X_monotone_curve_2 X_monotone_curve_2;
|
||||
typedef typename ArrTraits::Split_2 Split_2;
|
||||
typedef typename ArrTraits::Intersect_2 Intersect_2;
|
||||
typedef typename ArrTraits::Multiplicity Multiplicity;
|
||||
typedef typename ArrTraits::Construct_min_vertex_2 Construct_min_vertex_2;
|
||||
typedef typename ArrTraits::Construct_max_vertex_2 Construct_max_vertex_2;
|
||||
typedef typename ArrTraits::Compare_x_2 Compare_x_2;
|
||||
typedef typename Kernel::FT FT;
|
||||
typedef typename ArrTraitsAdaptor< ArrTraits >::CoordinateType
|
||||
CoordinateType;
|
||||
typedef Param_space_in_x_2<ArrTraits> Parameter_space_in_x_2;
|
||||
typedef typename ArrTraits::Point_2 Point_2;
|
||||
typedef typename Kernel::Point_2 Kernel_point_2;
|
||||
|
||||
Construct_x_monotone_subcurve_2( const ArrTraits* traits_ );
|
||||
|
||||
|
|
@ -313,6 +367,7 @@ protected:
|
|||
Arr_compute_y_at_x_2< ArrTraits > compute_y_at_x;
|
||||
Construct_min_vertex_2 construct_min_vertex_2;
|
||||
Construct_max_vertex_2 construct_max_vertex_2;
|
||||
Parameter_space_in_x_2 parameter_space_in_x_2;
|
||||
}; // class Construct_x_monotone_subcurve_2
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue