Fix for cases where red and blue handles are differently typed

This commit is contained in:
Simon Giraudot 2020-08-17 10:11:28 +02:00
parent 901f52018c
commit 36a210065f
2 changed files with 12 additions and 13 deletions

View File

@ -59,12 +59,20 @@ public:
std::size_t min_end_index (const Curve& c) const std::size_t min_end_index (const Curve& c) const
{ {
return reinterpret_cast<std::size_t>(halfedge(c)->target()->inc()); if (c.red_halfedge_handle() != typename Curve::HH_red())
return reinterpret_cast<std::size_t>(c.red_halfedge_handle()->target()->inc());
// else
CGAL_assertion (c.blue_halfedge_handle() != typename Curve::HH_blue());
return reinterpret_cast<std::size_t>(c.blue_halfedge_handle()->target()->inc());
} }
std::size_t max_end_index (const Curve& c) const std::size_t max_end_index (const Curve& c) const
{ {
return reinterpret_cast<std::size_t>(halfedge(c)->source()->inc()); if (c.red_halfedge_handle() != typename Curve::HH_red())
return reinterpret_cast<std::size_t>(c.red_halfedge_handle()->source()->inc());
// else
CGAL_assertion (c.blue_halfedge_handle() != typename Curve::HH_blue());
return reinterpret_cast<std::size_t>(c.blue_halfedge_handle()->source()->inc());
} }
const Curve& curve (const Curve& c) const const Curve& curve (const Curve& c) const
@ -103,16 +111,6 @@ public:
private: private:
typename Curve::Halfedge_handle halfedge (const Curve& c) const
{
if (c.red_halfedge_handle() == typename Curve::Halfedge_handle())
{
CGAL_assertion (c.blue_halfedge_handle() != typename Curve::Halfedge_handle());
return c.blue_halfedge_handle();
}
// else
return c.red_halfedge_handle();
}
}; };
/*! Compute the overlay of two input arrangements. /*! Compute the overlay of two input arrangements.

View File

@ -134,7 +134,8 @@ public:
class Ex_x_monotone_curve_2 { class Ex_x_monotone_curve_2 {
public: public:
typedef Base_x_monotone_curve_2 Base; typedef Base_x_monotone_curve_2 Base;
typedef Halfedge_handle_blue Halfedge_handle; typedef Halfedge_handle_red HH_red;
typedef Halfedge_handle_blue HH_blue;
protected: protected:
Base m_base_xcv; // The base curve. Base m_base_xcv; // The base curve.