diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h index 25aba48cefd..dbbc07dbad9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h @@ -61,6 +61,9 @@ private: typedef typename Arrangement_2::DInner_ccb DInner_ccb; typedef typename Arrangement_2::DIso_vertex DIso_vertex; + typedef Arr_point_location_result Pl_result; + typedef typename Pl_result::Type Pl_result_type; + private: Arrangement_2* p_arr; // The associated arrangement. @@ -100,32 +103,25 @@ public: * This object may wrap a Face_const_handle (the general case), * or a Halfedge_const_handle (in case of an overlap). */ - typedef Arr_point_location_result Pl_result; - typename Pl_result::type locate_curve_end(const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y) const + Pl_result_type locate_curve_end(const X_monotone_curve_2& cv, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y) const { CGAL_precondition((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR)); - typedef Arr_point_location_result Pl_result; - // Use the topology traits to locate the unbounded curve end. - CGAL::Object obj = - p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y); + auto obj = p_arr->topology_traits()->locate_curve_end(cv, ind, ps_x, ps_y); // Return a handle to the DCEL feature. - DFace* f; - if (CGAL::assign(f, obj)) - return (Pl_result::make_result(p_arr->_const_handle_for(f))); + DFace** f_p = boost::get(&obj); + if (f_p) return (Pl_result::make_result(p_arr->_const_handle_for(*f_p))); - DHalfedge* he; - if (CGAL::assign(he, obj)) - return (Pl_result::make_result(p_arr->_const_handle_for(he))); + DHalfedge** he_p = boost::get(&obj); + if (he_p) return (Pl_result::make_result(p_arr->_const_handle_for(*he_p))); - DVertex* v; - if (CGAL::assign(v, obj)) - return (Pl_result::make_result(p_arr->_const_handle_for(v))); + DVertex** v_p = boost::get(&obj); + if (v_p) return (Pl_result::make_result(p_arr->_const_handle_for(*v_p))); // We should never reach here: CGAL_error(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index 8003d118eb4..d50b9fc9277 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -7,14 +7,15 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// -// Author(s) : Ron Wein -// Efi Fogel -// Eric Berberich +// Author(s): Ron Wein +// Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_H +#include + #include #include @@ -306,17 +307,18 @@ public: * \param ps_x The boundary condition of the curve end in x. * \param ps_y The boundary condition of the curve end in y. * \pre The curve has a boundary condition in either x or y. - * \return An object that contains the curve end. + * \return An object that wraps the curve end. */ - CGAL::Object place_boundary_vertex(Face*, - const X_monotone_curve_2&, - Arr_curve_end, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) + boost::optional > + place_boundary_vertex(Face*, + const X_monotone_curve_2&, + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { // This function should never be called: CGAL_error(); - return CGAL::Object(); + return boost::none; } /*! Locate the predecessor halfedge for the given curve around a given @@ -349,14 +351,17 @@ public: * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ - CGAL::Object locate_curve_end(const X_monotone_curve_2&, - Arr_curve_end, - Arr_parameter_space /* ps_x */, - Arr_parameter_space /* ps_y */) + boost::variant + locate_curve_end(const X_monotone_curve_2&, + Arr_curve_end, + Arr_parameter_space /* ps_x */, + Arr_parameter_space /* ps_y */) { + typedef boost::variant Result; // This function should never be called: CGAL_error(); - return Object(); + Vertex* v(nullptr); + return Result(v); } /*! Split a fictitious edge using the given vertex. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 002c9e0ee81..853815756f5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -7,8 +7,8 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Efi Fogel -// Eric Berberich +// Author(s): Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H @@ -491,11 +491,12 @@ public: * \pre The curve has a boundary condition in either x or y. * \return An object that contains the curve end. */ - CGAL::Object place_boundary_vertex(Face* f, - const X_monotone_curve_2& xc, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y); + boost::optional > + place_boundary_vertex(Face* f, + const X_monotone_curve_2& xc, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! Locate the predecessor halfedge for the given curve around a given * vertex with boundary conditions. @@ -522,9 +523,10 @@ public: * \pre The curve end is incident to the boundary. * \return An object that contains the curve end. */ - CGAL::Object locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ce, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y); + boost::variant + locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ce, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! Split a fictitious edge using the given vertex. * \param e The edge to split (one of the pair of halfedges). diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index 8a2b4d4d4ba..f8eee89a2c7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -7,8 +7,8 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// Author(s) : Efi Fogel -// Ron Wein +// Author(s): Efi Fogel +// Ron Wein #ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_IMPL_H #define CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_IMPL_H @@ -514,7 +514,10 @@ let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1, * the interior of the curve, find a place for a boundary vertex that will * represent the curve end along the face boundary */ template -CGAL::Object +boost::optional + ::Vertex*, + typename Arr_spherical_topology_traits_2::Halfedge*> > Arr_spherical_topology_traits_2:: place_boundary_vertex(Face* /* f */, const X_monotone_curve_2& xc, Arr_curve_end ind, @@ -525,15 +528,18 @@ place_boundary_vertex(Face* /* f */, , Arr_parameter_space ps_y) { + typedef boost::variant Non_optional_result; + typedef boost::optional Result; + // std::cout << "place_boundary_vertex()" << std::endl; if (ps_y == ARR_BOTTOM_BOUNDARY) { - if (m_south_pole == nullptr) return Object(); - return CGAL::make_object(m_south_pole); + if (m_south_pole == nullptr) return boost::none; + return Result(Non_optional_result(m_south_pole)); } if (ps_y == ARR_TOP_BOUNDARY) { - if (m_north_pole == nullptr) return Object(); - return CGAL::make_object(m_north_pole); + if (m_north_pole == nullptr) return boost::none; + return Result(Non_optional_result(m_north_pole)); } CGAL_assertion((ps_x == ARR_LEFT_BOUNDARY) || (ps_x == ARR_RIGHT_BOUNDARY)); @@ -541,15 +547,14 @@ place_boundary_vertex(Face* /* f */, const Point_2& key = (ind == ARR_MIN_END) ? m_geom_traits->construct_min_vertex_2_object()(xc) : m_geom_traits->construct_max_vertex_2_object()(xc); - typename Vertex_map::iterator it = m_boundary_vertices.find(key); - + auto it = m_boundary_vertices.find(key); if (it != m_boundary_vertices.end()) { Vertex* v = it->second; - return CGAL::make_object(v); + return Result(Non_optional_result(v)); } // The vertex hasn't been created yet, return a null object: - return Object(); + return boost::none; } /*! \brief locate the predecessor halfedge for the given curve around a given @@ -585,7 +590,11 @@ locate_around_boundary_vertex(Vertex* v, /*! \brief locates a DCEL feature that contains a given curve end. */ template -CGAL::Object Arr_spherical_topology_traits_2:: +boost::variant +::Vertex*, + typename Arr_spherical_topology_traits_2::Halfedge*, + typename Arr_spherical_topology_traits_2::Face*> +Arr_spherical_topology_traits_2:: locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, Arr_parameter_space #if !defined(CGAL_NO_ASSERTIONS) @@ -594,13 +603,14 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, , Arr_parameter_space ps_y) { + typedef boost::variant Result; // Act according to the boundary conditions. if (ps_y == ARR_TOP_BOUNDARY) { // In case the curve end coincides with the north pole, return the vertex // representing the north pole, if one exists. Otherwise, return the face // containing this pole (the spherical face). - if (m_north_pole != nullptr) return CGAL::make_object(m_north_pole); - return CGAL::make_object(m_spherical_face); + if (m_north_pole != nullptr) return Result(m_north_pole); + return Result(m_spherical_face); } typename Vertex_map::iterator it; @@ -610,7 +620,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, // In case the curve end coincides with the south pole, return the vertex // representing the south pole, if one exists. Otherwise, search for the // face containing this pole. - if (m_south_pole != nullptr) return CGAL::make_object(m_south_pole); + if (m_south_pole != nullptr) return Result(m_south_pole); it = m_boundary_vertices.begin(); } else { @@ -625,7 +635,7 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, it = m_boundary_vertices.find(key); if (it != m_boundary_vertices.end()) { v = it->second; - return CGAL::make_object(v); + return Result(v); } it = m_boundary_vertices.lower_bound(key); @@ -635,11 +645,10 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind, // discontinuity that is strictly above the curve end. If there is none, // we know the curve end is contained in the spherical face. Otherwise, // we return the face that lies below the vertex v. - if (it == m_boundary_vertices.end()) - return CGAL::make_object(m_spherical_face); + if (it == m_boundary_vertices.end()) return Result(m_spherical_face); v = it->second; - return CGAL::make_object(_face_below_vertex_on_discontinuity(v)); + return Result(_face_below_vertex_on_discontinuity(v)); } /*! \brief determines whether a given boundary vertex is redundant */ diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h index d968482a1d8..5d9a91452af 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h @@ -8,8 +8,8 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s) : Ron Wein -// Efi Fogel +// Author(s): Ron Wein +// Efi Fogel #ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H #define CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H @@ -296,27 +296,31 @@ are_equal(const Vertex *v, // represent the curve end along the face boundary. // template -CGAL::Object +boost::optional + ::Vertex*, + typename Arr_unb_planar_topology_traits_2::Halfedge*> > Arr_unb_planar_topology_traits_2:: -place_boundary_vertex(Face *f, +place_boundary_vertex(Face* f, const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y) { - // Get a halfedge on the outer CCB of f and start traversing the CCB. - Halfedge *first = *(f->outer_ccbs_begin()); - Halfedge *curr = first; - bool eq_source, eq_target; + typedef boost::variant Non_optional_result; + typedef boost::optional Result; - do - { + // Get a halfedge on the outer CCB of f and start traversing the CCB. + Halfedge* first = *(f->outer_ccbs_begin()); + Halfedge* curr = first; + bool eq_source, eq_target; + + do { // Note we consider only fictitious halfedges and check whether they // contain the relevant curve end. if (curr->has_null_curve() && - _is_on_fictitious_edge (cv, ind, ps_x, ps_y, curr, - eq_source, eq_target)) + _is_on_fictitious_edge(cv, ind, ps_x, ps_y, curr, eq_source, eq_target)) { - CGAL_assertion (! eq_source && ! eq_target); - return (CGAL::make_object (curr)); + CGAL_assertion(! eq_source && ! eq_target); + return Result(curr); } // Move to the next halfegde along the CCB. @@ -327,59 +331,58 @@ place_boundary_vertex(Face *f, // If we reached here, we did not find a suitable halfegde, which should // never happen. CGAL_error(); - return CGAL::Object(); + return boost::none; } //----------------------------------------------------------------------------- // Locate a DCEL feature that contains the given unbounded curve end. // template -CGAL::Object Arr_unb_planar_topology_traits_2:: +boost::variant +::Vertex*, + typename Arr_unb_planar_topology_traits_2::Halfedge*, + typename Arr_unb_planar_topology_traits_2::Face*> +Arr_unb_planar_topology_traits_2:: locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, Arr_parameter_space ps_x, Arr_parameter_space ps_y) { + typedef boost::variant Result; + // Start traversing the inner CCB of the fictitious face and try to locate // a feature that contains the curve end. - Halfedge *first = *(fict_face->inner_ccbs_begin()); - Halfedge *curr = first; - bool eq_source, eq_target; + Halfedge* first = *(fict_face->inner_ccbs_begin()); + Halfedge* curr = first; + bool eq_source, eq_target; - do - { - if (_is_on_fictitious_edge (cv, ind, ps_x, ps_y, curr, - eq_source, eq_target)) + do { + if (_is_on_fictitious_edge(cv, ind, ps_x, ps_y, curr, eq_source, eq_target)) { - if (eq_source) - { + if (eq_source) { // cv's end coincides with the source vertex of the current // fictitious halfedge. This means that cv overlaps the curve that // is associated with the only non-fictitious halfedge incident to // this vertex. We therefore return a pointer to this halfedge. - Halfedge *he = curr->opposite()->next(); - - CGAL_assertion (! he->has_null_curve()); - return (CGAL::make_object (he)); + Halfedge* he = curr->opposite()->next(); + CGAL_assertion(! he->has_null_curve()); + return Result(he); } - else if (eq_target) - { + else if (eq_target) { // cv's end coincides with the target vertex of the current // fictitious halfedge. This means that cv overlaps the curve that // is associated with the only non-fictitious halfedge incident to // this vertex. We therefore return a pointer to this halfedge. - Halfedge *he = curr->opposite()->prev(); - - CGAL_assertion (! he->has_null_curve()); - return (CGAL::make_object (he)); + Halfedge* he = curr->opposite()->prev(); + CGAL_assertion(! he->has_null_curve()); + return Result(he); } // The current ficitious edge contains cv's end in its interior. // Note we use curr's twin, whose incident face is a valid // unbounded face (whereas the incident face of curr is the fictitious // face). - Face *uf = curr->opposite()->outer_ccb()->face(); - + Face* uf = curr->opposite()->outer_ccb()->face(); CGAL_assertion (uf->is_unbounded() && ! uf->is_fictitious()); - return (CGAL::make_object (uf)); + return Result(uf); } curr = curr->next(); @@ -388,7 +391,8 @@ locate_curve_end (const X_monotone_curve_2& cv, Arr_curve_end ind, // We should never reach here. CGAL_error(); - return Object(); + Vertex* v(nullptr); + return Result(v); } //----------------------------------------------------------------------------- diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index bed94cdbb3f..12598f4bed7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -7,9 +7,8 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// -// Author(s) : Ron Wein -// Efi Fogel +// Author(s): Ron Wein +// Efi Fogel #ifndef CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_H #define CGAL_ARR_UNB_PLANAR_TOPOLOGY_TRAITS_2_H @@ -308,11 +307,12 @@ public: * \return An object that contains the curve end. * In our case this object always wraps a fictitious edge. */ - CGAL::Object place_boundary_vertex(Face* f, - const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y); + boost::optional > + place_boundary_vertex(Face* f, + const X_monotone_curve_2& cv, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! Locate the predecessor halfedge for the given curve around a given * vertex with boundary conditions. @@ -346,10 +346,11 @@ public: * In our case this object may either wrap an unbounded face, * or an edge with an end-vertex at infinity (in case of an overlap). */ - CGAL::Object locate_curve_end(const X_monotone_curve_2& cv, - Arr_curve_end ind, - Arr_parameter_space ps_x, - Arr_parameter_space ps_y); + boost::variant + locate_curve_end(const X_monotone_curve_2& cv, + Arr_curve_end ind, + Arr_parameter_space ps_x, + Arr_parameter_space ps_y); /*! Split a fictitious edge using the given vertex. * \param e The edge to split (one of the pair of halfedges). diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h index 8c3fd571803..17e58fcf108 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h @@ -7,16 +7,15 @@ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // -// -// Author(s) : Ron Wein -// Efi Fogel -// Eric Berberich -// (based on old version by: Iddo Hanniel, -// Eyal Flato, -// Oren Nechushtan, -// Ester Ezra, -// Shai Hirsch, -// and Eugene Lipovetsky) +// Author(s): Ron Wein +// Efi Fogel +// Eric Berberich +// (based on old version by: Iddo Hanniel, +// Eyal Flato, +// Oren Nechushtan, +// Ester Ezra, +// Shai Hirsch, +// and Eugene Lipovetsky) #ifndef CGAL_ARRANGEMENT_ON_SURFACE_2_IMPL_H #define CGAL_ARRANGEMENT_ON_SURFACE_2_IMPL_H @@ -32,6 +31,8 @@ * class-template. */ +#include + #include #include @@ -2193,18 +2194,34 @@ _place_and_set_curve_end(DFace* f, Arr_parameter_space ps_x, Arr_parameter_space ps_y, DHalfedge** p_pred) { + typedef boost::variant Non_optional_result; + typedef boost::optional Result; // Use the topology traits to locate the DCEL feature that contains the // given curve end. - CGAL::Object obj = - m_topol_traits.place_boundary_vertex(f, cv, ind, ps_x, ps_y); - DVertex* v; - DHalfedge* fict_he; - + auto obj = m_topol_traits.place_boundary_vertex(f, cv, ind, ps_x, ps_y); // Act according to the result type. - if (CGAL::assign(fict_he, obj)) { + + if (! obj) { + // We have to create a new vertex that reprsents the given curve end. + DVertex* v = _create_boundary_vertex(cv, ind, ps_x, ps_y); + + // Notify the topology traits on the creation of the boundary vertex. + m_topol_traits.notify_on_boundary_vertex_creation(v, cv, ind, ps_x, ps_y); + + // There are no edges incident to v, therefore no predecessor halfedge. + *p_pred = nullptr; + + // Return the vertex that represents the curve end. + return v; + } + + DHalfedge** fict_he_p = boost::get(&*obj); + if (fict_he_p != nullptr) { + DHalfedge* fict_he = *fict_he_p; + CGAL_assertion(fict_he != nullptr); // The curve end is located on a fictitious edge. We first create a new // vertex that corresponds to the curve end. - v = _create_boundary_vertex(cv, ind, ps_x, ps_y); + DVertex* v = _create_boundary_vertex(cv, ind, ps_x, ps_y); // Split the fictitious halfedge at the newly created vertex. // The returned halfedge is the predecessor for the insertion of the curve @@ -2216,29 +2233,16 @@ _place_and_set_curve_end(DFace* f, _notify_after_split_fictitious_edge(Halfedge_handle(*p_pred), Halfedge_handle((*p_pred)->next())); + return v; } - else if (CGAL::assign(v, obj)) { - // In this case we are given an existing vertex that represents the curve - // end. We now have to locate the predecessor edge for the insertion of cv - // around this vertex. - *p_pred = - m_topol_traits.locate_around_boundary_vertex(v, cv, ind, ps_x, ps_y); - } - else { - CGAL_assertion(obj.is_empty()); - - // In this case we have to create a new vertex that reprsents the given - // curve end. - v = _create_boundary_vertex(cv, ind, ps_x, ps_y); - - // Notify the topology traits on the creation of the boundary vertex. - m_topol_traits.notify_on_boundary_vertex_creation(v, cv, ind, ps_x, ps_y); - - // There are no edges incident to v, therefore no predecessor halfedge. - *p_pred = nullptr; - } - - // Return the vertex that represents the curve end. + DVertex** v_p = boost::get(&*obj); + CGAL_assertion(v_p != nullptr); + DVertex* v = *v_p; + CGAL_assertion(v != nullptr); + // In this case we are given an existing vertex that represents the curve + // end. We now have to locate the predecessor edge for the insertion of cv + // around this vertex. + *p_pred = m_topol_traits.locate_around_boundary_vertex(v, cv, ind, ps_x, ps_y); return v; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h index b3d8c63f5b2..414696f24ab 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h @@ -95,9 +95,8 @@ void Arrangement_zone_2::compute_zone() // curve (currently m_obj stores the object containing it). const Vertex_const_handle* vh; const Halfedge_const_handle* hh; - const Face_const_handle* fh; - if ((vh = object_cast(&m_obj)) != nullptr) { + if ((vh = boost::get(&m_obj)) != nullptr) { CGAL_assertion(m_has_left_pt); // The left endpoint coincides with an existing vertex: @@ -119,7 +118,7 @@ void Arrangement_zone_2::compute_zone() #endif } - else if ((hh = object_cast(&m_obj)) != nullptr) { + else if ((hh = boost::get(&m_obj)) != nullptr) { if (m_has_left_pt) { // Obtain the right halfedge from the halfedge-pair containing m_left_pt // in their interior. @@ -160,7 +159,7 @@ void Arrangement_zone_2::compute_zone() } else { // The left endpoint lies inside a face. - fh = object_cast(&m_obj); + const Face_const_handle* fh = boost::get(&m_obj); CGAL_assertion_msg(fh != nullptr, "Invalid object returned by the point-location query."); diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h index 55616307cd0..1fcace77d23 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -113,6 +114,9 @@ protected: typedef std::set Curves_set; typedef typename Curves_set::iterator Curves_set_iterator; + typedef Arr_point_location_result Pl_result; + typedef typename Pl_result::Type Pl_result_type; + // Data members: Arrangement_2& m_arr; // The associated arrangement. const Traits_adaptor_2* m_geom_traits; // Its associated geometry traits. @@ -127,7 +131,7 @@ protected: X_monotone_curve_2 m_cv; // The current portion of the // inserted curve. - CGAL::Object m_obj; // The location of the left endpoint. + Pl_result_type m_obj; // The location of the left endpoint. bool m_has_left_pt; // Is the left end of the curve bounded. bool m_left_on_boundary; // Is the left point on the boundary. Point_2 m_left_pt; // Its current left endpoint. diff --git a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h index 2ff277817d9..aee0a956eb2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Surface_sweep_2/Arr_no_intersection_insertion_ss_visitor.h @@ -8,9 +8,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // -// Author(s) : Baruch Zukerman -// Ron Wein -// Efi Fogel +// Author(s): Baruch Zukerman +// Ron Wein +// Efi Fogel #ifndef CGAL_ARR_NO_INTERSECTION_INSERTION_SS_VISITOR_H #define CGAL_ARR_NO_INTERSECTION_INSERTION_SS_VISITOR_H