Support for isolated vertices on the boundary

This commit is contained in:
Efi Fogel 2014-09-20 12:36:17 +03:00
parent 7247e971fc
commit cbb551b42d
36 changed files with 433 additions and 353 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,43 @@
//! \file examples/Arrangement_on_surface_2/aggregated_insertion.cpp
// Using the global aggregated insertion functions.
#include <list>
#include <CGAL/basic.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/Cartesian.h>
#include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
#include <CGAL/Arr_spherical_topology_traits_2.h>
typedef CGAL::Exact_rational Number_type;
typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel> Geom_traits_2;
typedef Geom_traits_2::Point_2 Point_2;
typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Arr_spherical_topology_traits_2<Geom_traits_2> Topol_traits_2;
typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle;
int main()
{
Arrangement_2 arr;
Point_2 sp(0, 0, -1);
Point_2 np(0, 0, 1);
Vertex_handle spv = arr.insert_in_face_interior(sp, arr.reference_face());
X_monotone_curve_2 xcv1(Point_2(0, 0, -1), Point_2(1, 0, 0));
X_monotone_curve_2 xcv2(Point_2(0, 0, -1), Point_2(1, 1, 0));
arr.insert_from_left_vertex(xcv1, spv);
arr.insert_from_left_vertex(xcv2, spv);
// Print the size of the arrangement.
std::cout << "The arrangement size:" << std::endl
<< " V = " << arr.number_of_vertices()
<< ", E = " << arr.number_of_edges()
<< ", F = " << arr.number_of_faces() << std::endl;
std::cout << "arr: " << arr << std::endl;
return 0;
}

View File

@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_ARR_OBSERVER_H
@ -33,11 +29,10 @@ namespace CGAL {
* A base class for arrangement observers.
* The Arrangement parameter corresponds to an arrangement instantiation.
*/
template <class Arrangement_>
template <typename Arrangement_>
class Arr_observer
{
public:
typedef Arrangement_ Arrangement_2;
typedef Arr_observer<Arrangement_2> Self;
@ -47,43 +42,38 @@ public:
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Ccb_halfedge_circulator
typedef typename Arrangement_2::Ccb_halfedge_circulator
Ccb_halfedge_circulator;
private:
Arrangement_2 *p_arr; // The associated arrangement.
Arrangement_2* p_arr; // The associated arrangement.
/*! Copy constructor - not supported. */
Arr_observer (const Self& );
Arr_observer(const Self&);
/*! Assignment operator - not supported. */
Self& operator= (const Self& );
Self& operator=(const Self&);
public:
/// \name Construction and destruction functions.
//@{
/*! Default constructor. */
Arr_observer () :
p_arr (NULL)
{}
Arr_observer() : p_arr(NULL) {}
/*! Constructor with an associated arrangement. */
Arr_observer (Arrangement_2& arr) :
p_arr (&arr)
Arr_observer(Arrangement_2& arr) : p_arr(&arr)
{
// Register the observer object in the arrangement.
p_arr->_register_observer (this);
p_arr->_register_observer(this);
}
/*! Destructor. */
virtual ~Arr_observer ()
virtual ~Arr_observer()
{
// Unregister the observer object from the arrangement.
if (p_arr != NULL)
p_arr->_unregister_observer (this);
p_arr->_unregister_observer(this);
}
//@}
@ -91,132 +81,96 @@ public:
//@{
/*! Get the associated arrangement (non-const version). */
const Arrangement_2* arrangement () const
{
return (p_arr);
}
const Arrangement_2* arrangement() const { return (p_arr); }
/*! Get the associated arrangement (non-const version). */
Arrangement_2* arrangement ()
{
return (p_arr);
}
Arrangement_2* arrangement() { return (p_arr); }
/*!
* Attach the observer to an arrangement.
/*! Attach the observer to an arrangement.
* \pre The observer is not already attached to an arrangement.
*/
void attach (Arrangement_2& arr)
void attach(Arrangement_2& arr)
{
// Do nothing if the associated arrangement is not changed.
if (p_arr == &arr)
return;
if (p_arr == &arr) return;
// The observer is not already attached to an arrangement.
CGAL_precondition (p_arr == NULL);
CGAL_precondition(p_arr == NULL);
if (p_arr != NULL)
return;
if (p_arr != NULL) return;
// Notify the concrete oberver (the sub-class) about the attachment.
before_attach (arr);
before_attach(arr);
// Register the observer object in the new arrangement.
p_arr = &arr;
p_arr->_register_observer (this);
p_arr->_register_observer(this);
// Notify the concrete oberver that the attachment took place.
after_attach();
return;
}
/*! Detach the observer from the arrangement. */
void detach ()
void detach()
{
if (p_arr == NULL)
return;
if (p_arr == NULL) return;
// Notify the concrete oberver (the sub-class) about the detachment.
before_detach ();
// Unregister the observer object from the current arrangement, and mark
// that the oberver is not attached to an arrangement.
p_arr->_unregister_observer (this);
p_arr->_unregister_observer(this);
p_arr = NULL;
// Notify the concrete oberver that the detachment took place.
after_detach();
return;
}
//@}
/// \name Notification functions on global arrangement operations.
//@{
/*!
* Notification before the arrangement is assigned with another
/*! Notification before the arrangement is assigned with another
* arrangement.
* \param arr The arrangement to be copied.
*/
virtual void before_assign (const Arrangement_2& /* arr */)
{}
virtual void before_assign(const Arrangement_2& /* arr */) {}
/*!
* Notification after the arrangement has been assigned with another
/*! Notification after the arrangement has been assigned with another
* arrangement.
*/
virtual void after_assign ()
{}
virtual void after_assign() {}
/*! Notification before the arrangement is cleared. */
virtual void before_clear ()
{}
virtual void before_clear() {}
/*!
* Notification after the arrangement is cleared.
*/
virtual void after_clear ()
{}
/*! Notification after the arrangement is cleared. */
virtual void after_clear() {}
/*! Notification before a global operation modifies the arrangement. */
virtual void before_global_change ()
{}
virtual void before_global_change() {}
/*! Notification after a global operation is completed. */
virtual void after_global_change ()
{}
virtual void after_global_change() {}
//@}
/// \name Notification functions on observer attachment or detachment.
//@{
/*!
* Notification before the observer is attached to an arrangement.
/*! Notification before the observer is attached to an arrangement.
* \param arr The arrangement we are about to attach the observer to.
*/
virtual void before_attach (const Arrangement_2& /* arr */)
{}
virtual void before_attach(const Arrangement_2& /* arr */) {}
/*!
* Notification after the observer has been attached to an arrangement.
*/
virtual void after_attach ()
{}
/*! Notification after the observer has been attached to an arrangement. */
virtual void after_attach() {}
/*!
* Notification before the observer is detached from the arrangement.
*/
virtual void before_detach ()
{}
/*! Notification before the observer is detached from the arrangement. */
virtual void before_detach() {}
/*!
* Notification after the observer has been detached to the arrangement.
*/
virtual void after_detach ()
{}
/*! Notification after the observer has been detached to the arrangement. */
virtual void after_detach() {}
//@}
/// \name Notification functions on local changes in the arrangement.
@ -227,449 +181,388 @@ public:
* \param p The point to be associated with the vertex.
* This point cannot lies on the surface boundaries.
*/
virtual void before_create_vertex (const Point_2& /* p */)
{}
virtual void before_create_vertex(const Point_2& /* p */) {}
/*!
* Notification after the creation of a new vertex.
/*! Notification after the creation of a new vertex.
* \param v A handle to the created vertex.
*/
virtual void after_create_vertex (Vertex_handle /* v */)
virtual void after_create_vertex(Vertex_handle /* v */)
{}
/*!
* Notification before the creation of a new boundary vertex.
/*! Notification before the creation of a new boundary vertex.
* \param p The on the surface boundary.
* \param ps_x The boundary condition of the vertex in x.
* \param ps_y The boundary condition of the vertex in y.
*/
virtual void before_create_boundary_vertex(const Point_2& /* p */,
Arr_parameter_space /* ps_x */,
Arr_parameter_space /* ps_y */)
{}
/*! Notification before the creation of a new boundary vertex.
* \param cv The curve incident to the surface boundary.
* \param ind The relevant curve-end.
* \param ps_x The boundary condition of the vertex in x.
* \param ps_y The boundary condition of the vertex in y.
*/
virtual void before_create_boundary_vertex (const X_monotone_curve_2& /*cv*/,
Arr_curve_end /* ind */,
Arr_parameter_space /* ps_x */,
Arr_parameter_space /* ps_y */)
virtual void before_create_boundary_vertex(const X_monotone_curve_2& /* cv */,
Arr_curve_end /* ind */,
Arr_parameter_space /* ps_x */,
Arr_parameter_space /* ps_y */)
{}
/*!
* Notification after the creation of a new vertex at infinity.
/*! Notification after the creation of a new vertex at infinity.
* \param v A handle to the created vertex.
*/
virtual void after_create_boundary_vertex (Vertex_handle /* v */)
{}
virtual void after_create_boundary_vertex(Vertex_handle /* v */) {}
/*!
* Notification before the creation of a new edge.
/*! Notification before the creation of a new edge.
* \param c The x-monotone curve to be associated with the edge.
* \param v1 A handle to the first end-vertex of the edge.
* \param v2 A handle to the second end-vertex of the edge.
*/
virtual void before_create_edge (const X_monotone_curve_2& /* c */,
Vertex_handle /* v1 */,
Vertex_handle /* v2 */)
virtual void before_create_edge(const X_monotone_curve_2& /* c */,
Vertex_handle /* v1 */,
Vertex_handle /* v2 */)
{}
/*!
* Notification after the creation of a new edge.
/*! Notification after the creation of a new edge.
* \param e A handle to one of the twin halfedges that were created.
*/
virtual void after_create_edge (Halfedge_handle /* e */)
{}
virtual void after_create_edge(Halfedge_handle /* e */) {}
/*!
* Notification before the modification of an existing vertex.
/*! Notification before the modification of an existing vertex.
* \param v A handle to the vertex to be updated.
* \param p The point to be associated with the vertex.
*/
virtual void before_modify_vertex (Vertex_handle /* v */,
const Point_2& /* p */)
virtual void before_modify_vertex(Vertex_handle /* v */,
const Point_2& /* p */)
{}
/*!
* Notification after a vertex was modified.
/*! Notification after a vertex was modified.
* \param v A handle to the updated vertex.
*/
virtual void after_modify_vertex (Vertex_handle /* v */)
{}
virtual void after_modify_vertex(Vertex_handle /* v */) {}
/*!
* Notification before the modification of an existing edge.
/*! Notification before the modification of an existing edge.
* \param e A handle to one of the twin halfedges to be updated.
* \param c The x-monotone curve to be associated with the edge.
*/
virtual void before_modify_edge (Halfedge_handle /* e */,
const X_monotone_curve_2& /* c */)
virtual void before_modify_edge(Halfedge_handle /* e */,
const X_monotone_curve_2& /* c */)
{}
/*!
* Notification after an edge was modified.
/*! Notification after an edge was modified.
* \param e A handle to one of the twin halfedges that were updated.
*/
virtual void after_modify_edge (Halfedge_handle /* e */)
{}
virtual void after_modify_edge(Halfedge_handle /* e */) {}
/*!
* Notification before the splitting of an edge into two.
/*! Notification before the splitting of an edge into two.
* \param e A handle to one of the existing halfedges.
* \param v A vertex representing the split point.
* \param c1 The x-monotone curve to be associated with the first edge.
* \param c2 The x-monotone curve to be associated with the second edge.
*/
virtual void before_split_edge (Halfedge_handle /* e */,
Vertex_handle /* v */,
const X_monotone_curve_2& /* c1 */,
const X_monotone_curve_2& /* c2 */)
virtual void before_split_edge(Halfedge_handle /* e */,
Vertex_handle /* v */,
const X_monotone_curve_2& /* c1 */,
const X_monotone_curve_2& /* c2 */)
{}
/*!
* Notification after an edge was split.
/*! Notification after an edge was split.
* \param e1 A handle to one of the twin halfedges forming the first edge.
* \param e2 A handle to one of the twin halfedges forming the second edge.
*/
virtual void after_split_edge (Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */)
virtual void after_split_edge(Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */)
{}
/*!
* Notification before the splitting of a fictitious edge into two.
/*! Notification before the splitting of a fictitious edge into two.
* \param e A handle to one of the existing halfedges.
* \param v A vertex representing the unbounded split point.
*/
virtual void before_split_fictitious_edge (Halfedge_handle /* e */,
Vertex_handle /* v */)
virtual void before_split_fictitious_edge(Halfedge_handle /* e */,
Vertex_handle /* v */)
{}
/*!
* Notification after a fictitious edge was split.
/*! Notification after a fictitious edge was split.
* \param e1 A handle to one of the twin halfedges forming the first edge.
* \param e2 A handle to one of the twin halfedges forming the second edge.
*/
virtual void after_split_fictitious_edge (Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */)
virtual void after_split_fictitious_edge(Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */)
{}
/*!
* Notification before the splitting of a face into two.
/*! Notification before the splitting of a face into two.
* \param f A handle to the existing face.
* \param e The new edge whose insertion causes the face to split.
*/
virtual void before_split_face (Face_handle /* f */,
Halfedge_handle /* e */)
virtual void before_split_face(Face_handle /* f */,
Halfedge_handle /* e */)
{}
/*!
* Notification after a face was split.
/*! Notification after a face was split.
* \param f A handle to the face we have just split.
* \param new_f A handle to the new face that has been created.
* \param is_hole Whether the new face forms a hole inside f.
*/
virtual void after_split_face (Face_handle /* f */,
Face_handle /* new_f */,
virtual void after_split_face(Face_handle /* f */,
Face_handle /* new_f */,
bool /* is_hole */)
{}
/*!
* Notification before the splitting of an outer CCB into two.
/*! Notification before the splitting of an outer CCB into two.
* \param f A handle to the face that owns the outer CCB.
* \param h A circulator representing the component boundary.
* \param e The new edge whose removal causes the outer CCB to split.
*/
virtual void before_split_outer_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h */,
Halfedge_handle /* e */)
virtual void before_split_outer_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h */,
Halfedge_handle /* e */)
{}
/*!
* Notification after an outer CCB was split.
/*! Notification after an outer CCB was split.
* \param f A handle to the face that owns the outer CCBs.
* \param h1 A circulator representing the boundary of the first component.
* \param h2 A circulator representing the boundary of the second component.
*/
virtual void after_split_outer_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */)
virtual void after_split_outer_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */)
{}
/*!
* Notification before the splitting of an inner CCB into two.
/*! Notification before the splitting of an inner CCB into two.
* \param f A handle to the face containing the inner CCB.
* \param h A circulator representing the component boundary.
* \param e The new edge whose removal causes the inner CCB to split.
*/
virtual void before_split_inner_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h */,
Halfedge_handle /* e */)
virtual void before_split_inner_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h */,
Halfedge_handle /* e */)
{}
/*!
* Notification after an inner CCB was split.
/*! Notification after an inner CCB was split.
* \param f A handle to the face containing the inner CCBs.
* \param h1 A circulator representing the boundary of the first component.
* \param h2 A circulator representing the boundary of the second component.
*/
virtual void after_split_inner_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */)
virtual void after_split_inner_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */)
{}
/*!
* Notification before the creation of a new outer CCB of a face.
/*! Notification before the creation of a new outer CCB of a face.
* \param f A handle to the face that owns the outer CCB.
* \param e A halfedge along the new outer CCB.
*/
virtual void before_add_outer_ccb (Face_handle /* f */,
Halfedge_handle /* e */)
virtual void before_add_outer_ccb(Face_handle /* f */,
Halfedge_handle /* e */)
{}
/*!
* Notification after an outer CCB was added to a face.
/*! Notification after an outer CCB was added to a face.
* \param h A circulator representing the boundary of the new outer CCB.
*/
virtual void after_add_outer_ccb (Ccb_halfedge_circulator /* h */)
{}
virtual void after_add_outer_ccb(Ccb_halfedge_circulator /* h */) {}
/*!
* Notification before the creation of a new inner CCB inside a face.
/*! Notification before the creation of a new inner CCB inside a face.
* \param f A handle to the face containing the inner CCB.
* \param e The new halfedge that forms the new inner CCB.
*/
virtual void before_add_inner_ccb (Face_handle /* f */,
Halfedge_handle /* e */)
virtual void before_add_inner_ccb(Face_handle /* f */,
Halfedge_handle /* e */)
{}
/*!
* Notification after an inner CCB was created inside a face.
/*! Notification after an inner CCB was created inside a face.
* \param h A circulator representing the boundary of the new inner CCB.
*/
virtual void after_add_inner_ccb (Ccb_halfedge_circulator /* h */)
{}
virtual void after_add_inner_ccb(Ccb_halfedge_circulator /* h */) {}
/*!
* Notification before the creation of a new isolated vertex inside a face.
/*! Notification before the creation of a new isolated vertex inside a face.
* \param f A handle to the face containing the isolated vertex.
* \param v The isolated vertex.
*/
virtual void before_add_isolated_vertex (Face_handle /* f */,
Vertex_handle /* v */)
virtual void before_add_isolated_vertex(Face_handle /* f */,
Vertex_handle /* v */)
{}
/*!
* Notification after an isolated vertex was created inside a face.
/*! Notification after an isolated vertex was created inside a face.
* \param v The isolated vertex.
*/
virtual void after_add_isolated_vertex (Vertex_handle /* v */)
{}
virtual void after_add_isolated_vertex(Vertex_handle /* v */) {}
/*!
* Notification before the merging of two edges.
/*! Notification before the merging of two edges.
* \param e1 A handle to one of the halfedges forming the first edge.
* \param e2 A handle to one of the halfedges forming the second edge.
* \param c The x-monotone curve to be associated with the merged edge.
*/
virtual void before_merge_edge (Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */,
const X_monotone_curve_2& /* c */)
virtual void before_merge_edge(Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */,
const X_monotone_curve_2& /* c */)
{}
/*!
* Notification after an edge was merged.
/*! Notification after an edge was merged.
* \param e A handle to one of the twin halfedges forming the merged edge.
*/
virtual void after_merge_edge (Halfedge_handle /* e */)
{}
virtual void after_merge_edge(Halfedge_handle /* e */) {}
/*!
* Notification before the merging of two fictitious edges.
/*! Notification before the merging of two fictitious edges.
* \param e1 A handle to one of the halfedges forming the first edge.
* \param e2 A handle to one of the halfedges forming the second edge.
*/
virtual void before_merge_fictitious_edge (Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */)
virtual void before_merge_fictitious_edge(Halfedge_handle /* e1 */,
Halfedge_handle /* e2 */)
{}
/*!
* Notification after a fictitious edge was merged.
/*! Notification after a fictitious edge was merged.
* \param e A handle to one of the twin halfedges forming the merged edge.
*/
virtual void after_merge_fictitious_edge (Halfedge_handle /* e */)
{}
virtual void after_merge_fictitious_edge(Halfedge_handle /* e */) {}
/*!
* Notification before the merging of two faces.
/*! Notification before the merging of two faces.
* \param f1 A handle to the first face.
* \param f2 A handle to the second face.
* \param e The edge whose removal causes the faces to merge.
*/
virtual void before_merge_face (Face_handle /* f1 */,
Face_handle /* f2 */,
Halfedge_handle /* e */)
virtual void before_merge_face(Face_handle /* f1 */,
Face_handle /* f2 */,
Halfedge_handle /* e */)
{}
/*!
* Notification after a face was merged.
/*! Notification after a face was merged.
* \param f A handle to the merged face.
*/
virtual void after_merge_face (Face_handle /* f */)
{}
virtual void after_merge_face(Face_handle /* f */) {}
/*!
* Notification before the merging of two outer CCBs.
/*! Notification before the merging of two outer CCBs.
* \param f A handle to the face that owns the outer CCBs.
* \param h1 A circulator representing the boundary of the first component.
* \param h2 A circulator representing the boundary of the second component.
* \param e The edge whose insertion or removal causes the CCBs to merge.
*/
virtual void before_merge_outer_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */,
Halfedge_handle /* e */)
virtual void before_merge_outer_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */,
Halfedge_handle /* e */)
{}
/*!
* Notification after an outer CCB was merged.
/*! Notification after an outer CCB was merged.
* \param f A handle to the face that owns the outer CCBs.
* \param h A circulator representing the boundary of the merged component.
*/
virtual void after_merge_outer_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
virtual void after_merge_outer_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
{}
/*!
* Notification before the merging of two inner CCBs (holes).
/*! Notification before the merging of two inner CCBs (holes).
* \param f A handle to the face that contains the inner CCBs.
* \param h1 A circulator representing the boundary of the first component.
* \param h2 A circulator representing the boundary of the second component.
* \param e The edge whose insertion causes the inner CCBs to merge.
*/
virtual void before_merge_inner_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */,
Halfedge_handle /* e */)
virtual void before_merge_inner_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h1 */,
Ccb_halfedge_circulator /* h2 */,
Halfedge_handle /* e */)
{}
/*!
* Notification after an inner CCB was merged.
/*! Notification after an inner CCB was merged.
* \param f A handle to the face that contains the inner CCBs.
* \param h A circulator representing the boundary of the merged component.
*/
virtual void after_merge_inner_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
virtual void after_merge_inner_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
{}
/*!
* Notification before an outer CCB is moved from one face to another.
/*! Notification before an outer CCB is moved from one face to another.
* \param from_f A handle to the face that currently owns the outer CCB.
* \param to_f A handle to the face that should own the outer CCB.
* \param h A circulator representing the boundary of the component.
*/
virtual void before_move_outer_ccb (Face_handle /* from_f */,
Face_handle /* to_f */,
Ccb_halfedge_circulator /* h */)
virtual void before_move_outer_ccb(Face_handle /* from_f */,
Face_handle /* to_f */,
Ccb_halfedge_circulator /* h */)
{}
/*!
* Notification after an outer CCB is moved from one face to another.
/*! Notification after an outer CCB is moved from one face to another.
* \param h A circulator representing the boundary of the component.
*/
virtual void after_move_outer_ccb (Ccb_halfedge_circulator /* h */)
{}
virtual void after_move_outer_ccb(Ccb_halfedge_circulator /* h */) {}
/*!
* Notification before an inner CCB is moved from one face to another.
/*! Notification before an inner CCB is moved from one face to another.
* \param from_f A handle to the face currently containing the inner CCB.
* \param to_f A handle to the face that should contain the inner CCB.
* \param h A circulator representing the boundary of the component.
*/
virtual void before_move_inner_ccb (Face_handle /* from_f */,
Face_handle /* to_f */,
Ccb_halfedge_circulator /* h */)
virtual void before_move_inner_ccb(Face_handle /* from_f */,
Face_handle /* to_f */,
Ccb_halfedge_circulator /* h */)
{}
/*!
* Notification after an inner CCB is moved from one face to another.
* \param h A circulator representing the boundary of the component.
*/
virtual void after_move_inner_ccb (Ccb_halfedge_circulator /* h */)
{}
virtual void after_move_inner_ccb(Ccb_halfedge_circulator /* h */) {}
/*!
* Notification before an isolated vertex is moved from one face to another.
/*! Notification before an isolated vertex is moved from one face to another.
* \param from_f A handle to the face currently containing the vertex.
* \param to_f A handle to the face that should contain the vertex.
* \param v The isolated vertex.
*/
virtual void before_move_isolated_vertex (Face_handle /* from_f */,
Face_handle /* to_f */,
Vertex_handle /* v */)
virtual void before_move_isolated_vertex(Face_handle /* from_f */,
Face_handle /* to_f */,
Vertex_handle /* v */)
{}
/*!
* Notification after an isolated vertex is moved from one face to another.
/*! Notification after an isolated vertex is moved from one face to another.
* \param v The isolated vertex.
*/
virtual void after_move_isolated_vertex (Vertex_handle /* v */)
{}
virtual void after_move_isolated_vertex(Vertex_handle /* v */) {}
/*!
* Notificaion before the removal of a vertex.
/*! Notificaion before the removal of a vertex.
* \param v A handle to the vertex to be deleted.
*/
virtual void before_remove_vertex (Vertex_handle /* v */)
{}
virtual void before_remove_vertex(Vertex_handle /* v */) {}
/*!
* Notificaion after the removal of a vertex.
*/
virtual void after_remove_vertex ()
{}
/*! Notificaion after the removal of a vertex. */
virtual void after_remove_vertex() {}
/*!
* Notification before the removal of an edge.
/*! Notification before the removal of an edge.
* \param e A handle to one of the twin halfedges to be deleted.
*/
virtual void before_remove_edge (Halfedge_handle /* e */)
{}
virtual void before_remove_edge(Halfedge_handle /* e */) {}
/*!
* Notificaion after the removal of an edge.
*/
virtual void after_remove_edge ()
{}
/*! Notificaion after the removal of an edge. */
virtual void after_remove_edge() {}
/*!
* Notification before the removal of an outer CCB.
/*! Notification before the removal of an outer CCB.
* \param f The face that owns the outer CCB.
* \param h A circulator representing the boundary of the component.
*/
virtual void before_remove_outer_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
virtual void before_remove_outer_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
{}
/*!
* Notificaion after the removal of an outer CCB.
/*! Notificaion after the removal of an outer CCB.
* \param f The face that used to own the outer CCB.
*/
virtual void after_remove_outer_ccb (Face_handle /* f */)
{}
virtual void after_remove_outer_ccb(Face_handle /* f */) {}
/*!
* Notification before the removal of an inner CCB.
/*! Notification before the removal of an inner CCB.
* \param f The face containing the inner CCB.
* \param h A circulator representing the boundary of the component.
*/
virtual void before_remove_inner_ccb (Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
virtual void before_remove_inner_ccb(Face_handle /* f */,
Ccb_halfedge_circulator /* h */)
{}
/*!
* Notificaion after the removal of an inner CCB.
/*! Notificaion after the removal of an inner CCB.
* \param f The face that used to contain the inner CCB.
*/
virtual void after_remove_inner_ccb (Face_handle /* f */)
{}
virtual void after_remove_inner_ccb(Face_handle /* f */) {}
//@}
};
} //namespace CGAL

View File

@ -12,11 +12,9 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Efi Fogel <efif@post.tau.ac.il>
// Eric Berberich <ericb@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H
#define CGAL_ARR_SPHERICAL_TOPOLOGY_TRAITS_2_H
@ -243,13 +241,13 @@ public:
* \param v the vertex.
* \todo why is this needed, and where used?
*/
bool is_valid_vertex (const Vertex* /* v */) const { return true; }
bool is_valid_vertex(const Vertex* /* v */) const { return true; }
/*! Obtain the number of valid vertices. */
Size number_of_valid_vertices() const { return (m_dcel.size_of_vertices()); }
/*! Determine whether the given halfedge is valid. */
bool is_valid_halfedge (const Halfedge* /* he */) const { return true; }
bool is_valid_halfedge(const Halfedge* /* he */) const { return true; }
/*! Obtain the number of valid halfedges. */
Size number_of_valid_halfedges() const
@ -473,7 +471,19 @@ public:
//@{
/*! Receive a notification on the creation of a new boundary vertex that
* corresponds to the given curve end.
* corresponds to a point.
* \param v The new boundary vertex.
* \param p The point.
* \param ps_x The boundary condition of the curve end in x.
* \param ps_y The boundary condition of the curve end in y.
*/
void notify_on_boundary_vertex_creation(Vertex* v,
const Point_2& p,
Arr_parameter_space ps_x,
Arr_parameter_space ps_y);
/*! Receive a notification on the creation of a new boundary vertex that
* corresponds to a given curve end.
* \param v The new boundary vertex.
* \param xc The x-monotone curve.
* \param ind The curve end.
@ -496,13 +506,12 @@ public:
* \param swap_predecessors Output swap predeccesors or not;
* set correctly only if true is returned
*/
bool let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1,
std::pair< CGAL::Sign, CGAL::Sign> signs2,
bool let_me_decide_the_outer_ccb(std::pair<CGAL::Sign, CGAL::Sign> signs1,
std::pair<CGAL::Sign, CGAL::Sign> signs2,
bool& swap_predecessors) const;
/*!
* Given signs of two ccbs that show up when splitting upon insertion of
/*! Given signs of two ccbs that show up when splitting upon insertion of
* curve into two, determine what happens to the face(s).
* \param signs1 signs in x and y of the first implied ccb
* \param signs2 signs in x and y of the secondd implied ccb
@ -511,10 +520,10 @@ public:
* will form a hole in the original face.
*/
std::pair<bool, bool>
face_split_after_edge_insertion(std::pair< CGAL::Sign,
CGAL::Sign > /* signs1 */,
std::pair< CGAL::Sign,
CGAL::Sign > /* signs2 */) const
face_split_after_edge_insertion(std::pair<CGAL::Sign,
CGAL::Sign> /* signs1 */,
std::pair<CGAL::Sign,
CGAL::Sign> /* signs2 */) const
{
// In case of a spherical topology, connecting two vertices on the same
// inner CCB closes a new face that becomes a hole in the original face:
@ -569,8 +578,7 @@ public:
Arr_parameter_space ps_x,
Arr_parameter_space ps_y);
/*!
* Locate the predecessor halfedge for the given curve around a given
/*! Locate the predecessor halfedge for the given curve around a given
* vertex with boundary conditions.
* \param v The vertex.
* \param cv The x-monotone curve.
@ -644,10 +652,9 @@ public:
//! reference_face (non-const version).
/*! The function returns a reference face of the arrangement.
All reference faces of arrangements of the same type have a common
point.
\return A pointer to the reference face.
*/
* All reference faces of arrangements of the same type have a common point.
* \return A pointer to the reference face.
*/
Face* reference_face() { return spherical_face(); }
//@}
@ -684,7 +691,6 @@ protected:
* on the line of discontinuity.
*/
Face* _face_below_vertex_on_discontinuity(Vertex* v) const;
//@}
};

View File

@ -28,7 +28,7 @@
namespace CGAL {
/*! \brief constructs default */
//! \brief constructs default.
template <typename GeomTraits, typename Dcel>
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
Arr_spherical_topology_traits_2() :
@ -41,7 +41,7 @@ Arr_spherical_topology_traits_2() :
m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits));
}
/*! \brief constructs from a geometry-traits object. */
//! \brief constructs from a geometry-traits object.
template <typename GeomTraits, typename Dcel>
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) :
@ -54,7 +54,7 @@ Arr_spherical_topology_traits_2(const Geometry_traits_2* traits) :
m_boundary_vertices = Vertex_map(Vertex_key_comparer(m_geom_traits));
}
/*! \brief destructs */
//! \brief destructs.
template <typename GeomTraits, typename Dcel>
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
~Arr_spherical_topology_traits_2()
@ -68,10 +68,9 @@ Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
}
}
/*! \brief assigns the contents of another topology-traits class */
//! \brief assigns the contents of another topology-traits class.
template <typename GeomTraits, typename Dcel>
void Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
assign(const Self& other)
void Arr_spherical_topology_traits_2<GeomTraits, Dcel>::assign(const Self& other)
{
// Clear the current DCEL and duplicate the other DCEL.
m_dcel.delete_all();
@ -96,7 +95,7 @@ assign(const Self& other)
dcel_updated();
}
/*! \brief initializes an empty DCEL structure. */
//! \brief initializes an empty DCEL structure.
template <typename GeomTraits_, typename Dcel_>
void Arr_spherical_topology_traits_2<GeomTraits_, Dcel_>::dcel_updated()
{
@ -138,7 +137,7 @@ void Arr_spherical_topology_traits_2<GeomTraits_, Dcel_>::dcel_updated()
CGAL_assertion(m_spherical_face != NULL);
}
/*! \brief initializes an empty DCEL structure. */
//! \brief initializes an empty DCEL structure.
template <typename GeomTraits, typename Dcel>
void Arr_spherical_topology_traits_2<GeomTraits, Dcel>::init_dcel()
{
@ -156,7 +155,7 @@ void Arr_spherical_topology_traits_2<GeomTraits, Dcel>::init_dcel()
m_south_pole = NULL;
}
/*! \brief determines whether a point lies in the interior of a given face. */
//! \brief determines whether a point lies in the interior of a given face.
template <typename GeomTraits, typename Dcel>
bool Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
is_in_face(const Face* f, const Point_2& p, const Vertex* v) const
@ -418,7 +417,7 @@ is_in_face(const Face* f, const Point_2& p, const Vertex* v) const
return (num_intersections& 0x1);
}
/*! \brief compares the relative y-position of a point and a halfedge */
//! \brief compares the relative y-position of a point and a halfedge.
template <typename GeomTraits, typename Dcel>
Comparison_result
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
@ -428,7 +427,7 @@ compare_y_at_x(const Point_2& p, const Halfedge* he) const
return m_geom_traits->compare_y_at_x_2_object()(p, he->curve());
}
/*! \brief determine whether a vertex is associated with a curve end */
//! \brief determine whether a vertex is associated with a curve end.
template <typename GeomTraits, typename Dcel>
bool Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
are_equal(const Vertex* v,
@ -465,7 +464,30 @@ are_equal(const Vertex* v,
return (m_geom_traits->compare_y_on_boundary_2_object()(p1, p2) == EQUAL);
}
/*! \brief receives a notification on the creation of a new boundary vertex */
//! \brief receives a notification on the creation of a new boundary vertex.
template <typename GeomTraits, typename Dcel>
void
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
notify_on_boundary_vertex_creation(Vertex* v,
const Point_2& p,
Arr_parameter_space
CGAL_assertion_code(ps_x),
Arr_parameter_space ps_y)
{
// std::cout << "notify_on_boundary_vertex_creation()" << std::endl;
if (ps_y == ARR_BOTTOM_BOUNDARY) {
m_south_pole = v;
return;
}
if (ps_y == ARR_TOP_BOUNDARY) {
m_north_pole = v;
return;
}
CGAL_assertion(ps_x != ARR_INTERIOR);
m_boundary_vertices.insert(Vertex_value(p, v));
}
//! \brief receives a notification on the creation of a new boundary vertex.
template <typename GeomTraits, typename Dcel>
void
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
@ -517,7 +539,8 @@ let_me_decide_the_outer_ccb(std::pair< CGAL::Sign, CGAL::Sign> signs1,
/*! \brief given a curve end with boundary conditions and a face that contains
* the interior of the curve, find a place for a boundary vertex that will
* represent the curve end along the face boundary */
* represent the curve end along the face boundary.
*/
template <typename GeomTraits, typename Dcel>
CGAL::Object
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
@ -553,7 +576,8 @@ place_boundary_vertex(Face* /* f */,
}
/*! \brief locate the predecessor halfedge for the given curve around a given
* vertex with boundary conditions. */
* vertex with boundary conditions.
*/
template <typename GeomTraits, typename Dcel>
typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Halfedge*
Arr_spherical_topology_traits_2<GeomTraits,Dcel>::
@ -633,13 +657,13 @@ locate_curve_end(const X_monotone_curve_2& xc, Arr_curve_end ind,
return CGAL::make_object(_face_below_vertex_on_discontinuity(v));
}
/*! \brief determines whether a given boundary vertex is redundant */
//! \brief determines whether a given boundary vertex is redundant.
template <typename GeomTraits, typename Dcel>
bool Arr_spherical_topology_traits_2<GeomTraits, Dcel>::
is_redundant(const Vertex* v) const
{ return (v->halfedge() == NULL); }
/* \brief erases a given redundant vertex */
//! \brief erases a given redundant vertex.
template <typename GeomTraits, typename Dcel>
typename Arr_spherical_topology_traits_2<GeomTraits, Dcel>::Halfedge*
Arr_spherical_topology_traits_2<GeomTraits, Dcel>::

View File

@ -12,10 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
// Eric Berberich <eric.berberich@cgal.org>
@ -173,16 +169,13 @@ void Arrangement_on_surface_2<GeomTraits, TopTraits>::assign(const Self& arr)
m_topol_traits.assign(arr.m_topol_traits);
// Go over the vertices and create duplicates of the stored points.
Point_2* dup_p;
DVertex* p_v;
typename Dcel::Vertex_iterator vit;
for (vit = _dcel().vertices_begin(); vit != _dcel().vertices_end(); ++vit) {
p_v = &(*vit);
DVertex* p_v = &(*vit);
if (! p_v->has_null_point()) {
// Create the duplicate point and store it in the points container.
dup_p = _new_point(p_v->point());
Point_2* dup_p = _new_point(p_v->point());
// Associate the vertex with the duplicated point.
p_v->set_point(dup_p);
@ -296,15 +289,29 @@ insert_in_face_interior(const Point_2& p, Face_handle f)
std::cout << "face : " << &(*f) << std::endl;
#endif
// Obtain the boundary conditions:
const Arr_parameter_space ps_x =
m_geom_traits->parameter_space_in_x_2_object()(p);
const Arr_parameter_space ps_y =
m_geom_traits->parameter_space_in_y_2_object()(p);
// Create a new vertex associated with the given point.
// We assume the point has no boundary conditions.
DVertex* v = _create_vertex(p);
Vertex_handle vh(v);
// The point is either the interior of the parameter space or on the boundary.
DVertex* v(NULL);
if ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR))
v = _create_vertex(p);
else {
v = _create_boundary_vertex(p, ps_x, ps_y);
// Notify the topology traits on the creation of the boundary vertex.
m_topol_traits.notify_on_boundary_vertex_creation(v, p, ps_x, ps_y);
}
// Insert v as an isolated vertex inside the given face.
_insert_isolated_vertex(p_f, v);
// Return a handle to the new isolated vertex.
Vertex_handle vh(v);
return vh;
}
@ -2095,6 +2102,30 @@ _create_vertex(const Point_2& p)
return v;
}
// Create a new vertex on boundary
//
template <typename GeomTraits, typename TopTraits>
typename Arrangement_on_surface_2<GeomTraits, TopTraits>::DVertex*
Arrangement_on_surface_2<GeomTraits, TopTraits>::
_create_boundary_vertex(const Point_2& p,
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
{
CGAL_precondition((ps_x != ARR_INTERIOR) || (ps_y != ARR_INTERIOR));
// Notify the observers that we are about to create a new boundary vertex.
_notify_before_create_boundary_vertex(p, ps_x, ps_y);
// Create a new vertex and set its boundary conditions.
DVertex* v = _dcel().new_vertex();
v->set_boundary(ps_x, ps_y);
v->set_point(_new_point(p));
// Notify the observers that we have just created a new boundary vertex.
_notify_after_create_boundary_vertex(Vertex_handle(v));
return v;
}
//-----------------------------------------------------------------------------
// Create a new vertex on boundary
//
@ -2129,12 +2160,58 @@ _create_boundary_vertex(const X_monotone_curve_2& cv, Arr_curve_end ind,
}
// Notify the observers that we have just created a new boundary vertex.
Vertex_handle vh(v);
_notify_after_create_boundary_vertex(vh);
_notify_after_create_boundary_vertex(Vertex_handle(v));
return v;
}
//-----------------------------------------------------------------------------
// Locate the DCEL features that will be used for inserting the given point,
// which has a boundary condition, and set a proper vertex there.
//
template <typename GeomTraits, typename TopTraits>
typename Arrangement_on_surface_2<GeomTraits, TopTraits>::DVertex*
Arrangement_on_surface_2<GeomTraits, TopTraits>::
_place_and_set_point(DFace* f, const Point_2& p,
Arr_parameter_space ps_x, Arr_parameter_space ps_y)
{
// Use the topology traits to locate the DCEL feature that contains the
// given point.
CGAL::Object obj = m_topol_traits.place_boundary_vertex(f, p, ps_x, ps_y);
DVertex* v;
// Act according to the result type.
DHalfedge* fict_he;
if (CGAL::assign(fict_he, obj)) {
// The point is located on a fictitious edge.
// Create a new vertex that corresponds to the point.
v = _create_boundary_vertex(p, ps_x, ps_y);
// Split the fictitious halfedge at the newly created vertex.
// The returned halfedge is the predecessor for the insertion of the curve
// end around v.
_notify_before_split_fictitious_edge(Halfedge_handle(fict_he),
Vertex_handle(v));
DHalfedge* p_pred = m_topol_traits.split_fictitious_edge(fict_he, v);
_notify_after_split_fictitious_edge(Halfedge_handle(p_pred),
Halfedge_handle((*p_pred)->next()));
}
else if (obj.is_empty()) {
// Create a new vertex that reprsents the given point.
v = _create_boundary_vertex(p, ps_x, ps_y);
// Notify the topology traits on the creation of the boundary vertex.
m_topol_traits.notify_on_boundary_vertex_creation(v, p, ps_x, ps_y);
}
else {
CGAL_assertion(CGAL::assign(v, obj));
// The vertex cpoincides with an existing vertex that represents the point.
// Do nothing.
}
return v; // return the vertex that represents the point.
}
//-----------------------------------------------------------------------------
// Locate the DCEL features that will be used for inserting the given curve
// end, which has a boundary condition, and set the proper vertex there.

View File

@ -1907,6 +1907,18 @@ protected:
*/
DVertex* _create_vertex(const Point_2& p);
/*!
* Create a new boundary vertex.
* \param p The point on the boundary.
* \param bx The boundary condition in x.
* \param by The boundary condition in y.
* \pre Either bx or by does not equal ARR_INTERIOR.
* \return A pointer to the newly created vertex.
*/
DVertex* _create_boundary_vertex(const Point_2& p,
Arr_parameter_space bx,
Arr_parameter_space by);
/*!
* Create a new boundary vertex.
* \param cv The curve incident to the boundary.
@ -1921,6 +1933,20 @@ protected:
Arr_parameter_space bx,
Arr_parameter_space by);
/*!
* Locate the DCEL features that will be used for inserting the given point,
* which has a boundary condition, and set a proper vertex there.
* \param f The face that contains the point.
* \param p The point.
* \param bx The boundary condition at the point x-coordinate.
* \param by The boundary condition at the point y-coordinate.
* \return The vertex that corresponds to the point.
*/
DVertex* _place_and_set_point(DFace* f,
const Point_2& p,
Arr_parameter_space bx,
Arr_parameter_space by);
/*!
* Locate the DCEL features that will be used for inserting the given curve
* end, which has a boundary condition, and set a proper vertex there.
@ -2259,6 +2285,17 @@ protected:
(*iter)->after_create_vertex(v);
}
void _notify_before_create_boundary_vertex(const Point_2& p,
Arr_parameter_space bx,
Arr_parameter_space by)
{
Observers_iterator iter;
Observers_iterator end = m_observers.end();
for (iter = m_observers.begin(); iter != end; ++iter)
(*iter)->before_create_boundary_vertex(p, bx, by);
}
void _notify_before_create_boundary_vertex(const X_monotone_curve_2& cv,
Arr_curve_end ind,
Arr_parameter_space bx,