mirror of https://github.com/CGAL/cgal
cleanup
This commit is contained in:
parent
b8a2648437
commit
5510218dc9
|
|
@ -110,65 +110,38 @@ public:
|
|||
Arr_parameter_space ps_y = event->parameter_space_in_y();
|
||||
|
||||
if (ps_y == ARR_BOTTOM_BOUNDARY) {
|
||||
// Bootom contraction boundary:
|
||||
// The event has only one (right or left) curve.
|
||||
CGAL_assertion(((event->number_of_left_curves() == 0) &&
|
||||
(event->number_of_right_curves() == 1)) ||
|
||||
((event->number_of_left_curves() == 1) &&
|
||||
(event->number_of_right_curves() == 0)));
|
||||
Arr_curve_end ind = (event->number_of_left_curves() == 0 &&
|
||||
event->number_of_right_curves() == 1) ?
|
||||
ARR_MIN_END : ARR_MAX_END;
|
||||
const X_monotone_curve_2 & xc = (ind == ARR_MIN_END) ?
|
||||
(*(event->right_curves_begin()))->last_curve() :
|
||||
(*(event->left_curves_begin()))->last_curve();
|
||||
// Process bootom contraction boundary:
|
||||
// The event has only one right curve.
|
||||
CGAL_assertion((event->number_of_left_curves() == 0) &&
|
||||
(event->number_of_right_curves() == 1));
|
||||
|
||||
// Check whether we have a vertex that corresponds to the south pole.
|
||||
// If not, we create one.
|
||||
if (m_top_traits->south_pole() == NULL) {
|
||||
Vertex_handle v =
|
||||
m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y);
|
||||
event->set_vertex_handle(v);
|
||||
DVertex* dv = m_top_traits->south_pole();
|
||||
if (dv) {
|
||||
event->set_vertex_handle(Vertex_handle(dv));
|
||||
return;
|
||||
}
|
||||
else
|
||||
event->set_vertex_handle(Vertex_handle(m_top_traits->south_pole()));
|
||||
// We do not have a vertex that corresponds to the south pole.
|
||||
// If not, we create one.
|
||||
Arr_curve_end ind = ARR_MIN_END;
|
||||
const X_monotone_curve_2& xc =
|
||||
(*(event->right_curves_begin()))->last_curve();
|
||||
Vertex_handle v = m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y);
|
||||
event->set_vertex_handle(v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ps_y == ARR_TOP_BOUNDARY) {
|
||||
// Top contraction boundary:
|
||||
// The event has only one (right or left) curve.
|
||||
CGAL_assertion(((event->number_of_left_curves() == 0) &&
|
||||
(event->number_of_right_curves() == 1)) ||
|
||||
((event->number_of_left_curves() == 1) &&
|
||||
(event->number_of_right_curves() == 0)));
|
||||
Arr_curve_end ind = ((event->number_of_left_curves() == 0) &&
|
||||
(event->number_of_right_curves() == 1)) ?
|
||||
ARR_MIN_END : ARR_MAX_END;
|
||||
|
||||
const X_monotone_curve_2 & xc = (ind == ARR_MIN_END) ?
|
||||
(*(event->right_curves_begin()))->last_curve() :
|
||||
// Process top contraction boundary:
|
||||
// The event has only one left curve.
|
||||
CGAL_assertion((event->number_of_left_curves() == 1) &&
|
||||
(event->number_of_right_curves() == 0));
|
||||
Arr_curve_end ind = ARR_MAX_END;
|
||||
const X_monotone_curve_2& xc =
|
||||
(*(event->left_curves_begin()))->last_curve();
|
||||
|
||||
// Check whether we have a vertex that corresponds to the north pole.
|
||||
// If not, we create one.
|
||||
if (m_top_traits->north_pole() == NULL) {
|
||||
Vertex_handle v =
|
||||
m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y);
|
||||
event->set_vertex_handle(v);
|
||||
|
||||
// Since this is the first event corresponding to the north pole,
|
||||
// the list m_subcurves_at_nf contains all subcurves whose minimal
|
||||
// endpoint lies between the curve of discontinuity and the current
|
||||
// curve incident to the north pole. In case these subcurves represent
|
||||
// holes, these holes should stay in the "north face" that contains the
|
||||
// line of discontinuity, and we should not keep track of them in order
|
||||
// to later move them to another face.
|
||||
m_subcurves_at_nf.clear();
|
||||
}
|
||||
else {
|
||||
event->set_vertex_handle(Vertex_handle(m_top_traits->north_pole()));
|
||||
|
||||
DVertex* dv = m_top_traits->north_pole();
|
||||
if (dv) {
|
||||
event->set_vertex_handle(Vertex_handle(dv));
|
||||
DHalfedge* dprev =
|
||||
m_top_traits->locate_around_boundary_vertex(m_top_traits->
|
||||
north_pole(), xc, ind,
|
||||
|
|
@ -186,10 +159,24 @@ public:
|
|||
}
|
||||
else
|
||||
m_subcurves_at_nf.clear();
|
||||
CGAL_assertion(m_subcurves_at_nf.empty());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// We do nothave a vertex that corresponds to the north pole.
|
||||
// Create one.
|
||||
Vertex_handle v =
|
||||
m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y);
|
||||
event->set_vertex_handle(v);
|
||||
|
||||
// Since this is the first event corresponding to the north pole,
|
||||
// the list m_subcurves_at_nf contains all subcurves whose minimal
|
||||
// endpoint lies between the curve of discontinuity and the current
|
||||
// curve incident to the north pole. In case these subcurves represent
|
||||
// holes, these holes should stay in the "north face" that contains the
|
||||
// line of discontinuity, and we should not keep track of them in order
|
||||
// to later move them to another face.
|
||||
m_subcurves_at_nf.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +184,7 @@ public:
|
|||
// The event has only right curves.
|
||||
CGAL_assertion((event->number_of_left_curves() == 0) &&
|
||||
(event->number_of_right_curves() >= 1));
|
||||
const X_monotone_curve_2 & xc =
|
||||
const X_monotone_curve_2& xc =
|
||||
(*(event->right_curves_begin()))->last_curve();
|
||||
DVertex* v = m_top_traits->discontinuity_vertex(xc, ARR_MIN_END);
|
||||
|
||||
|
|
@ -217,7 +204,7 @@ public:
|
|||
// The event has only left curves.
|
||||
CGAL_assertion((event->number_of_left_curves() >= 1) &&
|
||||
(event->number_of_right_curves() == 0));
|
||||
const X_monotone_curve_2 & xc =
|
||||
const X_monotone_curve_2& xc =
|
||||
(*(event->left_curves_begin()))->last_curve();
|
||||
DVertex* v = m_top_traits->discontinuity_vertex(xc, ARR_MAX_END);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct Integer_hash_function {
|
|||
/*! \class Arr_construction_sl_visitor
|
||||
* A sweep-line visitor for constructing an arrangement embedded on a surface.
|
||||
*/
|
||||
template <class Helper_>
|
||||
template <typename Helper_>
|
||||
class Arr_construction_sl_visitor : public Helper_::Base_visitor {
|
||||
public:
|
||||
typedef Helper_ Helper;
|
||||
|
|
@ -79,9 +79,8 @@ protected:
|
|||
|
||||
typedef typename Helper::Indices_list Indices_list;
|
||||
typedef typename Helper::Halfedge_indices_map Halfedge_indices_map;
|
||||
typedef Unique_hash_map<unsigned int,
|
||||
Vertex_handle,
|
||||
Integer_hash_function> Iso_vertices_map;
|
||||
typedef Unique_hash_map<unsigned int, Vertex_handle, Integer_hash_function>
|
||||
Iso_vertices_map;
|
||||
|
||||
protected:
|
||||
Helper m_helper; // The helper class.
|
||||
|
|
@ -118,9 +117,7 @@ public:
|
|||
m_sc_counter(0),
|
||||
m_sc_he_table(1),
|
||||
m_invalid_vertex()
|
||||
{
|
||||
m_helper.set_halfedge_indices_map(m_he_indices_table);
|
||||
}
|
||||
{ m_helper.set_halfedge_indices_map(m_he_indices_table); }
|
||||
|
||||
/*! Destructor. */
|
||||
virtual ~Arr_construction_sl_visitor() {}
|
||||
|
|
@ -217,9 +214,7 @@ public:
|
|||
|
||||
/*! Get the last event associated with the given subcurve. */
|
||||
Event* last_event_on_subcurve(Subcurve* sc)
|
||||
{
|
||||
return (reinterpret_cast<Event*>((sc)->last_event()));
|
||||
}
|
||||
{ return (reinterpret_cast<Event*>((sc)->last_event())); }
|
||||
|
||||
private:
|
||||
/// \name Auxiliary functions.
|
||||
|
|
@ -231,9 +226,7 @@ private:
|
|||
* from this base class.
|
||||
*/
|
||||
inline const typename Arrangement_2::Point_2& _point(const Point_2& p) const
|
||||
{
|
||||
return (static_cast<const typename Arrangement_2::Point_2&>(p));
|
||||
}
|
||||
{ return (static_cast<const typename Arrangement_2::Point_2&>(p)); }
|
||||
|
||||
/*!
|
||||
* Cast a Traits::X_monotone_curve_2 object into an
|
||||
|
|
@ -258,13 +251,10 @@ private:
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification issued before the sweep process starts.
|
||||
//
|
||||
template <class Hlpr>
|
||||
// Notifies the helper that the sweep process now starts.
|
||||
template <typename Hlpr>
|
||||
void Arr_construction_sl_visitor<Hlpr>::before_sweep()
|
||||
{
|
||||
// We just have to notify the helper that the sweep process now starts.
|
||||
m_helper.before_sweep();
|
||||
}
|
||||
{ m_helper.before_sweep(); }
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification invoked before the sweep-line starts handling the given
|
||||
|
|
@ -284,7 +274,7 @@ void Arr_construction_sl_visitor<Hlpr>::before_handle_event(Event* event)
|
|||
// A notification invoked after the sweep-line finishes handling the given
|
||||
// event.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
bool Arr_construction_sl_visitor<Hlpr>::
|
||||
after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
|
||||
{
|
||||
|
|
@ -298,9 +288,9 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
|
|||
// There are no incident subcurves, so this event is an isolated vertex.
|
||||
// We map the current index to this vertex, and add this index to the
|
||||
// indices list of the curve the vertex "sees" from below.
|
||||
Vertex_handle v = insert_isolated_vertex(event->point(), iter);
|
||||
Vertex_handle v = insert_isolated_vertex(event->point(), iter);
|
||||
|
||||
m_sc_counter++;
|
||||
++m_sc_counter;
|
||||
m_iso_verts_map[m_sc_counter] = v;
|
||||
_map_new_halfedge(m_sc_counter, Halfedge_handle());
|
||||
|
||||
|
|
@ -320,26 +310,23 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
|
|||
}
|
||||
|
||||
// The event can now be deallocated.
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO EBEB 2012-10-16 compile only when non-oblivious
|
||||
if (event->parameter_space_in_x() == CGAL::ARR_LEFT_BOUNDARY) {
|
||||
if (!this->is_status_line_empty()) {
|
||||
Status_line_iterator prev = iter;
|
||||
for (unsigned i = 0; i < event->number_of_right_curves(); i++) {
|
||||
--prev;
|
||||
}
|
||||
for (unsigned i = 0; i < event->number_of_right_curves(); ++i) --prev;
|
||||
// move items from top face to last inserted curve
|
||||
Indices_list& list_ref = (*prev)->halfedges_indices_list();
|
||||
Indices_list& list_ref = (*prev)->halfedge_indices_list();
|
||||
list_ref.clear();
|
||||
list_ref.splice(list_ref.end(), m_helper.halfedge_indices_list());
|
||||
|
||||
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
|
||||
for (typename Indices_list::const_iterator it = list_ref.begin();
|
||||
it != list_ref.end(); it++) {
|
||||
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
|
||||
typename Indices_list::const_iterator it;
|
||||
for (it = list_ref.begin(); it != list_ref.end(); ++it)
|
||||
std::cout << "moved " << *it << " from top to below" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -352,11 +339,11 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
|
|||
// associated with a point that may be the leftmost one in a hole.
|
||||
// We give index to the topmost subcurve from the right, and add this
|
||||
// vertex indices list of the curve the event "sees" from below.
|
||||
m_sc_counter++;
|
||||
++m_sc_counter;
|
||||
(*(event->right_curves_rbegin()))->set_index(m_sc_counter);
|
||||
if (iter != this->status_line_end()) {
|
||||
// The vertex "sees" the subcurve of the given position from below.
|
||||
Subcurve *sc_above = *iter;
|
||||
Subcurve* sc_above = *iter;
|
||||
sc_above->add_halfedge_index(m_sc_counter);
|
||||
}
|
||||
else {
|
||||
|
|
@ -383,7 +370,7 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
|
|||
if (event->number_of_right_curves() == 0) {
|
||||
// Inform the helper class that the event will soon be deallocated.
|
||||
m_helper.before_deallocate_event(event);
|
||||
return (true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Mark that all right subcurves incident to the current event are not
|
||||
|
|
@ -401,13 +388,13 @@ after_handle_event(Event* event, Status_line_iterator iter, bool /* flag */)
|
|||
}
|
||||
|
||||
// Mark that the event cannot be deallocated just yet.
|
||||
return (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A notification invoked when a new subcurve is created.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
void Arr_construction_sl_visitor<Hlpr>::
|
||||
add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
|
||||
{
|
||||
|
|
@ -548,10 +535,8 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
|
|||
if ((last_event->number_of_left_curves() == 0) &&
|
||||
last_event->is_curve_largest((Subcurve*)sc))
|
||||
{
|
||||
|
||||
if (last_event->vertex_handle() == m_invalid_vertex) {
|
||||
if (last_event->vertex_handle() == m_invalid_vertex)
|
||||
last_event->set_halfedge_handle(res->twin());
|
||||
}
|
||||
|
||||
// If sc has valid index, insert its index to m_sc_he_table.
|
||||
if (sc->has_valid_index()) {
|
||||
|
|
@ -561,9 +546,8 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
|
|||
}
|
||||
|
||||
// Update the halfedge handle associated with the current event.
|
||||
if (this->current_event()->vertex_handle() == m_invalid_vertex) {
|
||||
if (this->current_event()->vertex_handle() == m_invalid_vertex)
|
||||
this->current_event()->set_halfedge_handle(res);
|
||||
}
|
||||
|
||||
// In case the event has no more right subcurves associated with it, we can
|
||||
// deallocate it. Note that we inform the helper class before deallocating
|
||||
|
|
@ -580,7 +564,7 @@ add_subcurve(const X_monotone_curve_2& cv, Subcurve* sc)
|
|||
//-----------------------------------------------------------------------------
|
||||
// Insert the given subcurve in the interior of an arrangement face.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle
|
||||
Arr_construction_sl_visitor<Hlpr>::
|
||||
insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc)
|
||||
|
|
@ -623,13 +607,13 @@ insert_in_face_interior(const X_monotone_curve_2& cv, Subcurve* sc)
|
|||
// Notify the helper on the creation of the new halfedge.
|
||||
m_helper.add_subcurve(res, sc);
|
||||
|
||||
return (res);
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Insert the given subcurve using its two end-vertices.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle
|
||||
Arr_construction_sl_visitor<Hlpr>::
|
||||
insert_at_vertices(const X_monotone_curve_2& cv,
|
||||
|
|
@ -676,17 +660,13 @@ insert_at_vertices(const X_monotone_curve_2& cv,
|
|||
Halfedge_handle curr1 = prev1->next();
|
||||
bool found2 = false;
|
||||
while (curr1 != prev1) {
|
||||
if (curr1 == prev2) {
|
||||
found2 = true;
|
||||
}
|
||||
if (curr1 == prev2) found2 = true;
|
||||
curr1 = curr1->next();
|
||||
}
|
||||
Halfedge_handle curr2 = prev2->next();
|
||||
bool found1 = false;
|
||||
while (curr2 != prev2) {
|
||||
if (curr2 == prev1) {
|
||||
found1 = true;
|
||||
}
|
||||
if (curr2 == prev1) found1 = true;
|
||||
curr2 = curr2->next();
|
||||
}
|
||||
if (found1 && found2) {
|
||||
|
|
@ -733,20 +713,15 @@ insert_at_vertices(const X_monotone_curve_2& cv,
|
|||
res = m_arr_access.insert_at_vertices_ex(prev1, _curve(cv), ARR_RIGHT_TO_LEFT,
|
||||
prev2->next(), new_face_created,
|
||||
check_swapped_predecessors);
|
||||
if (check_swapped_predecessors)
|
||||
res = res->twin();
|
||||
if (check_swapped_predecessors) res = res->twin();
|
||||
#endif
|
||||
|
||||
// Map the new halfedge to the indices list of all subcurves that lie
|
||||
// below it.
|
||||
if (sc->has_halfedge_indices()) {
|
||||
Halfedge_handle he = res;
|
||||
|
||||
if (swap_preds)
|
||||
he = he->twin();
|
||||
|
||||
if (swap_preds) he = he->twin();
|
||||
CGAL_assertion(he->direction() == ARR_RIGHT_TO_LEFT);
|
||||
|
||||
Indices_list& list_ref = m_he_indices_table[he];
|
||||
list_ref.clear();
|
||||
list_ref.splice(list_ref.end(), sc->halfedge_indices_list());
|
||||
|
|
@ -767,13 +742,13 @@ insert_at_vertices(const X_monotone_curve_2& cv,
|
|||
this->relocate_in_new_face(res);
|
||||
}
|
||||
|
||||
return (res);
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Insert the given subcurve from a vertex that corresponds to its right end.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle
|
||||
Arr_construction_sl_visitor<Hlpr>::
|
||||
insert_from_right_vertex(const X_monotone_curve_2& cv,
|
||||
|
|
@ -801,7 +776,7 @@ insert_from_right_vertex(const X_monotone_curve_2& cv,
|
|||
|
||||
// Insert the curve given its left vertex and the predecessor around the
|
||||
// right vertex.
|
||||
Halfedge_handle res =
|
||||
Halfedge_handle res =
|
||||
m_arr_access.insert_from_vertex_ex(prev, _curve(cv), ARR_RIGHT_TO_LEFT, v);
|
||||
|
||||
// Map the new halfedge to the indices list of all subcurves that lie
|
||||
|
|
@ -815,14 +790,13 @@ insert_from_right_vertex(const X_monotone_curve_2& cv,
|
|||
|
||||
// Notify the helper on the creation of the new halfedge.
|
||||
m_helper.add_subcurve(res, sc);
|
||||
|
||||
return (res);
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Insert the given subcurve from a vertex that corresponds to its left end.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
typename Arr_construction_sl_visitor<Hlpr>::Halfedge_handle
|
||||
Arr_construction_sl_visitor<Hlpr>::
|
||||
insert_from_left_vertex(const X_monotone_curve_2& cv,
|
||||
|
|
@ -864,14 +838,13 @@ insert_from_left_vertex(const X_monotone_curve_2& cv,
|
|||
|
||||
// Notify the helper on the creation of the new halfedge.
|
||||
m_helper.add_subcurve(res, sc);
|
||||
|
||||
return (res);
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Insert an isolated vertex into the arrangement.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
typename Arr_construction_sl_visitor<Hlpr>::Vertex_handle
|
||||
Arr_construction_sl_visitor<Hlpr>::
|
||||
insert_isolated_vertex(const Point_2& pt, Status_line_iterator /* iter */)
|
||||
|
|
@ -888,7 +861,7 @@ insert_isolated_vertex(const Point_2& pt, Status_line_iterator /* iter */)
|
|||
//-----------------------------------------------------------------------------
|
||||
// Reloacte holes and isolated vertices inside a newly created face.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
|
||||
{
|
||||
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
|
||||
|
|
@ -897,9 +870,6 @@ void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
|
|||
std::cout << "HeDi: " << he->direction() << std::endl;
|
||||
#endif
|
||||
|
||||
// We use a constant indices map so no new entries are added there.
|
||||
const Halfedge_indices_map& const_he_indices_table = m_he_indices_table;
|
||||
|
||||
// Go along the boundary of the new face.
|
||||
Face_handle new_face = he->face();
|
||||
Halfedge_handle curr_he = he;
|
||||
|
|
@ -919,9 +889,8 @@ void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
|
|||
|
||||
// Get the indices list associated with the current halfedges, representing
|
||||
// the halfedges and isolated vertices that "see" it from above.
|
||||
const Indices_list& indices_list = const_he_indices_table[curr_he];
|
||||
const Indices_list& indices_list = m_he_indices_table[curr_he];
|
||||
typename Indices_list::const_iterator itr;
|
||||
|
||||
for (itr = indices_list.begin(); itr != indices_list.end(); ++itr) {
|
||||
#if CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE
|
||||
std::cout << "itr: " << *itr << std::endl;
|
||||
|
|
@ -933,16 +902,13 @@ void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
|
|||
// not yet mapped. This can happen only if this halfedge is he itself.
|
||||
// As we know that he lies on the outer CCB of the new face, it is
|
||||
// definitely not a hole in the face, therefore we can ignore it.
|
||||
if ((*itr > m_sc_counter) || (*itr >= m_sc_he_table.size()))
|
||||
continue;
|
||||
if ((*itr > m_sc_counter) || (*itr >= m_sc_he_table.size())) continue;
|
||||
|
||||
Halfedge_handle he_on_face = m_sc_he_table[*itr];
|
||||
|
||||
if (he_on_face == invalid_he) {
|
||||
// If the halfedge handle is invalid, then we have an index for an
|
||||
// isolated vertex. Move this vertex to the new face, if necessary.
|
||||
v = m_iso_verts_map[*itr];
|
||||
|
||||
CGAL_assertion(v != m_invalid_vertex);
|
||||
if (v->face() != new_face) {
|
||||
m_arr_access.move_isolated_vertex(v->face(), new_face, v);
|
||||
|
|
@ -951,10 +917,9 @@ void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
|
|||
else {
|
||||
// If necessary, move the hole that the halfedge belongs to into the
|
||||
// new face.
|
||||
if (he_on_face->twin()->face() != new_face &&
|
||||
if ((he_on_face->twin()->face() != new_face) &&
|
||||
he_on_face->twin()->is_on_inner_ccb())
|
||||
{
|
||||
//std::cout << "move inner ccb " << std::endl;
|
||||
m_arr_access.move_inner_ccb(he_on_face->twin()->face(),
|
||||
new_face,
|
||||
he_on_face->twin()->ccb());
|
||||
|
|
@ -975,7 +940,7 @@ void Arr_construction_sl_visitor<Hlpr>::relocate_in_new_face(Halfedge_handle he)
|
|||
//-----------------------------------------------------------------------------
|
||||
// Map the given subcurve index to the given halfedge handle.
|
||||
//
|
||||
template <class Hlpr>
|
||||
template <typename Hlpr>
|
||||
void Arr_construction_sl_visitor<Hlpr>::
|
||||
_map_new_halfedge(unsigned int i, Halfedge_handle he)
|
||||
{
|
||||
|
|
@ -985,8 +950,7 @@ _map_new_halfedge(unsigned int i, Halfedge_handle he)
|
|||
#endif
|
||||
CGAL_assertion(i != 0);
|
||||
// Resize the index table if needed.
|
||||
if (i >= m_sc_he_table.size())
|
||||
m_sc_he_table.resize(i+1);
|
||||
if (i >= m_sc_he_table.size()) m_sc_he_table.resize(i+1);
|
||||
|
||||
// Map the index to the given halfedge handle.
|
||||
m_sc_he_table[i] = he;
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@ namespace CGAL {
|
|||
* \sa Sweep_line_subcurve
|
||||
*/
|
||||
|
||||
template<class Traits_>
|
||||
template <typename Traits_>
|
||||
class Arr_construction_subcurve : public Sweep_line_subcurve<Traits_>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Traits_ Traits_2;
|
||||
typedef typename Traits_2::Point_2 Point_2;
|
||||
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
|
@ -62,7 +61,7 @@ public:
|
|||
protected:
|
||||
|
||||
// Data members:
|
||||
Event_ptr m_lastEvent; // The last event that was handled on the curve.
|
||||
Event_ptr m_lastEvent; // The last event that was handled on the curve.
|
||||
|
||||
/*! index for a subcurve that may represent a hole (emarge from the left
|
||||
* most vertex of a hole, and its the upper most curve). other subcurves
|
||||
|
|
@ -73,12 +72,11 @@ protected:
|
|||
// and it is the topmost curve). Other subcurves
|
||||
// have a 0 (invalid) index.
|
||||
|
||||
Halfedge_indices_list m_halfedge_indices;
|
||||
Halfedge_indices_list m_halfedge_indices;
|
||||
// Indices of all halfedge below the curve that
|
||||
// may represent a hole.
|
||||
|
||||
public:
|
||||
|
||||
/*! Deafult constructor. */
|
||||
Arr_construction_subcurve() :
|
||||
Base(),
|
||||
|
|
@ -87,84 +85,49 @@ public:
|
|||
{}
|
||||
|
||||
/*! Constructor from an x-monotone curve. */
|
||||
Arr_construction_subcurve (X_monotone_curve_2& curve) :
|
||||
Arr_construction_subcurve(X_monotone_curve_2& curve) :
|
||||
Base( curve),
|
||||
m_lastEvent(0),
|
||||
m_index(0)
|
||||
{}
|
||||
|
||||
/*! Initialize the curve. */
|
||||
void init (const X_monotone_curve_2& curve)
|
||||
{
|
||||
Base::init(curve);
|
||||
}
|
||||
void init(const X_monotone_curve_2& curve) { Base::init(curve); }
|
||||
|
||||
/*! Set the event associated with the left end of the subcurve. */
|
||||
template<class SweepEvent>
|
||||
void set_left_event (SweepEvent* left)
|
||||
void set_left_event(SweepEvent* left)
|
||||
{
|
||||
Base::set_left_event(left);
|
||||
m_lastEvent = left;
|
||||
}
|
||||
|
||||
/*! Set the last event on the subcurve. */
|
||||
void set_last_event (Event_ptr e)
|
||||
{
|
||||
m_lastEvent = e;
|
||||
}
|
||||
void set_last_event(Event_ptr e) { m_lastEvent = e; }
|
||||
|
||||
/*! Get the last event. */
|
||||
Event_ptr last_event() const
|
||||
{
|
||||
return m_lastEvent;
|
||||
}
|
||||
Event_ptr last_event() const { return m_lastEvent; }
|
||||
|
||||
/*! Get the subcurve index. */
|
||||
unsigned int index() const
|
||||
{
|
||||
return (m_index);
|
||||
}
|
||||
unsigned int index() const { return m_index; }
|
||||
|
||||
/*! Set the subcurve index. */
|
||||
void set_index(unsigned int i)
|
||||
{
|
||||
m_index = i;
|
||||
}
|
||||
void set_index(unsigned int i) { m_index = i; }
|
||||
|
||||
/*! Check if the index is valid. */
|
||||
bool has_valid_index() const
|
||||
{
|
||||
return (m_index != 0);
|
||||
}
|
||||
bool has_valid_index() const { return (m_index != 0); }
|
||||
|
||||
/*! Add an index of a halfedge below the subcurve. */
|
||||
void add_halfedge_index (unsigned int i)
|
||||
{
|
||||
m_halfedge_indices.push_back(i);
|
||||
}
|
||||
|
||||
Halfedge_indices_list& halfedges_indices_list()
|
||||
{
|
||||
return m_halfedge_indices;
|
||||
}
|
||||
void add_halfedge_index(unsigned int i) { m_halfedge_indices.push_back(i); }
|
||||
|
||||
/*! Clear the indices of the halfedges below the subcurve. */
|
||||
void clear_halfedge_indices()
|
||||
{
|
||||
m_halfedge_indices.clear();
|
||||
}
|
||||
void clear_halfedge_indices() { m_halfedge_indices.clear(); }
|
||||
|
||||
/*! Check if there are any halfedges below the subcurve. */
|
||||
bool has_halfedge_indices() const
|
||||
{
|
||||
return (!m_halfedge_indices.empty());
|
||||
}
|
||||
bool has_halfedge_indices() const { return (!m_halfedge_indices.empty()); }
|
||||
|
||||
/*! Get the indices of the halfedges below the subcurve. */
|
||||
Halfedge_indices_list& halfedge_indices_list()
|
||||
{
|
||||
return (m_halfedge_indices);
|
||||
}
|
||||
Halfedge_indices_list& halfedge_indices_list() { return m_halfedge_indices; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -762,7 +762,6 @@ _push_event(const X_monotone_curve_2& cv, Arr_curve_end ind, Attribute type,
|
|||
// looked for it.
|
||||
m_queue->insert_before(pair_res.first, e);
|
||||
}
|
||||
|
||||
return (std::make_pair(e, !exist));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_complete_sweep()
|
|||
template <typename Tr, typename Vis, typename Subcv, typename Evnt,
|
||||
typename Alloc>
|
||||
void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
|
||||
{
|
||||
{
|
||||
CGAL_PRINT("Handling left curve" << std::endl);
|
||||
|
||||
this->m_is_event_on_above = false;
|
||||
|
|
@ -116,7 +116,7 @@ void Sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_handle_left_curves()
|
|||
|
||||
// If necessary, add the subcurves as a right incident curve as well.
|
||||
// We also check for overlaps.
|
||||
bool is_overlap = _add_curve_to_right(this->m_currentEvent, sc);
|
||||
bool is_overlap = _add_curve_to_right(this->m_currentEvent, sc);
|
||||
|
||||
this->m_traits->split_2_object()(last_curve,
|
||||
this->m_currentEvent->point(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue