mirror of https://github.com/CGAL/cgal
fix issue in case an overlapping curve is split
in case an arrangement is updated and an overlap curve is on an existing halfedge, the incident halfedge to an event has to be updated after the split. This is done by checking all left events in parent subcurves of the overlapping subcurve.
This commit is contained in:
parent
a60f4dc3a7
commit
a3d04af49c
|
|
@ -67,6 +67,36 @@ private:
|
|||
X_monotone_curve_2 sub_cv1; // Auxiliary variables
|
||||
X_monotone_curve_2 sub_cv2; // (used for splitting curves).
|
||||
|
||||
|
||||
// update halfedge pointing to events, case with overlaps
|
||||
template <class Subcurve_>
|
||||
void update_incident_halfedge_after_split(Subcurve_* sc,
|
||||
Halfedge_handle he,
|
||||
Halfedge_handle new_he,
|
||||
Tag_true)
|
||||
{
|
||||
std::vector<Subcurve*> leaves;
|
||||
sc->all_leaves( std::back_inserter(leaves) );
|
||||
for(Subcurve* ssc : leaves)
|
||||
{
|
||||
Event* last_event_on_ssc = ssc->last_event();
|
||||
if (last_event_on_ssc->halfedge_handle() == he)
|
||||
last_event_on_ssc->set_halfedge_handle(new_he->next());
|
||||
}
|
||||
}
|
||||
|
||||
// update halfedge pointing to events, case without overlaps
|
||||
template <class Subcurve_>
|
||||
void update_incident_halfedge_after_split(Subcurve_* sc,
|
||||
Halfedge_handle he,
|
||||
Halfedge_handle new_he,
|
||||
Tag_false)
|
||||
{
|
||||
Event* last_event_on_sc = sc->last_event();
|
||||
if (last_event_on_sc->halfedge_handle() == he)
|
||||
last_event_on_sc->set_halfedge_handle(new_he->next());
|
||||
}
|
||||
|
||||
public:
|
||||
/*! A notification invoked when a new subcurve is created. */
|
||||
void add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc);
|
||||
|
|
@ -132,9 +162,8 @@ Arr_insertion_ss_visitor<Hlpr, Vis>::split_edge(Halfedge_handle he, Subcurve* sc
|
|||
Halfedge_handle new_he =
|
||||
this->m_arr_access.split_edge_ex(he, pt.base(),
|
||||
sub_cv1.base(), sub_cv2.base());
|
||||
Event* last_event_on_sc = sc->last_event();
|
||||
if (last_event_on_sc->halfedge_handle() == he)
|
||||
last_event_on_sc->set_halfedge_handle(new_he->next());
|
||||
// update the halfedge incident to events on the left of the split
|
||||
update_incident_halfedge_after_split(sc, he, new_he, typename Subcurve::Handle_overlaps());
|
||||
|
||||
return new_he;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public:
|
|||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Event_ Event;
|
||||
typedef Tag_true Handle_overlaps;
|
||||
|
||||
private:
|
||||
typedef Geometry_traits_2 Gt2;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public:
|
|||
typedef Subcurve_ Subcurve;
|
||||
typedef Event_ Event;
|
||||
typedef Allocator_ Allocator;
|
||||
typedef Tag_false Handle_overlaps;
|
||||
|
||||
private:
|
||||
typedef Geometry_traits_2 Gt2;
|
||||
|
|
|
|||
Loading…
Reference in New Issue