Merge remote-tracking branch 'cgal/5.2.x-branch' into HEAD

This commit is contained in:
Sébastien Loriot 2021-08-13 18:27:07 +02:00
commit b0a85960bf
18 changed files with 88 additions and 17 deletions

View File

@ -131,7 +131,7 @@ private:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -223,7 +223,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -97,7 +97,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -100,7 +100,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -176,7 +176,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -89,7 +89,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -107,7 +107,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -87,7 +87,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -112,7 +112,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -134,7 +134,7 @@ public:
/*! using the additional data that we store at the event, we compute
* how much we have to jump (he = he->next()->twin()) from the halfedge
* that is stored in the event, to the halefge that is previous to 'curve'
* that is stored in the event, to the halfedge that is previous to 'curve'
* that is about to be inserted into the arrangement.
*/
int compute_halfedge_jump_count(Subcurve* curve)

View File

@ -262,7 +262,7 @@ private:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -67,6 +67,21 @@ 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);
// 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);
public:
/*! A notification invoked when a new subcurve is created. */
void add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc);
@ -99,6 +114,43 @@ public:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// update halfedge pointing to events, case with overlaps
//
template <typename Hlpr, typename Vis>
template <class Subcurve_>
void Arr_insertion_ss_visitor<Hlpr, Vis>::
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 <typename Hlpr, typename Vis>
template <class Subcurve_>
void Arr_insertion_ss_visitor<Hlpr, Vis>::
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());
}
//-----------------------------------------------------------------------------
// Check if the halfedge associated with the given subcurve will be split
// at the given event.
@ -132,9 +184,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;
}

View File

@ -219,7 +219,7 @@ protected:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -401,7 +401,7 @@ protected:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -126,7 +126,7 @@ public:
};
//-----------------------------------------------------------------------------
// Memeber-function definitions:
// Member-function definitions:
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

View File

@ -76,6 +76,20 @@ bool test_insert_at_vertices(){
return test_insert_at_vertices_1() && test_insert_at_vertices_2();
}
bool test_insert_on_overlap(){
Arrangement_2 arr;
std::vector<Segment_2> segs1, segs2;
segs1.emplace_back(Point_2(0, 0), Point_2(0, 4));
segs2.emplace_back(Point_2(0, 0), Point_2(4,4));
segs2.emplace_back(Point_2(0, 2), Point_2(0, 4));
segs2.emplace_back(Point_2(0, 2), Point_2(4,4));
CGAL::insert(arr, segs1.begin(), segs1.end());
CGAL::insert(arr, segs2.begin(), segs2.end());
return is_valid(arr);
}
int main ()
{
Arrangement_2 arr;
@ -136,6 +150,10 @@ int main ()
valid=test_insert_at_vertices();
std::cout << ( valid ? "valid." : "NOT valid!") << std::endl;
if (!valid) return 1;
std::cout << "Test insert on overlap\n";
valid=test_insert_on_overlap();
return valid?0:1;
}

View File

@ -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;

View File

@ -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;