mirror of https://github.com/CGAL/cgal
Introduced _move_all_isolated_vertices() and used it
This commit is contained in:
parent
452444e704
commit
9bfaa542d8
|
|
@ -516,10 +516,10 @@ public:
|
||||||
typedef Inner_ccb Hole;
|
typedef Inner_ccb Hole;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef Cast_function_object<void*, Halfedge*> _Ccb_to_halfedge_cast;
|
typedef Cast_function_object<void*, Halfedge*> _Ccb_to_halfedge_cast;
|
||||||
// typedef Cast_function_object<const void*,
|
// typedef Cast_function_object<const void*, const Halfedge*>
|
||||||
// const Halfedge*> _Const_ccb_to_halfedge_cast;
|
// _Const_ccb_to_halfedge_cast;
|
||||||
typedef _Ccb_to_halfedge_cast _Const_ccb_to_halfedge_cast;
|
typedef _Ccb_to_halfedge_cast _Const_ccb_to_halfedge_cast;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -667,6 +667,26 @@ public:
|
||||||
/*! Erase an isloated vertex from the face. */
|
/*! Erase an isloated vertex from the face. */
|
||||||
void erase_isolated_vertex(Isolated_vertex *iv)
|
void erase_isolated_vertex(Isolated_vertex *iv)
|
||||||
{ this->iso_verts.erase(iv->iterator().current_iterator()); }
|
{ this->iso_verts.erase(iv->iterator().current_iterator()); }
|
||||||
|
|
||||||
|
/*! Move all isolated vertices from the face to another. */
|
||||||
|
Isolated_vertex_iterator splice_isolated_vertices(Arr_face& other)
|
||||||
|
{
|
||||||
|
const bool was_empty = this->iso_verts.empty();
|
||||||
|
typename Base::Isolated_vertices_container::iterator previous =
|
||||||
|
this->iso_verts.end();
|
||||||
|
if (!was_empty) --previous;
|
||||||
|
this->iso_verts.splice(this->iso_verts.end(), other.iso_verts);
|
||||||
|
if (was_empty) previous = this->iso_verts.begin();
|
||||||
|
else ++previous;
|
||||||
|
for (typename Base::Isolated_vertices_container::iterator it = previous;
|
||||||
|
it != this->iso_verts.end(); ++it)
|
||||||
|
{
|
||||||
|
Isolated_vertex* iv = static_cast<Vertex*>(*it)->isolated_vertex();
|
||||||
|
iv->set_iterator(it);
|
||||||
|
iv->set_face(this);
|
||||||
|
}
|
||||||
|
return previous;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class
|
/*! \class
|
||||||
|
|
|
||||||
|
|
@ -2095,6 +2095,33 @@ _move_isolated_vertex(DFace* from_face, DFace* to_face, DVertex* v)
|
||||||
_notify_after_move_isolated_vertex(vh);
|
_notify_after_move_isolated_vertex(vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Move all isolated vertices from one face to another.
|
||||||
|
//
|
||||||
|
template <typename GeomTraits, typename TopTraits>
|
||||||
|
void Arrangement_on_surface_2<GeomTraits, TopTraits>::
|
||||||
|
_move_all_isolated_vertices(DFace* from_face, DFace* to_face)
|
||||||
|
{
|
||||||
|
// Comment EFEF 2015-09-28: The following loop and the loop at the end of this
|
||||||
|
// function should be replaced with a pair of notifiers, respectively,
|
||||||
|
// function_notify_before_move_all_isolated_vertices();
|
||||||
|
// function_notify_after_move_all_isolated_vertices();
|
||||||
|
DIso_vertex_iter iv_it = from_face->isolated_vertices_begin();
|
||||||
|
while (iv_it != from_face->isolated_vertices_end()) {
|
||||||
|
DVertex* v = &(*iv_it++);
|
||||||
|
Vertex_handle vh(v);
|
||||||
|
_notify_before_move_isolated_vertex(Face_handle(from_face),
|
||||||
|
Face_handle(to_face),
|
||||||
|
vh);
|
||||||
|
}
|
||||||
|
iv_it = to_face->splice_isolated_vertices(*from_face);
|
||||||
|
while (iv_it != to_face->isolated_vertices_end()) {
|
||||||
|
DVertex* v = &(*iv_it++);
|
||||||
|
Vertex_handle vh(v);
|
||||||
|
_notify_after_move_isolated_vertex(vh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Create a new vertex and associate it with the given point.
|
// Create a new vertex and associate it with the given point.
|
||||||
//
|
//
|
||||||
|
|
@ -4874,16 +4901,7 @@ _remove_edge(DHalfedge* e, bool remove_source, bool remove_target)
|
||||||
if (oc1->halfedge() == he1)
|
if (oc1->halfedge() == he1)
|
||||||
oc1->set_halfedge(prev1);
|
oc1->set_halfedge(prev1);
|
||||||
|
|
||||||
// Move the isolated vertices inside f2 to f1.
|
_move_all_isolated_vertices(f2, f1); // move all iso vertices from f2 to f1
|
||||||
DIso_vertex_iter iv_it = f2->isolated_vertices_begin();
|
|
||||||
DIso_vertex_iter iv_to_move;
|
|
||||||
while (iv_it != f2->isolated_vertices_end()) {
|
|
||||||
// We increment the isolated vertices itrator before moving the vertex,
|
|
||||||
// because this operation invalidates the iterator.
|
|
||||||
iv_to_move = iv_it;
|
|
||||||
++iv_it;
|
|
||||||
_move_isolated_vertex(f2, f1, &(*iv_to_move));
|
|
||||||
}
|
|
||||||
|
|
||||||
// If he1 or he2 are the incident halfedges to their target vertices,
|
// If he1 or he2 are the incident halfedges to their target vertices,
|
||||||
// we replace them by the appropriate predecessors.
|
// we replace them by the appropriate predecessors.
|
||||||
|
|
@ -4987,17 +5005,7 @@ _remove_edge(DHalfedge* e, bool remove_source, bool remove_target)
|
||||||
curr->set_inner_ccb(ic1);
|
curr->set_inner_ccb(ic1);
|
||||||
|
|
||||||
_move_all_inner_ccb(f2, f1); // move the inner CCBs from f2 to f1
|
_move_all_inner_ccb(f2, f1); // move the inner CCBs from f2 to f1
|
||||||
|
_move_all_isolated_vertices(f2, f1); // move all iso vertices from f2 to f1
|
||||||
// Move the isolated vertices inside f2 to f1.
|
|
||||||
DIso_vertex_iter iv_it = f2->isolated_vertices_begin();
|
|
||||||
DIso_vertex_iter iv_to_move;
|
|
||||||
while (iv_it != f2->isolated_vertices_end()) {
|
|
||||||
// We increment the isolated vertices itrator before moving the vertex,
|
|
||||||
// because this operation invalidates the iterator.
|
|
||||||
iv_to_move = iv_it;
|
|
||||||
++iv_it;
|
|
||||||
_move_isolated_vertex(f2, f1, &(*iv_to_move));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notice that f2 will be merged with f1, but its boundary will still be
|
// Notice that f2 will be merged with f1, but its boundary will still be
|
||||||
// a hole inside this face. In case he1 is a represantative of this hole,
|
// a hole inside this face. In case he1 is a represantative of this hole,
|
||||||
|
|
|
||||||
|
|
@ -1907,6 +1907,13 @@ protected:
|
||||||
*/
|
*/
|
||||||
void _move_isolated_vertex(DFace* from_face, DFace* to_face, DVertex* v);
|
void _move_isolated_vertex(DFace* from_face, DFace* to_face, DVertex* v);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Move all isolated vertices from one face to another.
|
||||||
|
* \param from_face The face currently containing the isolated vertices.
|
||||||
|
* \param to_face The face into which we should move the isolated vertices.
|
||||||
|
*/
|
||||||
|
void _move_all_isolated_vertices(DFace* from_face, DFace* to_face);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Create a new vertex and associate it with the given point.
|
* Create a new vertex and associate it with the given point.
|
||||||
* \param p The point.
|
* \param p The point.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue