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 0815ca64d4d..f7ea7f88ce0 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 @@ -276,6 +276,28 @@ public: return (m_spherical_face); } + /*! Obtain the face containing the south pole (const version). */ + const Face * south_face() const + { + typename Vertex_map::const_iterator it = m_boundary_vertices.begin(); + + if (it == m_boundary_vertices.end()) + return (m_spherical_face); + else + return (_face_below_vertex_on_discontinuity (it->second)); + } + + /*! Obtain the face containing the south pole (non-const version). */ + Face * south_face() + { + typename Vertex_map::iterator it = m_boundary_vertices.begin(); + + if (it == m_boundary_vertices.end()) + return (m_spherical_face); + else + return (_face_below_vertex_on_discontinuity (it->second)); + } + /*! Obtain the south pole (const version). */ const Vertex * south_pole() const { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h index 6235abee42a..f7432fee043 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h @@ -80,6 +80,13 @@ public: /// \name Notification functions. //@{ + /* A notification issued before the sweep process starts. */ + virtual void before_sweep() + { + // Get the unbounded face. + this->m_spherical_face = Face_handle(this->m_top_traits->south_face()); + } + /*! * A notification invoked before the sweep-line starts handling the given * event. @@ -130,15 +137,21 @@ void Arr_spherical_insertion_helper::before_handle_event return; } - // In case we encounter an existing curve incident to the north pole, + // In case we encounter an existing curve incident to the curve of + // discontinuity (and exteding to its right) or to the north pole, // we have to update the current top face (the spherical face). if (bound_y != BEFORE_SINGULARITY) - return; - - if (ind == MIN_END) + { + if (ind == MIN_END) + this->m_spherical_face = xc.halfedge_handle()->twin()->face(); + else + this->m_spherical_face = xc.halfedge_handle()->face(); + } + else if (bound_x == AFTER_DISCONTINUITY) + { + CGAL_assertion (ind == MIN_END); this->m_spherical_face = xc.halfedge_handle()->twin()->face(); - else - this->m_spherical_face = xc.halfedge_handle()->face(); + } return; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h index bd5880c9cd2..4461e296500 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h @@ -90,8 +90,12 @@ public: void before_sweep() { // Get the spherical faces in both arrangements. + /* RWRW: m_red_nf = Face_handle_red(m_red_top_traits->spherical_face()); m_blue_nf = Face_handle_blue(m_blue_top_traits->spherical_face()); + */ + m_red_nf = Face_handle_red(m_red_top_traits->south_face()); + m_blue_nf = Face_handle_blue(m_blue_top_traits->south_face()); return; } @@ -100,7 +104,8 @@ public: */ void before_handle_event(Event * event) { - if (event->boundary_in_y() != BEFORE_SINGULARITY) + if (event->boundary_in_y() != BEFORE_SINGULARITY && + event->boundary_in_x() != AFTER_DISCONTINUITY) return; Curve_end ind = (event->number_of_left_curves() == 0 && @@ -111,35 +116,59 @@ public: (*(event->right_curves_begin())) : (*(event->left_curves_begin())); - switch (sc->color()) { - case Traits_2::RED : - if (ind == MIN_END) - m_red_nf = sc->red_halfedge_handle()->twin()->face(); - else - m_red_nf = sc->red_halfedge_handle()->face(); - break; - - case Traits_2::BLUE : - if (ind == MIN_END) - m_blue_nf = sc->blue_halfedge_handle()->twin()->face(); - else - m_blue_nf = sc->blue_halfedge_handle()->face(); - break; + if (event->boundary_in_y() == BEFORE_SINGULARITY) + { + // The curve is incident to the north pole. + switch (sc->color()) { + case Traits_2::RED : + if (ind == MIN_END) + m_red_nf = sc->red_halfedge_handle()->twin()->face(); + else + m_red_nf = sc->red_halfedge_handle()->face(); + break; + + case Traits_2::BLUE : + if (ind == MIN_END) + m_blue_nf = sc->blue_halfedge_handle()->twin()->face(); + else + m_blue_nf = sc->blue_halfedge_handle()->face(); + break; - case Traits_2::RB_OVERLAP : - if (ind == MIN_END) - { - m_red_nf = sc->red_halfedge_handle()->twin()->face(); - m_blue_nf = sc->blue_halfedge_handle()->twin()->face(); + case Traits_2::RB_OVERLAP : + if (ind == MIN_END) + { + m_red_nf = sc->red_halfedge_handle()->twin()->face(); + m_blue_nf = sc->blue_halfedge_handle()->twin()->face(); + } + else + { + m_red_nf = sc->red_halfedge_handle()->face(); + m_blue_nf = sc->blue_halfedge_handle()->face(); + } + break; } - else - { - m_red_nf = sc->red_halfedge_handle()->face(); - m_blue_nf = sc->blue_halfedge_handle()->face(); - } - break; - } + else + { + // The curve extends to the right from the curve of discontinuity. + CGAL_assertion (ind == MIN_END); + switch (sc->color()) { + case Traits_2::RED : + m_red_nf = sc->red_halfedge_handle()->twin()->face(); + break; + + case Traits_2::BLUE : + m_blue_nf = sc->blue_halfedge_handle()->twin()->face(); + break; + + case Traits_2::RB_OVERLAP : + m_red_nf = sc->red_halfedge_handle()->twin()->face(); + m_blue_nf = sc->blue_halfedge_handle()->twin()->face(); + break; + } + } + + return; } //@}