diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp
index b95c393bcdf..cb935ab0e26 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp
@@ -76,7 +76,7 @@ QColor ArrangementDemoGraphicsView::getBackgroundColor( ) const
}
void ArrangementDemoGraphicsView::drawForeground( QPainter* painter,
- const QRectF& rect )
+ const QRectF& /* rect */)
{
QRectF viewportRect = this->getViewportRect( );
if ( this->showGrid )
diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp
index 26a8fc853e6..79ab960ca78 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ColorItemEditor.cpp
@@ -45,7 +45,7 @@
#include "ColorItemEditor.h"
ColorItemEditor::ColorItemEditor( QWidget* widget ) : QPushButton( widget )
-{
+{
this->setText( tr("Select a color") );
}
@@ -59,14 +59,13 @@ void ColorItemEditor::setColor( QColor color )
this->m_color = color;
}
-void ColorItemEditor::mousePressEvent( QMouseEvent* e )
+void ColorItemEditor::mousePressEvent(QMouseEvent* /* e */)
{
- QColor selectedColor = QColorDialog::getColor( this->m_color );
- if ( selectedColor.isValid( ) )
- {
- // std::cout << selectedColor.name( ).toStdString( ) << std::endl;
+ QColor selectedColor = QColorDialog::getColor(this->m_color);
+ if (selectedColor.isValid()) {
+ // std::cout << selectedColor.name().toStdString() << std::endl;
this->setColor( selectedColor );
}
- emit confirmed( );
+ emit confirmed();
}
diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp
index df35391b3d1..b5ba7c2fe3d 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/GraphicsViewSegmentInput.cpp
@@ -43,13 +43,13 @@ QGraphicsScene* GraphicsViewSegmentInputBase::getScene( ) const
return this->scene;
}
-void
-GraphicsViewSegmentInputBase::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
+void GraphicsViewSegmentInputBase::
+mouseMoveEvent(QGraphicsSceneMouseEvent* /* event */)
{ }
-void
-GraphicsViewSegmentInputBase::mousePressEvent(QGraphicsSceneMouseEvent* event)
-{
+void GraphicsViewSegmentInputBase::
+mousePressEvent(QGraphicsSceneMouseEvent* /* event */)
+{
// std::cout << "GraphicsViewSegmentInputBase::mousePressEvent" << std::endl;
}
@@ -67,7 +67,7 @@ bool GraphicsViewSegmentInputBase::eventFilter( QObject* obj, QEvent* event )
static_cast< QGraphicsSceneMouseEvent* >( event );
this->mousePressEvent( mouseEvent );
}
-
+
return QObject::eventFilter( obj, event );
}
diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp
index 9cac0942dcc..86eadd35361 100644
--- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp
+++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/PointsGraphicsItem.cpp
@@ -28,9 +28,9 @@ PointsGraphicsItem::PointsGraphicsItem( ) :
color( ::Qt::blue )
{ }
-void PointsGraphicsItem::paint( QPainter* painter,
- const QStyleOptionGraphicsItem* option,
- QWidget* widget )
+void PointsGraphicsItem::paint(QPainter* painter,
+ const QStyleOptionGraphicsItem* /* option */,
+ QWidget* /* widget */)
{
double scale = painter->worldTransform( ).m11( );
double radius = this->pointRadius;
@@ -53,19 +53,19 @@ QRectF PointsGraphicsItem::boundingRect( ) const
{
return QRectF( );
}
- double xmin = std::numeric_limits< double >::max( );
- double xmax = -std::numeric_limits< double >::max( );
- double ymin = std::numeric_limits< double >::max( );
- double ymax = -std::numeric_limits< double >::max( );
- for ( unsigned int i = 0; i < this->points.size( ); ++i )
+ double xmin = (std::numeric_limits< double >::max)( );
+ double xmax = -(std::numeric_limits< double >::max)( );
+ double ymin = (std::numeric_limits< double >::max)( );
+ double ymax = -(std::numeric_limits< double >::max)( );
+ for ( unsigned int i = 0; i < this->points.size(); ++i )
{
QPointF pt = this->points[ i ];
double x = pt.x( );
double y = pt.y( );
- xmin = std::min( xmin, x );
- xmax = std::max( xmax, x );
- ymin = std::min( ymin, y );
- ymax = std::max( ymax, y );
+ xmin = (std::min)( xmin, x );
+ xmax = (std::max)( xmax, x );
+ ymin = (std::min)( ymin, y );
+ ymax = (std::max)( ymax, y );
}
QRectF res( QPointF( xmin, ymin ), QPointF( xmax, ymax ) );
res.adjust( -5, -5, 5, 5 ); // pad the borders a bit
diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt
index fcd0738b429..624d8e3df0b 100644
--- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt
+++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/Arrangement_on_surface_2.txt
@@ -870,9 +870,12 @@ print_point_location
\subsection arr_sssecpl_strat Choosing a Point-Location Strategy
Each of the various point-location class templates employs a different
-algorithm or strategy\cgalFootnote{We use the term strategy
-is borrowed from the design-pattern taxonomy \cgalCite{cgal:ghjv-dpero-95}, Chapter 5.}
-for answering queries:
+algorithm or strategy\cgalFootnote{The term strategy
+is borrowed from the design-pattern taxonomy \cgalCite{cgal:ghjv-dpero-95},
+Chapter 5. A strategy provides the means to define a family of
+algorithms, each implemented by a separate class. All classes that implement
+the various algorithms are made interchangeable, letting the algorithm in use
+vary according to the user choice.} for answering queries:
- `Arr_naive_point_location` employes the
naive strategy. It locates the query point naively,
@@ -883,14 +886,15 @@ for answering queries:
It simulates a traversal, in reverse order, along an imaginary
vertical ray emanating from the query point. It starts from the
unbounded face of the arrangement and moves downward toward the
- query point until locating the arrangement cell containing it.
+ query point until it locates the arrangement cell containing it.
+ %
- `Arr_landmarks_point_location`
- uses a set of landmark points the location of which in the
- arrangement is known. It employs the
- landmark strategy. Given a query point, it uses a
- nearest-neighbor search-structure (a Kd-tree is used by default)
- to find the nearest landmark and then traverses the straight-line
- segment connecting this landmark to the query point.
+ uses a set of landmark points, the location of which in the
+ arrangement is known. It employs the landmark strategy. Given a
+ query point, it uses a nearest-neighbor search-structure (a
+ Kd-tree is used by default) to find the
+ nearest landmark, and then traverses the straight-line segment
+ connecting this landmark to the query point.
There are various ways to select the landmark set in the
arrangement. The selection is governed by the `Generator`
@@ -910,15 +914,20 @@ for answering queries:
Section \ref arr_sssectr_lanmarks_concept for details. Most traits
classes included in the 2D Arrangement package are models of
this refined concept.
-
- `Arr_trapezoid_ric_point_location` implements
- Mulmuley's point-location algorithm \cgalCite{m-fppa-90}; see
- also \cgalCite{bkos-cgaa-00}, Chapter 6. The arrangement faces are
- decomposed into simpler cells each of constant complexity, known as
- pseudo-trapezoids, and a search structure (a directed acyclic
+ %
+
- `Arr_trapezoid_ric_point_location` implements an
+ improved variant of Mulmuley's point-location algorithm
+ \cgalCite{m-fppa-90}; see also \cgalCite{bkos-cgaa-00}, Chapter 6.
+ The (expected) query-time is logarithmic. The arrangement faces
+ are decomposed into simpler cells each of constant complexity, known
+ as pseudo-trapezoids, and a search structure (a directed acyclic
graph) is constructed on top of these cells, facilitating the search
of the pseudo trapezoid (hence the arrangement cell) containing a
query point in expected logarithmic time. The trapezoidal map and
- the search structure are built by a algorithm (RIC).
+ the search structure are built by a randomized incremental construction
+ algorithm (RIC).
+ %
+
The first two strategies do not require any extra data. The class
diff --git a/Arrangement_on_surface_2/dont_submit b/Arrangement_on_surface_2/dont_submit
index fe3f975ccd9..21f3d862591 100644
--- a/Arrangement_on_surface_2/dont_submit
+++ b/Arrangement_on_surface_2/dont_submit
@@ -10,4 +10,3 @@ include/CGAL/Arr_extended_rational_arc_traits_d_1.h
include/CGAL/Arr_hyperbolic_arc_traits_2.h
include/CGAL/Arr_polycurve_traits_2.h
include/CGAL/Arr_rational_arc_traits_2.h
-include/CGAL/Arr_triangulation_point_location.h
\ No newline at end of file
diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
index 6619a78bfc5..745291d9177 100644
--- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
+++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp
@@ -15,7 +15,7 @@
#include "arr_print.h"
-// A property map that reads/writes the information to/from the extended
+// A property map that reads/writes the information to/from the extended
// face.
template class Extended_face_property_map {
public:
@@ -28,11 +28,12 @@ public:
typedef Face_handle key_type;
// The get function is required by the property map concept.
- friend reference get(const Extended_face_property_map& map, key_type key)
+ friend reference get(const Extended_face_property_map& /* map */,
+ key_type key)
{ return key->data(); }
// The put function is required by the property map concept.
- friend void put(Extended_face_property_map,
+ friend void put(Extended_face_property_map /* map */,
key_type key, value_type val)
{ key->set_data(val); }
};
diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
index 569e805a910..e3f8cf06d05 100644
--- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
+++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp
@@ -17,12 +17,11 @@ typedef CGAL::Arrangement_2 Arrangement_2;
typedef Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef Arrangement_2::Face_const_handle Face_const_handle;
-
-typedef std::pair >
- Vert_decomp_entry;
+typedef std::pair Object_pair;
+typedef std::pair Vert_decomp_entry;
typedef std::list Vert_decomp_list;
-int main ()
+int main()
{
// Construct the arrangement.
Arrangement_2 arr;
@@ -38,37 +37,35 @@ int main ()
// Perform vertical ray-shooting from every vertex and locate the feature
// that lie below it and the feature that lies above it.
- Vert_decomp_list vd_list;
-
- CGAL::decompose (arr, std::back_inserter(vd_list));
+ Vert_decomp_list vd_list;
+ CGAL::decompose(arr, std::back_inserter(vd_list));
// Print the results.
- Vert_decomp_list::const_iterator vd_iter;
- std::pair curr;
- Vertex_const_handle vh;
- Halfedge_const_handle hh;
- Face_const_handle fh;
-
+ Vert_decomp_list::const_iterator vd_iter;
for (vd_iter = vd_list.begin(); vd_iter != vd_list.end(); ++vd_iter) {
- curr = vd_iter->second;
+ const Object_pair& curr = vd_iter->second;
std::cout << "Vertex (" << vd_iter->first->point() << ") : ";
+ Vertex_const_handle vh;
+ Halfedge_const_handle hh;
+ Face_const_handle fh;
+
std::cout << " feature below: ";
- if (CGAL::assign (hh, curr.first))
+ if (CGAL::assign(hh, curr.first))
std::cout << '[' << hh->curve() << ']';
- else if (CGAL::assign (vh, curr.first))
+ else if (CGAL::assign(vh, curr.first))
std::cout << '(' << vh->point() << ')';
- else if (CGAL::assign (fh, curr.first))
+ else if (CGAL::assign(fh, curr.first))
std::cout << "NONE";
else
std::cout << "EMPTY";
std::cout << " feature above: ";
- if (CGAL::assign (hh, curr.second))
+ if (CGAL::assign(hh, curr.second))
std::cout << '[' << hh->curve() << ']' << std::endl;
- else if (CGAL::assign (vh, curr.second))
+ else if (CGAL::assign(vh, curr.second))
std::cout << '(' << vh->point() << ')' << std::endl;
- else if (CGAL::assign (fh, curr.second))
+ else if (CGAL::assign(fh, curr.second))
std::cout << "NONE" << std::endl;
else
std::cout << "EMPTY" << std::endl;
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h
index 2890df62f0b..77fc366bc1b 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
-//
+//
//
// Author(s) : Ron Wein
// Efi Fogel
@@ -39,24 +39,22 @@
namespace CGAL {
// Forward declaration:
-template
+template
class Arrangement_on_surface_2;
/*! \class Arr_bounded_planar_topology_traits_2
* A topology-traits class that encapsulates the embedding of 2D arrangements
* of bounded curves on the plane.
*/
-template >
+template >
class Arr_bounded_planar_topology_traits_2 :
public Arr_planar_topology_traits_base_2
{
private:
-
typedef Arr_planar_topology_traits_base_2 Base;
public:
-
///! \name The geometry-traits types.
//@{
typedef GeomTraits_ Geometry_traits_2;
@@ -81,14 +79,14 @@ public:
typedef Arr_bounded_planar_topology_traits_2 Self;
typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2;
//!@}
-
+
///! \name The side tags
//@{
typedef typename Traits_adaptor_2::Left_side_category Left_side_category;
typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category;
typedef typename Traits_adaptor_2::Top_side_category Top_side_category;
typedef typename Traits_adaptor_2::Right_side_category Right_side_category;
-
+
BOOST_MPL_ASSERT
((boost::is_same< Left_side_category, Arr_oblivious_side_tag >));
BOOST_MPL_ASSERT
@@ -100,50 +98,47 @@ public:
//@}
/*! \struct
- * An auxiliary structure for rebinding the topology traits with a new
+ * An auxiliary structure for rebinding the topology traits with a new
* geometry-traits class and a new DCEL class.
*/
template
- struct rebind
- {
- typedef Arr_bounded_planar_topology_traits_2 other;
+ struct rebind {
+ typedef Arr_bounded_planar_topology_traits_2 other;
};
protected:
-
// Data members:
- Face *unb_face; // The unbounded face.
+ Face* unb_face; // The unbounded face.
// Copy constructor and assignment operator - not supported.
- Arr_bounded_planar_topology_traits_2 (const Self& );
- Self& operator= (const Self& );
+ Arr_bounded_planar_topology_traits_2(const Self&);
+ Self& operator=(const Self&);
public:
-
///! \name Construction methods.
//@{
/*! Default constructor. */
- Arr_bounded_planar_topology_traits_2 () :
+ Arr_bounded_planar_topology_traits_2() :
Base(),
- unb_face (NULL)
+ unb_face(NULL)
{}
- /*! Constructor with a geometry-traits class. */
- Arr_bounded_planar_topology_traits_2 (const Geometry_traits_2 *tr) :
- Base (tr),
- unb_face (NULL)
+ /*! Constructor from a geometry-traits object. */
+ Arr_bounded_planar_topology_traits_2(const Geometry_traits_2* traits) :
+ Base(traits),
+ unb_face(NULL)
{}
/*! Assign the contents of another topology-traits class. */
- void assign (const Self& other);
+ void assign(const Self& other);
//@}
///! \name Accessing the DCEL and constructing iterators.
//@{
/*! Determine whether the DCEL reprsenets an empty structure. */
- bool is_empty_dcel () const
+ bool is_empty_dcel() const
{
// An empty bounded arrangement has no edges or vertices.
return (this->m_dcel.size_of_vertices() == 0 &&
@@ -151,52 +146,40 @@ public:
}
/*! Check if the given vertex is concrete (associated with a point). */
- inline bool is_concrete_vertex (const Vertex *) const
- {
- return (true);
- }
+ inline bool is_concrete_vertex(const Vertex*) const { return true; }
/*! Get the number of concrete vertices. */
- Size number_of_concrete_vertices () const
+ Size number_of_concrete_vertices() const
{
// All vertices are concrete.
return (this->m_dcel.size_of_vertices());
}
/*! Check if the given vertex is valid (not a fictitious one). */
- inline bool is_valid_vertex (const Vertex *) const
- {
- return (true);
- }
+ inline bool is_valid_vertex(const Vertex*) const { return true; }
/*! Get the number of valid vertices. */
- Size number_of_valid_vertices () const
+ Size number_of_valid_vertices() const
{
// All vertices are valid.
return (this->m_dcel.size_of_vertices());
}
/*! Check if the given halfedge is valid (not a fictitious one). */
- inline bool is_valid_halfedge (const Halfedge *) const
- {
- return (true);
- }
+ inline bool is_valid_halfedge(const Halfedge*) const { return true; }
/*! Get the number of valid halfedges. */
- Size number_of_valid_halfedges () const
+ Size number_of_valid_halfedges() const
{
// All halfedges are valid.
return (this->m_dcel.size_of_halfedges());
}
/*! Check if the given face is valid (not a fictitious one). */
- inline bool is_valid_face (const Face *) const
- {
- return (true);
- }
+ inline bool is_valid_face (const Face*) const { return true; }
/*! Get the number of valid faces. */
- Size number_of_valid_faces () const
+ Size number_of_valid_faces() const
{
// All faces are valid.
return (this->m_dcel.size_of_faces());
@@ -207,13 +190,12 @@ private:
/// \name Auxiliary type definitions.
//@{
- typedef Arrangement_on_surface_2 Arr;
+ typedef Arrangement_on_surface_2 Arr;
// Type definition for the constuction sweep-line visitor.
- typedef Arr_construction_subcurve CSubcurve;
- typedef Arr_construction_event CEvent;
+ typedef Arr_construction_subcurve CSubcurve;
+ typedef Arr_construction_event
+ CEvent;
typedef Arr_bounded_planar_construction_helper BInsTraits;
- typedef Arr_construction_subcurve BISubcurve;
- typedef Arr_construction_event BIEvent;
- typedef Arr_bounded_planar_insertion_helper BISubcurve;
+ typedef Arr_construction_event
+ BIEvent;
+ typedef Arr_bounded_planar_insertion_helper BIHelper;
// Type definition for the insertion sweep-line visitor.
typedef Arr_insertion_traits_2 InsTraits;
- typedef Arr_construction_subcurve ISubcurve;
- typedef Arr_construction_event IEvent;
- typedef Arr_bounded_planar_insertion_helper ISubcurve;
+ typedef Arr_construction_event
+ IEvent;
+ typedef Arr_bounded_planar_insertion_helper IHelper;
// Type definition for the batched point-location sweep-line visitor.
@@ -273,9 +249,8 @@ private:
typedef typename Base::Subcurve Subcurve;
typedef typename Base::Construction_helper Construction_helper;
- _Overlay_helper (const ArrangementA_ *arrA,
- const ArrangementB_ *arrB) :
- Base (arrA, arrB)
+ _Overlay_helper(const ArrangementA_* arr_a, const ArrangementB_* arr_b) :
+ Base(arr_a, arr_b)
{}
};
//@}
@@ -293,7 +268,7 @@ public:
typedef Sweep_line_construction_visitor
Sweep_line_non_intersecting_construction_visitor;
-
+
typedef Arr_basic_insertion_sl_visitor
Sweep_line_non_intersecting_insertion_visitor;
@@ -308,9 +283,9 @@ public:
typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve;
- Sweep_line_batched_point_location_visitor (const Arr *arr,
+ Sweep_line_batched_point_location_visitor(const Arr* arr,
Output_iterator& oi) :
- Base (arr, oi)
+ Base(arr, oi)
{}
};
@@ -325,9 +300,9 @@ public:
typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve;
- Sweep_line_vertical_decomposition_visitor (const Arr *arr,
- Output_iterator *oi) :
- Base (arr, oi)
+ Sweep_line_vertical_decomposition_visitor(const Arr* arr,
+ Output_iterator* oi) :
+ Base(arr, oi)
{}
};
@@ -338,7 +313,7 @@ public:
Arr_overlay_traits_2< Arr_traits_basic_adaptor_2,
ArrangementA_,
ArrangementB_>,
- ArrangementA_,
+ ArrangementA_,
ArrangementB_>,
OverlayTraits_>
{
@@ -347,7 +322,7 @@ public:
typedef Arr Arrangement_result_2;
typedef OverlayTraits_ Overlay_traits;
- typedef Arr_overlay_traits_2<
+ typedef Arr_overlay_traits_2<
Arr_traits_basic_adaptor_2,
ArrangementA_2,
ArrangementB_2> Geom_ovl_traits_2;
@@ -362,20 +337,22 @@ public:
typedef typename Base::Event Event;
typedef typename Base::Subcurve Subcurve;
- Sweep_line_overlay_visitor (const ArrangementA_2 *arrA,
- const ArrangementB_2 *arrB,
- Arrangement_result_2 *arr_res,
- Overlay_traits *overlay_tr) :
+ Sweep_line_overlay_visitor (const ArrangementA_2* arrA,
+ const ArrangementB_2* arrB,
+ Arrangement_result_2* arr_res,
+ Overlay_traits* overlay_tr) :
Base (arrA, arrB, arr_res, overlay_tr)
{}
};
typedef Arr_inc_insertion_zone_visitor
- Zone_insertion_visitor;
+ Zone_insertion_visitor;
typedef Arr_walk_along_line_point_location
- Default_point_location_strategy;
+ Default_point_location_strategy;
+ typedef Arr_walk_along_line_point_location
+ Default_vertical_ray_shooting_strategy;
//@}
///! \name Topology-traits methods.
@@ -384,12 +361,12 @@ public:
/*!
* Initialize an empty DCEL structure.
*/
- void init_dcel ();
+ void init_dcel();
/*!
* Make the necessary updates after the DCEL structure have been updated.
*/
- void dcel_updated ();
+ void dcel_updated();
/*!
* Check if the given vertex is associated with the given curve end.
@@ -401,24 +378,22 @@ public:
* \pre The curve has a boundary condition in either x or y.
* \return Whether v represents the given curve end.
*/
- bool are_equal (const Vertex *v,
- const X_monotone_curve_2& cv, Arr_curve_end ind,
- Arr_parameter_space ps_x, Arr_parameter_space ps_y) const
+ bool are_equal(const Vertex* v,
+ const X_monotone_curve_2& cv, Arr_curve_end ind,
+ Arr_parameter_space ps_x, Arr_parameter_space ps_y) const
{
- CGAL_assertion ((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR));
+ CGAL_assertion((ps_x == ARR_INTERIOR) && (ps_y == ARR_INTERIOR));
- if (ind == ARR_MIN_END)
- {
+ if (ind == ARR_MIN_END) {
// Compare v with the left endpoint of cv.
- return (this->traits->equal_2_object()
- (this->traits->construct_min_vertex_2_object() (cv),
+ return (this->m_geom_traits->equal_2_object()
+ (this->m_geom_traits->construct_min_vertex_2_object()(cv),
v->point()));
}
- else
- {
+ else {
// Compare v with the right endpoint of cv.
- return (this->traits->equal_2_object()
- (this->traits->construct_max_vertex_2_object() (cv),
+ return (this->m_geom_traits->equal_2_object()
+ (this->m_geom_traits->construct_max_vertex_2_object()(cv),
v->point()));
}
}
@@ -435,11 +410,11 @@ public:
* \pre The curve has a boundary condition in either x or y.
* \return An object that contains the curve end.
*/
- CGAL::Object place_boundary_vertex (Face *,
- const X_monotone_curve_2&,
- Arr_curve_end,
- Arr_parameter_space /* ps_x */,
- Arr_parameter_space /* ps_y */)
+ CGAL::Object place_boundary_vertex(Face*,
+ const X_monotone_curve_2&,
+ Arr_curve_end,
+ Arr_parameter_space /* ps_x */,
+ Arr_parameter_space /* ps_y */)
{
// This function should never be called:
CGAL_error();
@@ -459,14 +434,14 @@ public:
* \return An object that contains the curve end.
*/
Halfedge*
- locate_around_boundary_vertex (Vertex *,
- const X_monotone_curve_2&,
- Arr_curve_end,
- Arr_parameter_space /* ps_x */,
- Arr_parameter_space /* ps_y */) const
+ locate_around_boundary_vertex(Vertex*,
+ const X_monotone_curve_2&,
+ Arr_curve_end,
+ Arr_parameter_space /* ps_x */,
+ Arr_parameter_space /* ps_y */) const
{
CGAL_error();
- return (NULL);
+ return NULL;
}
/*!
@@ -478,10 +453,10 @@ public:
* \pre The curve end is incident to the boundary.
* \return An object that contains the curve end.
*/
- CGAL::Object locate_curve_end (const X_monotone_curve_2&,
- Arr_curve_end,
- Arr_parameter_space /* ps_x */,
- Arr_parameter_space /* ps_y */)
+ CGAL::Object locate_curve_end(const X_monotone_curve_2&,
+ Arr_curve_end,
+ Arr_parameter_space /* ps_x */,
+ Arr_parameter_space /* ps_y */)
{
// This function should never be called:
CGAL_error();
@@ -496,34 +471,28 @@ public:
* \return A halfedge whose direction is the same as e's and whose target is
* the split vertex v.
*/
- Halfedge* split_fictitious_edge (Halfedge *, Vertex *)
+ Halfedge* split_fictitious_edge (Halfedge*, Vertex*)
{
// This function should never be called:
CGAL_error();
- return (NULL);
+ return NULL;
}
/*!
* Determine whether the given face is unbounded.
* \param f The face.
* \return Whether f is unbounded.
+ * There is only one unbounded face in the arrangement:
*/
- bool is_unbounded (const Face *f) const
- {
- // There is only one unbounded face in the arrangement:
- return (f == unb_face);
- }
+ bool is_unbounded(const Face* f) const { return (f == unb_face); }
/*!
* Determine whether the given boundary vertex is redundant.
* \param v The vertex.
* \return Whether v is redundant, and should be erased.
+ * There are no redundant vertices.
*/
- bool is_redundant (const Vertex *) const
- {
- // There are no redundant vertices.
- return (false);
- }
+ bool is_redundant(const Vertex*) const { return false; }
/*!
* Erase the given redundant vertex by merging a fictitious edge.
@@ -532,11 +501,11 @@ public:
* \pre v is a redundant vertex.
* \return One of the pair of halfedges that form the merged edge.
*/
- Halfedge* erase_redundant_vertex (Vertex *)
+ Halfedge* erase_redundant_vertex(Vertex*)
{
// This function should never be called:
CGAL_error();
- return (NULL);
+ return NULL;
}
//! reference_face (const version).
@@ -545,21 +514,15 @@ public:
point.
\return A pointer to the reference face.
*/
- const Face* reference_face() const
- {
- return unbounded_face();
- }
-
+ const Face* reference_face() const { return unbounded_face(); }
+
//! 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.
*/
- Face* reference_face()
- {
- return unbounded_face();
- }
+ Face* reference_face() { return unbounded_face(); }
//@}
@@ -567,22 +530,18 @@ public:
//@{
/*! This function is used by the "walk" point-location strategy. */
- const Face* initial_face () const
+ const Face* initial_face() const
{
return (unb_face);
}
/*! Get the unbounded face (const version). */
- const Face* unbounded_face () const
- {
- return (unb_face);
- }
+ const Face* unbounded_face() const
+ { return (unb_face); }
/*! Get the unbounded face (non-const version). */
- Face* unbounded_face ()
- {
- return (unb_face);
- }
+ Face* unbounded_face()
+ { return (unb_face); }
//@}
/// \name Additional predicates, specialized for this topology-traits class.
@@ -594,11 +553,8 @@ public:
* \param v The vertex.
* \return The result of the comparison of the x-coordinates of p and v.
*/
- virtual Comparison_result compare_x (const Point_2& p,
- const Vertex* v) const
- {
- return (this->traits->compare_x_2_object() (p, v->point()));
- }
+ virtual Comparison_result compare_x(const Point_2& p, const Vertex* v) const
+ { return (this->m_geom_traits->compare_x_2_object()(p, v->point())); }
/*!
* Compare the given vertex and the given point.
@@ -606,11 +562,8 @@ public:
* \param v The vertex.
* \return The result of the xy-lexicographic comparison of p and v.
*/
- virtual Comparison_result compare_xy (const Point_2& p,
- const Vertex* v) const
- {
- return (this->traits->compare_xy_2_object() (p, v->point()));
- }
+ virtual Comparison_result compare_xy(const Point_2& p, const Vertex* v) const
+ { return (this->m_geom_traits->compare_xy_2_object()(p, v->point())); }
/*!
* Compare the relative y-position of the given point and the given edge
@@ -620,11 +573,9 @@ public:
* \pre p should lie in the x-range of the given edge.
* \return The relative y-position of the point p and the edge.
*/
- virtual Comparison_result compare_y_at_x (const Point_2& p,
- const Halfedge* he) const
- {
- return (this->traits->compare_y_at_x_2_object() (p, he->curve()));
- }
+ virtual Comparison_result compare_y_at_x(const Point_2& p,
+ const Halfedge* he) const
+ { return (this->m_geom_traits->compare_y_at_x_2_object()(p, he->curve())); }
//@}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h
index 50eca2c36cd..8541ee5660b 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
-//
+//
//
// Author(s) : Idit Haran
// Ron Wein
@@ -46,7 +46,7 @@ namespace CGAL {
* Generator is a class that generates the set of landmarks.
*/
-template >
class Arr_landmarks_point_location
{
@@ -105,10 +105,10 @@ protected:
template
Result_type make_result(T t) const { return Result::make_result(t); }
inline Result_type default_result() const { return Result::default_result(); }
-
+
public:
/*! Default constructor. */
- Arr_landmarks_point_location() :
+ Arr_landmarks_point_location() :
p_arr(NULL),
m_traits(NULL),
lm_gen(NULL),
@@ -117,30 +117,29 @@ public:
/*! Constructor given an arrangement only. */
Arr_landmarks_point_location(const Arrangement_2& arr) :
- p_arr(&arr)
- {
- // Allocate the landmarks generator.
- m_traits = static_cast(p_arr->geometry_traits());
- lm_gen = new Generator(arr);
- own_gen = true;
- }
+ p_arr(&arr),
+ m_traits(static_cast(p_arr->geometry_traits())),
+ lm_gen(new Generator(arr)), // allocate the landmarks generator.
+ own_gen(true)
+ { }
/*! Constructor given an arrangement, and landmarks generator. */
- Arr_landmarks_point_location(const Arrangement_2& arr, Generator *gen) :
+ Arr_landmarks_point_location(const Arrangement_2& arr, Generator* gen) :
p_arr(&arr),
+ m_traits(static_cast(p_arr->geometry_traits())),
lm_gen(gen),
own_gen(false)
- {
- m_traits = static_cast(p_arr->geometry_traits());
- }
+ { }
/*! Destructor. */
- ~Arr_landmarks_point_location()
+ ~Arr_landmarks_point_location()
{
- if (own_gen)
+ if (own_gen) {
delete lm_gen;
+ lm_gen = NULL;
+ }
}
-
+
/*! Attach an arrangement object (and a generator, if supplied). */
void attach(const Arrangement_2& arr, Generator* gen = NULL)
{
@@ -158,8 +157,8 @@ public:
else if (lm_gen != NULL) {
// In case a generator exists internally, make sure it is attached to
// the given arrangement.
- Arrangement_2 &non_const_arr = const_cast(*p_arr);
- lm_gen->attach(non_const_arr);
+ Arrangement_2& non_const_arr = const_cast(*p_arr);
+ lm_gen->attach(non_const_arr);
}
else {
// Allocate a new generator, attached to the given arrangement.
@@ -169,7 +168,7 @@ public:
}
/*! Detach the instance from the arrangement object. */
- void detach()
+ void detach()
{
p_arr = NULL;
m_traits = NULL;
@@ -178,7 +177,7 @@ public:
if (lm_gen)
lm_gen->detach();
}
-
+
/*!
* Locate the arrangement feature containing the given point.
* \param p The query point.
@@ -189,9 +188,7 @@ public:
result_type locate(const Point_2& p) const;
protected:
-
- /*!
- * Walks from the given vertex to the query point.
+ /*! Walk from the given vertex to the query point.
* \param vh The given vertex handle.
* \param p The query point.
* \param crossed_edges In/Out: The set of edges crossed so far.
@@ -200,11 +197,10 @@ protected:
* Halfedge_const_handle or a Vertex_const_handle.
*/
result_type _walk_from_vertex(Vertex_const_handle vh,
- const Point_2 & p,
+ const Point_2& p,
Halfedge_set& crossed_edges) const;
- /*!
- * Locate an edge around a given vertex that is the predecessor of the
+ /*! Locate an edge around a given vertex that is the predecessor of the
* curve connecting the vertex to the query point in a clockwise order.
* \param vh The vertex.
* \param p The query point.
@@ -212,11 +208,10 @@ protected:
* \return The desired object (a halfedge handle or a vertex handle).
*/
result_type _find_face_around_vertex(Vertex_const_handle vh,
- const Point_2& p,
+ const Point_2& p,
bool& new_vertex) const;
- /*!
- * Walks from a point on a given halfedge to the query point.
+ /*! Walk from a point on a given halfedge to the query point.
* \param eh The given halfedge handle.
* \param np The point that the walk starts from.
* \param p The query point.
@@ -226,11 +221,10 @@ protected:
* Halfedge_const_handle or a Vertex_const_handle.
*/
result_type _walk_from_edge(Halfedge_const_handle eh,
- const Point_2& np,
+ const Point_2& np,
const Point_2& p,
Halfedge_set& crossed_edges) const;
- /*!
- * In case the arrangement's curve contained in the segment
+ /*! In case the arrangement's curve contained in the segment
* from the nearest landmark to the query point
* \param he The given halfedge handle.
* \param p_is_left Is the query point the left endpoint of seg.
@@ -246,8 +240,7 @@ protected:
const Point_2& p,
Halfedge_set& crossed_edges) const;
- /*!
- * Walks from a point in a face to the query point.
+ /*! Walk from a point in a face to the query point.
* \param fh A halfedge handle that points to the face.
* \param np The point that the walk starts from.
* \param p The query point.
@@ -257,12 +250,11 @@ protected:
* Halfedge_const_handle or a Vertex_const_handle.
*/
result_type _walk_from_face(Face_const_handle fh,
- const Point_2 & np,
- const Point_2 & p,
+ const Point_2& np,
+ const Point_2& p,
Halfedge_set& crossed_edges) const;
- /*!
- * Find a halfedge on the given CCB that intersects the given x-monotone
+ /*! Find a halfedge on the given CCB that intersects the given x-monotone
* curve, connecting the current landmark to the query point.
* \param circ The CCB circulator.
* \param seg The segment connecting the landmark and the query point.
@@ -287,8 +279,7 @@ protected:
bool& cv_is_contained_in_seg,
Vertex_const_handle& new_vertex) const;
- /*!
- * Return the halfedge that contains the query point.
+ /*! Return the halfedge that contains the query point.
* \param he The halfedge handle.
* \param crossed_edges In/Out: The set of edges crossed so far.
* \param p The query point.
@@ -300,8 +291,7 @@ protected:
const Point_2& p,
bool& is_target) const;
- /*!
- * Check whether the given curve intersects a simple segment, which connects
+ /*! Check whether the given curve intersects a simple segment, which connects
* the current landmark to the query point, an odd number of times.
* \param cv The curve.
* \param seg The segment connecting the landmark and the query point.
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
index e1def2056af..0fe00de52b8 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel).
+// Copyright (c) 2006,2007,2009,2010,2011,2013 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -636,17 +636,17 @@ public:
public:
Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const
{
- return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base());
+ return m_base->compare_y_on_boundary_2_object()(p1.base(), p2.base());
}
Comparison_result operator() (const Point_2 & pt,
const X_monotone_curve_2& xcv, Arr_curve_end ce) const
{
- return m_base->compare_x_on_boundary_2_object()(pt.base(), xcv.base(), ce);
+ return m_base->compare_y_on_boundary_2_object()(pt.base(), xcv.base(), ce);
}
Comparison_result operator() (const X_monotone_curve_2& xcv1, Arr_curve_end ce1,
const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const
{
- return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2);
+ return m_base->compare_y_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2);
}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h
index 42da5327077..ecce904547f 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h
@@ -18,8 +18,8 @@
// Author(s) : Idit Haran
// Ron Wein
-#ifndef CGAL_ARR_LANDMARKS_GENERATOR_H
-#define CGAL_ARR_LANDMARKS_GENERATOR_H
+#ifndef CGAL_ARR_LANDMARKS_GENERATOR_BASE_H
+#define CGAL_ARR_LANDMARKS_GENERATOR_BASE_H
/*! \file
* Definition of the Arr_landmarks_generator_base template.
@@ -87,70 +87,71 @@ protected:
typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2;
// Data members:
- const Traits_adaptor_2 *m_traits; // The associated traits object.
- Nearest_neighbor nn; // The associated nearest neighbor object.
- bool ignore_notifications;
- bool updated;
- int num_small_not_updated_changes;
+ const Traits_adaptor_2* m_traits; // The associated traits object.
+ Nearest_neighbor nn; // The associated nearest neighbor object.
+ bool m_ignore_notifications;
+ bool m_ignore_remove_edge;
+ bool updated;
+ int num_small_not_updated_changes;
template
PL_result_type pl_make_result(T t) { return PL_result::make_result(t); }
- inline PL_result_type pl_default_result() { return PL_result::default_result(); }
+ inline PL_result_type pl_default_result()
+ { return PL_result::default_result(); }
public:
bool is_empty() const { return nn.is_empty(); }
private:
/*! Copy constructor - not supported. */
- Arr_landmarks_generator_base (const Self& );
+ Arr_landmarks_generator_base(const Self&);
/*! Assignment operator - not supported. */
- Self& operator= (const Self& );
+ Self& operator=(const Self& );
public:
- /*! Constructor. */
- Arr_landmarks_generator_base (const Arrangement_2& arr) :
+ /*! Constructor from an arrangement.
+ * \param arr (in) The arrangement.
+ */
+ Arr_landmarks_generator_base(const Arrangement_2& arr) :
Arr_observer (const_cast(arr)),
- ignore_notifications (false),
- updated (false),
+ m_traits(static_cast(arr.geometry_traits())),
+ m_ignore_notifications(false),
+ m_ignore_remove_edge(false),
+ updated(false),
num_small_not_updated_changes(0)
{
- m_traits = static_cast (arr.geometry_traits());
// One needs to call build_landmark_set() in the constructor of any
// inherited class.
}
- /*!
- * Creates the landmarks set (choosing the landmarks) ,
+ /*! Create the landmarks set (choosing the landmarks) ,
* and saving them in the nearest-neighbor search structure.
*/
- virtual void build_landmark_set ()
+ virtual void build_landmark_set()
{
// Create the landmark points.
- NN_Points_set nn_points;
-
+ NN_Points_set nn_points;
_create_nn_points_set(nn_points);
// Update the search structure.
nn.clear();
- nn.init (nn_points.begin(), nn_points.end());
+ nn.init(nn_points.begin(), nn_points.end());
num_small_not_updated_changes = 0;
updated = true;
}
- /*!
- * clear the set of landmarks.
+ /*! clear the set of landmarks.
*/
- virtual void clear_landmark_set ()
+ virtual void clear_landmark_set()
{
nn.clear();
num_small_not_updated_changes = 0;
updated = false;
}
- /*!
- * Get the nearest neighbor (landmark) to the given point.
+ /*! Obtain the nearest neighbor (landmark) to the given point.
* \param p The query point.
* \param obj Output: The location of the nearest landmark point in the
* arrangement (a vertex, halfedge, or face handle).
@@ -170,208 +171,295 @@ public:
* arrangement.
* \param arr The arrangement to be copied.
*/
- virtual void before_assign (const Arrangement_2& arr)
+ virtual void before_assign(const Arrangement_2& arr)
{
this->clear_landmark_set();
- m_traits = static_cast (arr.geometry_traits());
- ignore_notifications = true;
+ m_traits = static_cast(arr.geometry_traits());
+ m_ignore_notifications = true;
}
- /*!
- * 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()
{
this->build_landmark_set();
- ignore_notifications = false;
+ m_ignore_notifications = false;
}
- /*!
- * 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)
{
this->clear_landmark_set();
- m_traits = static_cast (arr.geometry_traits());
- ignore_notifications = true;
+ m_traits = static_cast(arr.geometry_traits());
+ m_ignore_notifications = true;
}
- /*!
- * Notification after the observer has been attached to an arrangement.
+ /*! Notification after the observer has been attached to an arrangement.
*/
- virtual void after_attach ()
+ virtual void after_attach()
{
this->build_landmark_set();
- ignore_notifications = false;
+ m_ignore_notifications = false;
}
- /*!
- * Notification before the observer is detached from the arrangement.
+ /*! Notification before the observer is detached from the arrangement.
*/
- virtual void before_detach ()
- {
- this->clear_landmark_set();
- }
+ virtual void before_detach()
+ { this->clear_landmark_set(); }
- /*!
- * Notification after the arrangement is cleared.
+ /*! Notification after the arrangement is cleared.
* \param u A handle to the unbounded face.
*/
- virtual void after_clear ()
+ virtual void after_clear()
{
this->clear_landmark_set();
this->build_landmark_set();
}
- /*! Notification before a global operation modifies the arrangement. */
- virtual void before_global_change ()
+ /*! Notification before a global operation modifies the arrangement.
+ */
+ virtual void before_global_change()
{
this->clear_landmark_set();
- ignore_notifications = true;
+ m_ignore_notifications = true;
}
- /*! Notification after a global operation is completed. */
- virtual void after_global_change ()
+ /*! Notification after a global operation is completed.
+ */
+ virtual void after_global_change()
{
this->build_landmark_set();
- ignore_notifications = false;
+ m_ignore_notifications = false;
}
//@}
/// \name Overloaded observer functions on local changes.
//@{
+ /*! Notification before the removal of an edge.
+ * \param e (in) A handle to one of the twin halfedges to be removed.
+ */
+ virtual void before_remove_edge(Halfedge_handle /* e */)
+ { m_ignore_remove_edge = true; }
+
/*! Notification after the creation of a new vertex. */
- virtual void after_create_vertex (Vertex_handle )
+ virtual void after_create_vertex(Vertex_handle)
{
- this->_handle_local_change_notification();
- }
-
- /*! Notification after the creation of a new edge. */
- virtual void after_create_edge (Halfedge_handle )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an edge was split. */
- virtual void after_split_edge(Halfedge_handle, Halfedge_handle)
- { this->_handle_local_change_notification(); }
-
- /*! Notification after a face was split. */
- virtual void after_split_face(Face_handle, Face_handle, bool)
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an outer CCB was split.*/
- virtual void after_split_outer_ccb (Face_handle ,
- Ccb_halfedge_circulator ,
- Ccb_halfedge_circulator )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an inner CCB was split. */
- virtual void after_split_inner_ccb (Face_handle ,
- Ccb_halfedge_circulator ,
- Ccb_halfedge_circulator )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an outer CCB was added to a face. */
- virtual void after_add_outer_ccb (Ccb_halfedge_circulator )
- {
- this->_handle_local_change_notification();
- }
-
- /*! Notification after an inner CCB was created inside a face. */
- virtual void after_add_inner_ccb (Ccb_halfedge_circulator )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an isolated vertex was created inside a face. */
- virtual void after_add_isolated_vertex (Vertex_handle )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an edge was merged. */
- virtual void after_merge_edge (Halfedge_handle )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after a face was merged. */
- virtual void after_merge_face (Face_handle )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an outer CCB was merged. */
- virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator)
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an inner CCB was merged. */
- virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator)
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an outer CCB is moved from one face to another. */
- virtual void after_move_outer_ccb (Ccb_halfedge_circulator )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an inner CCB is moved from one face to another. */
- virtual void after_move_inner_ccb (Ccb_halfedge_circulator )
- { this->_handle_local_change_notification(); }
-
- /*! Notification after an isolated vertex is moved. */
- virtual void after_move_isolated_vertex (Vertex_handle )
- { this->_handle_local_change_notification(); }
-
- /*! Notificaion after the removal of a vertex. */
- virtual void after_remove_vertex ()
- { this->_handle_local_change_notification(); }
-
- /*! Notification after the removal of an edge. */
- virtual void after_remove_edge ()
- { this->_handle_local_change_notification(); }
-
- /*! Notificaion after the removal of an outer CCB. */
- virtual void after_remove_outer_ccb (Face_handle )
- { this->_handle_local_change_notification(); }
-
- /*! Notificaion after the removal of an inner CCB. */
- virtual void after_remove_inner_ccb (Face_handle )
- { this->_handle_local_change_notification(); }
- //@}
-
-protected:
- /*! Handle a change notification. */
- void _handle_local_change_notification ()
- {
- if (! ignore_notifications) {
+ if (! m_ignore_notifications) {
clear_landmark_set();
build_landmark_set();
}
}
- /*!
- * This function creates the list of landmarks with their location.
+ /*! Notification after the creation of a new edge. */
+ virtual void after_create_edge(Halfedge_handle)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an edge was split. */
+ virtual void after_split_edge(Halfedge_handle, Halfedge_handle)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after a face was split. */
+ virtual void after_split_face(Face_handle, Face_handle, bool)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an outer CCB was split.*/
+ virtual void after_split_outer_ccb(Face_handle,
+ Ccb_halfedge_circulator,
+ Ccb_halfedge_circulator)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an inner CCB was split. */
+ virtual void after_split_inner_ccb(Face_handle,
+ Ccb_halfedge_circulator,
+ Ccb_halfedge_circulator)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an outer CCB was added to a face. */
+ virtual void after_add_outer_ccb(Ccb_halfedge_circulator)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an inner CCB was created inside a face. */
+ virtual void after_add_inner_ccb(Ccb_halfedge_circulator)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an isolated vertex was created inside a face. */
+ virtual void after_add_isolated_vertex(Vertex_handle)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an edge was merged. */
+ virtual void after_merge_edge(Halfedge_handle)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after a face was merged. */
+ virtual void after_merge_face(Face_handle)
+ {
+ if (! m_ignore_notifications && ! m_ignore_remove_edge) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an outer CCB was merged. */
+ virtual void after_merge_outer_ccb(Face_handle, Ccb_halfedge_circulator)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an inner CCB was merged. */
+ virtual void after_merge_inner_ccb(Face_handle, Ccb_halfedge_circulator)
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an outer CCB is moved from one face to another. */
+ virtual void after_move_outer_ccb(Ccb_halfedge_circulator )
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an inner CCB is moved from one face to another. */
+ virtual void after_move_inner_ccb(Ccb_halfedge_circulator )
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after an isolated vertex is moved. */
+ virtual void after_move_isolated_vertex(Vertex_handle )
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notificaion after the removal of a vertex. */
+ virtual void after_remove_vertex()
+ {
+ if (! m_ignore_notifications && ! m_ignore_remove_edge) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notification after the removal of an edge. */
+ virtual void after_remove_edge()
+ {
+ if (! m_ignore_notifications) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ m_ignore_remove_edge = false;
+ }
+
+ /*! Notificaion after the removal of an outer CCB. */
+ virtual void after_remove_outer_ccb(Face_handle)
+ {
+ if (! m_ignore_notifications && ! m_ignore_remove_edge) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+
+ /*! Notificaion after the removal of an inner CCB. */
+ virtual void after_remove_inner_ccb(Face_handle)
+ {
+ if (! m_ignore_notifications && ! m_ignore_remove_edge) {
+ clear_landmark_set();
+ build_landmark_set();
+ }
+ }
+ //@}
+
+protected:
+ /*! Create the list of landmarks with their location.
* This is a pure virtual function, and the class that inherites from
* this generator must implement it.
*/
- virtual void _create_points_set (Points_set &) = 0;
+ virtual void _create_points_set(Points_set&) = 0;
- virtual void _create_nn_points_set (NN_Points_set &nn_points)
+ virtual void _create_nn_points_set(NN_Points_set& nn_points)
{
- Points_set points;
- Pairs_set pairs;
+ Points_set points;
+ Pairs_set pairs;
// Create the set of landmark points.
_create_points_set(points);
// Locate the landmarks in the arrangement using batched point-location
// global function.
- locate (*(this->arrangement()), points.begin(), points.end(),
- std::back_inserter(pairs));
+ locate(*(this->arrangement()), points.begin(), points.end(),
+ std::back_inserter(pairs));
// Apply a random shuffle on the points, since the batched point-location
// returns them sorted.
- std::random_shuffle (pairs.begin(), pairs.end());
+ std::random_shuffle(pairs.begin(), pairs.end());
// Insert all landmarks (paired with their current location in the
// arrangement) into the nearest-neighbor search structure.
- Pairs_iterator itr;
-
+ Pairs_iterator itr;
for (itr = pairs.begin(); itr != pairs.end(); ++itr) {
- NN_Point_2 np(itr->first, itr->second);
+ NN_Point_2 np(itr->first, itr->second);
nn_points.push_back(np);
}
}
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h
index a706e3d0b9a..3709e86a5c2 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h
@@ -17,8 +17,9 @@
//
// Author(s) : Idit Haran
// Ron Wein
-#ifndef CGAL_ARR_LM_GRID_GENERATOR_H
-#define CGAL_ARR_LM_GRID_GENERATOR_H
+
+#ifndef CGAL_ARR_LANDMARKS_GRID_GENERATOR_H
+#define CGAL_ARR_LANDMARKS_GRID_GENERATOR_H
/*! \file
* Definition of the Arr_grid_landmarks_generator template.
@@ -73,17 +74,17 @@ protected:
typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2;
// Data members:
- const Traits_adaptor_2* m_traits;
- unsigned int num_landmarks;
- Pairs_set lm_pairs;
+ const Traits_adaptor_2* m_traits;
+ unsigned int num_landmarks;
+ Pairs_set lm_pairs;
- ANT x_min, y_min; // Bounding box for the
- ANT x_max, y_max; // arrangement vertices.
- ANT step_x, step_y; // Grid step sizes.
- unsigned int sqrt_n;
+ ANT x_min, y_min; // Bounding box for the
+ ANT x_max, y_max; // arrangement vertices.
+ ANT step_x, step_y; // Grid step sizes.
+ unsigned int sqrt_n;
- bool fixed_number_of_lm; // indicates if the constructor got
- // number of landmarks as parameter
+ bool fixed_number_of_lm; // indicates if the constructor got
+ // number of landmarks as parameter
private:
/*! Copy constructor - not supported. */
@@ -93,34 +94,35 @@ private:
Self& operator=(const Self&);
public:
- /*! Constructor. */
+ /*! Constructor from an arrangement.
+ * \param arr (in) The arrangement.
+ */
Arr_grid_landmarks_generator(const Arrangement_2& arr) :
Base(arr),
+ m_traits(static_cast(arr.geometry_traits())),
num_landmarks(0),
fixed_number_of_lm(false)
{
- m_traits = static_cast(arr.geometry_traits());
build_landmark_set();//this->
}
Arr_grid_landmarks_generator(const Arrangement_2& arr,
unsigned int n_landmarks) :
Base(arr),
+ m_traits(static_cast(arr.geometry_traits())),
num_landmarks(n_landmarks),
fixed_number_of_lm(true)
{
- m_traits = static_cast(arr.geometry_traits());
build_landmark_set();//this->
}
- /*!
- * Create the landmarks set (choosing the landmarks),
+ /*! Create the landmarks set (choosing the landmarks),
* and store them in the nearest neighbor search structure.
*/
virtual void build_landmark_set()
{
// Create a set of points on a grid.
- Points_set points;
+ Points_set points;
_create_points_set(points);
// Locate the landmarks in the arrangement using batched point-location
// global function. Note that the resulting pairs are returned sorted by
@@ -131,8 +133,7 @@ public:
this->updated = true;
}
- /*!
- * Clear the set of landmarks.
+ /*! Clear the set of landmarks.
*/
virtual void clear_landmark_set()
{
@@ -140,11 +141,10 @@ public:
this->updated = false;
}
- /*!
- * Get the nearest neighbor (landmark) to the given point.
+ /*! Obtain the nearest neighbor (landmark) to the given point.
* \param q The query point.
- * \param obj Output: The location of the nearest landmark point in the
- * arrangement (a vertex, halfedge, or face handle).
+ * \param obj (out) The location of the nearest landmark point in the
+ * arrangement (a vertex, halfedge, or face handle).
* \return The nearest landmark point.
*/
virtual Point_2 closest_landmark(const Point_2& q, PL_result_type& obj)
@@ -152,26 +152,17 @@ public:
CGAL_assertion(this->updated);
// Calculate the index of the nearest grid point point to q.
- const ANT qx = m_traits->approximate_2_object()(q, 0);
- const ANT qy = m_traits->approximate_2_object()(q, 1);
- unsigned int i, j;
- unsigned int index;
-
- if (CGAL::compare(qx, x_min) == SMALLER)
- i = 0;
- else if (CGAL::compare(qx, x_max) == LARGER)
- i = sqrt_n - 1;
- else
- i = static_cast(((qx - x_min) / step_x) + 0.5);
-
- if (CGAL::compare(qy, y_min) == SMALLER)
- j = 0;
- else if (CGAL::compare(qy, y_max) == LARGER)
- j = sqrt_n - 1;
- else
- j = static_cast(((qy - y_min) / step_y) + 0.5);
-
- index = sqrt_n * i + j;
+ typename Geometry_traits_2::Approximate_2 approximate =
+ m_traits->approximate_2_object();
+ const ANT qx = approximate(q, 0);
+ const ANT qy = approximate(q, 1);
+ unsigned int i = (CGAL::compare(qx, x_min) == SMALLER) ? 0 :
+ (CGAL::compare(qx, x_max) == LARGER) ? (sqrt_n - 1) :
+ static_cast(((qx - x_min) / step_x) + 0.5);
+ unsigned int j = (CGAL::compare(qy, y_min) == SMALLER) ? 0 :
+ (CGAL::compare(qy, y_max) == LARGER) ? (sqrt_n - 1) :
+ static_cast(((qy - y_min) / step_y) + 0.5);
+ unsigned int index = sqrt_n * i + j;
// Return the result.
obj = lm_pairs[index].second;
@@ -179,8 +170,7 @@ public:
}
protected:
- /*!
- * Create a set of landmark points on a grid.
+ /*! Create a set of landmark points on a grid.
*/
virtual void _create_points_set(Points_set& points)
{
@@ -203,34 +193,29 @@ protected:
return;
}
- ANT x, y;
- Vertex_const_iterator left, right, top, bottom;
+ ANT x, y;
+ Vertex_const_iterator left, right, top, bottom;
left = right = top = bottom = vit;
- for (++vit; vit != arr->vertices_end(); ++vit)
- {
+ for (++vit; vit != arr->vertices_end(); ++vit) {
x = m_traits->approximate_2_object()(vit->point(), 0);
y = m_traits->approximate_2_object()(vit->point(), 1);
- if (CGAL::compare(x, x_min) == SMALLER)
- {
+ if (CGAL::compare(x, x_min) == SMALLER) {
x_min = x;
left = vit;
}
- else if (CGAL::compare(x, x_max) == LARGER)
- {
+ else if (CGAL::compare(x, x_max) == LARGER) {
x_max = x;
right = vit;
}
- if (CGAL::compare(y, y_min) == SMALLER)
- {
+ if (CGAL::compare(y, y_min) == SMALLER) {
y_min = y;
bottom = vit;
}
- else if (CGAL::compare(y, y_max) == LARGER)
- {
+ else if (CGAL::compare(y, y_max) == LARGER) {
y_max = y;
top = vit;
}
@@ -249,20 +234,15 @@ protected:
CGAL_assertion(sqrt_n > 1);
// Calculate the step sizes for the grid.
- ANT delta_x = m_traits->approximate_2_object()(right->point(), 0) -
- m_traits->approximate_2_object()(left->point(), 0);
- ANT delta_y = m_traits->approximate_2_object()(top->point(), 1) -
- m_traits->approximate_2_object()(bottom->point(), 1);
-
- if (CGAL::sign(delta_x) == CGAL::ZERO)
- delta_x = delta_y;
-
- if (CGAL::sign(delta_y) == CGAL::ZERO)
- delta_y = delta_x;
+ ANT delta_x = m_traits->approximate_2_object()(right->point(), 0) -
+ m_traits->approximate_2_object()(left->point(), 0);
+ ANT delta_y = m_traits->approximate_2_object()(top->point(), 1) -
+ m_traits->approximate_2_object()(bottom->point(), 1);
+ if (CGAL::sign(delta_x) == CGAL::ZERO) delta_x = delta_y;
+ if (CGAL::sign(delta_y) == CGAL::ZERO) delta_y = delta_x;
CGAL_assertion((CGAL::sign(delta_x) == CGAL::POSITIVE) &&
(CGAL::sign(delta_y) == CGAL::POSITIVE));
-
step_x = delta_x / (sqrt_n - 1);
step_y = delta_y / (sqrt_n - 1);
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h
index f033b79de13..a173a551fd4 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h
@@ -17,8 +17,9 @@
//
// Author(s) : Idit Haran
// Ron Wein
-#ifndef CGAL_ARR_LM_HALTON_GENERATOR_H
-#define CGAL_ARR_LM_HALTON_GENERATOR_H
+
+#ifndef CGAL_ARR_LANDMARKS_HALTON_GENERATOR_H
+#define CGAL_ARR_LANDMARKS_HALTON_GENERATOR_H
/*! \file
* Definition of the Arr_halton_landmarks_generator template.
@@ -55,7 +56,7 @@ public:
protected:
// Data members:
- unsigned int num_landmarks;
+ unsigned int num_landmarks;
private:
/*! Copy constructor - not supported. */
@@ -64,10 +65,12 @@ private:
/*! Assignment operator - not supported. */
Self& operator=(const Self&);
-public:
- /*! Constructor. */
+public:
+ /*! Constructor from an arrangement.
+ * \param arr (in) The arrangement.
+ */
Arr_halton_landmarks_generator(const Arrangement_2& arr,
- unsigned int n_landmarks = 0) :
+ unsigned int n_landmarks = 0) :
Base(arr),
num_landmarks(n_landmarks)
{ this->build_landmark_set(); }
@@ -79,18 +82,18 @@ protected:
* The Halton points are constructed in the bounding rectangle of the
* arrangement vertices.
*/
- virtual void _create_points_set (Points_set& points)
+ virtual void _create_points_set(Points_set& points)
{
points.clear();
// Go over the arrangement vertices and construct their boundig box.
const Arrangement_2* arr = this->arrangement();
- Vertex_const_iterator vit;
+ Vertex_const_iterator vit;
double x_min = 0, x_max = 1, y_min = 0, y_max = 1;
double x, y;
bool first = true;
- for (vit=arr->vertices_begin(); vit != arr->vertices_end(); ++vit) {
+ for (vit = arr->vertices_begin(); vit != arr->vertices_end(); ++vit) {
x = CGAL::to_double(vit->point().x());
y = CGAL::to_double(vit->point().y());
@@ -100,15 +103,11 @@ protected:
first = false;
}
else {
- if (x < x_min)
- x_min = x;
- else if (x > x_max)
- x_max = x;
+ if (x < x_min) x_min = x;
+ else if (x > x_max) x_max = x;
- if (y < y_min)
- y_min = y;
- else if (y > y_max)
- y_max = y;
+ if (y < y_min) y_min = y;
+ else if (y > y_max) y_max = y;
}
}
@@ -117,11 +116,10 @@ protected:
if (num_landmarks == 0)
num_landmarks = static_cast(arr->number_of_vertices());
- if (num_landmarks == 0)
- return;
+ if (num_landmarks == 0) return;
if (num_landmarks == 1) {
- points.push_back (Point_2 (x_max, y_max));
+ points.push_back (Point_2 (x_max, y_max));
return;
}
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h
index 8e87b2b634d..7145e9b65d4 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h
@@ -17,8 +17,9 @@
//
//
// Author(s) : Idit Haran
-#ifndef CGAL_ARR_LM_MIDDLE_EDGES_GENERATOR_H
-#define CGAL_ARR_LM_MIDDLE_EDGES_GENERATOR_H
+
+#ifndef CGAL_ARR_LANDMARKS_MIDDLE_EDGES_GENERATOR_H
+#define CGAL_ARR_LANDMARKS_MIDDLE_EDGES_GENERATOR_H
/*! \file
* Definition of the Arr_middle_edges_landmarks_generator template.
@@ -81,7 +82,10 @@ private:
Self& operator=(const Self&);
public:
- /*! Constructor. */
+ /*! Constructor from an arrangement.
+ * \param arr(in) The arrangement.
+ * \param lm_num(in)
+ */
Arr_middle_edges_landmarks_generator(const Arrangement_2& arr,
int /* lm_num */ = -1) :
Base(arr)
@@ -93,20 +97,19 @@ public:
// Observer functions that should be empty, because they
// got nothing to do with middle edges
//-------------------------------------------------
- virtual void after_create_vertex (Vertex_handle /* v */) {}
- virtual void after_split_face (Face_handle /* f */,
- Face_handle /* new_f */, bool /* is_hole */)
+ virtual void after_create_vertex(Vertex_handle /* v */) {}
+ virtual void after_split_face(Face_handle /* f */,
+ Face_handle /* new_f */, bool /* is_hole */)
{}
- virtual void after_add_hole (Ccb_halfedge_circulator /* h */) {}
+ virtual void after_add_hole(Ccb_halfedge_circulator /* h */) {}
- virtual void after_merge_face (Face_handle /* f */) {}
- virtual void after_move_hole (Ccb_halfedge_circulator /* h */) {}
- virtual void after_remove_vertex () {}
- virtual void after_remove_hole (Face_handle /* f */) {}
+ virtual void after_merge_face(Face_handle /* f */) {}
+ virtual void after_move_hole(Ccb_halfedge_circulator /* h */) {}
+ virtual void after_remove_vertex() {}
+ virtual void after_remove_hole(Face_handle /* f */) {}
protected:
- /*!
- * create a set of middle_edges points
+ /*! Create a set of middle_edges points
* the number of points is equal to the number of edges in the arrangement.
*/
virtual void _create_nn_points_set(NN_Points_set& nn_points)
@@ -116,12 +119,11 @@ protected:
Halfedge_const_handle hh;
Arrangement_2* arr = this->arrangement();
- if (arr->number_of_vertices() == 1)
- {
+ if (arr->number_of_vertices() == 1) {
//special treatment for arrangement with one isolated verrtex
Vertex_const_iterator vit = arr->vertices_begin();
PL_result_type obj = this->pl_make_result(vit);
- Point_2 p (vit->point());
+ Point_2 p(vit->point());
NN_Point_2 np(p, obj);
nn_points.push_back(np);
@@ -132,7 +134,7 @@ protected:
hh = eit;
const Point_2& p1 = hh->source()->point();
const Point_2& p2 = hh->target()->point();
- Point_2 p ((p1.x()+p2.x())/2, (p1.y()+p2.y())/2);
+ Point_2 p((p1.x()+p2.x())/2, (p1.y()+p2.y())/2);
//CGAL_PRINT_DEBUG("mid point is= " << p);
@@ -142,9 +144,9 @@ protected:
}
}
- virtual void _create_points_set (Points_set & /* points */)
+ virtual void _create_points_set(Points_set& /* points */)
{
- std::cerr << "should not reach here!"<< std::endl;
+ std::cerr << "should not reach here!" << std::endl;
CGAL_error();
}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h
index 09206e2a0e1..92cf9950403 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h
@@ -14,11 +14,12 @@
//
// $URL$
// $Id$
-//
+//
// Author(s) : Idit Haran
// Ron Wein
-#ifndef CGAL_ARR_LM_RANDOM_GENERATOR_H
-#define CGAL_ARR_LM_RANDOM_GENERATOR_H
+
+#ifndef CGAL_ARR_LANDMARKS_RANDOM_GENERATOR_H
+#define CGAL_ARR_LANDMARKS_RANDOM_GENERATOR_H
/*! \file
* Definition of the Arr_random_landmarks_generator template.
@@ -57,40 +58,41 @@ public:
protected:
// Data members:
- unsigned int num_landmarks;
+ unsigned int num_landmarks;
private:
/*! Copy constructor - not supported. */
- Arr_random_landmarks_generator (const Self& );
+ Arr_random_landmarks_generator(const Self&);
/*! Assignment operator - not supported. */
- Self& operator= (const Self& );
+ Self& operator=(const Self&);
-public:
- /*! Constructor. */
- Arr_random_landmarks_generator (const Arrangement_2& arr,
- unsigned int n_landmarks = 0) :
- Base (arr),
- num_landmarks (n_landmarks)
+public:
+ /*! Constructor from an arrangement.
+ * \param arr (in) The arrangement.
+ */
+ Arr_random_landmarks_generator(const Arrangement_2& arr,
+ unsigned int n_landmarks = 0) :
+ Base(arr),
+ num_landmarks(n_landmarks)
{ this->build_landmark_set(); }
protected:
- /*!
- * Create a set of random points (the number of points is given as a
+ /*! Create a set of random points (the number of points is given as a
* parameter to the constructor, or is taken from the arrangement size).
* The coordinates of the landmarks are selected randomly in the
- * bounding rectangle of the Arrangement's vertices
+ * bounding rectangle of the Arrangement's vertices
*/
- virtual void _create_points_set (Points_set& points)
+ virtual void _create_points_set(Points_set& points)
{
points.clear();
// Go over the arrangement vertices and construct their boundig box.
- const Arrangement_2 *arr = this->arrangement();
- Vertex_const_iterator vit;
- double x_min = 0, x_max = 1, y_min = 0, y_max = 1;
- double x, y;
- bool first = true;
+ const Arrangement_2* arr = this->arrangement();
+ Vertex_const_iterator vit;
+ double x_min = 0, x_max = 1, y_min = 0, y_max = 1;
+ double x, y;
+ bool first = true;
for (vit=arr->vertices_begin(); vit != arr->vertices_end(); ++vit) {
x = CGAL::to_double(vit->point().x());
@@ -102,15 +104,11 @@ protected:
first = false;
}
else {
- if (x < x_min)
- x_min = x;
- else if (x > x_max)
- x_max = x;
+ if (x < x_min) x_min = x;
+ else if (x > x_max) x_max = x;
- if (y < y_min)
- y_min = y;
- else if (y > y_max)
- y_max = y;
+ if (y < y_min) y_min = y;
+ else if (y > y_max) y_max = y;
}
}
@@ -123,10 +121,9 @@ protected:
for (unsigned int i = 0; i < num_landmarks; ++i) {
double px = (x_min == x_max) ? x_min : random.get_double(x_min, x_max);
double py = (y_min == y_max) ? y_min : random.get_double(y_min, y_max);
- points.push_back(Point_2 (px, py));
+ points.push_back(Point_2(px, py));
}
}
-
};
} //namespace CGAL
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h
index 0e4dc4f3994..813d9277cd0 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h
@@ -14,11 +14,11 @@
//
// $URL$
// $Id$
-//
+//
// Author(s) : Shlomo Golubev
-#ifndef CGAL_ARR_SPECIFIED_POINTS_GENERATOR_H
-#define CGAL_ARR_SPECIFIED_POINTS_GENERATOR_H
+#ifndef CGAL_ARR_LANDMARKS_SPECIFIED_POINTS_GENERATOR_H
+#define CGAL_ARR_LANDMARKS_SPECIFIED_POINTS_GENERATOR_H
/*! \file
* Definition of the Arr_lm_specified_points_generator template.
@@ -65,7 +65,7 @@ public:
typedef typename Nearest_neighbor::NN_Point_2 NN_Point_2;
typedef std::list NN_Point_list;
-
+
protected:
typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2;
typedef typename Base::PL_result_type PL_result_type;
@@ -85,26 +85,28 @@ private:
/*! Assignment operator - not supported. */
Self& operator=(const Self&);
-public:
- /*! Constructor. */
+public:
+ /*! Constructor.
+ * Create landmarks in the points that are given to it.
+ */
Arr_landmarks_specified_points_generator(const Arrangement_2& arr,
const Points_set points) :
Base(arr),
+ m_traits(static_cast(arr.geometry_traits())),
+ m_points(points),
num_landmarks(points.size())
- {
- //this constructor creates landmarks in the points that are given to it
- m_traits = static_cast(arr.geometry_traits());
- m_points = points;
- build_landmark_set();
- }
+ { build_landmark_set(); }
+ /*! Constructor. from an arrangement.
+ * \param arr (in) The arrangement.
+ */
Arr_landmarks_specified_points_generator(const Arrangement_2& arr) :
- Base(arr)
+ Base(arr),
+ m_traits(static_cast (arr.geometry_traits())),
+ num_landmarks(1)
{
//this constructor creates a single landmark in the origin
m_points.push_back(Point_2(0,0));
- num_landmarks = 1;
- m_traits = static_cast (arr.geometry_traits());
build_landmark_set();
}
@@ -114,28 +116,24 @@ public:
CGAL_error();
}
- /*!
- * Creates the landmark set, using all arrangement vertices.
+ /*! Create the landmark set, using all arrangement vertices.
*/
void build_landmark_set()
{
-
lm_pairs.clear();
- locate (*(this->arrangement()), m_points.begin(), m_points.end(),
- std::back_inserter(lm_pairs));
+ locate(*(this->arrangement()), m_points.begin(), m_points.end(),
+ std::back_inserter(lm_pairs));
// Go over the container of the specified points and insert them as
// landmarks.
- NN_Point_list nnp_list;
+ NN_Point_list nnp_list;
typename Points_set::iterator pt_it;
typename Pairs_set::iterator pairs_it;
- for (pt_it = m_points.begin(); pt_it != m_points.end(); ++pt_it)
- {
+ for (pt_it = m_points.begin(); pt_it != m_points.end(); ++pt_it) {
for (pairs_it = lm_pairs.begin();
pairs_it != lm_pairs.end() && (*pairs_it).first != (*pt_it);
++pairs_it) {};
- if ((*pairs_it).first == (*pt_it))
- {
+ if ((*pairs_it).first == (*pt_it)) {
nnp_list.push_back (NN_Point_2 ((*pt_it),(*pairs_it).second));
}
}
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h
index 806f7b35626..8b3c2bc183e 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
-//
+//
// Author(s) : Idit Haran
// Ron Wein
#ifndef CGAL_ARR_LANDMARKS_VERTICES_GENERATOR_H
@@ -57,7 +57,7 @@ public:
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
-
+
typedef typename Arrangement_2::Point_2 Point_2;
typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2;
@@ -81,28 +81,29 @@ private:
Self& operator=(const Self&);
public:
- /*! Constructor. */
+ /*! Constructor from an arrangement.
+ * \param arr (in) The arrangement.
+ */
Arr_landmarks_vertices_generator(const Arrangement_2& arr) :
- Base (arr),
+ Base(arr),
num_landmarks(0)
{
- m_traits = static_cast (arr.geometry_traits());
+ m_traits = static_cast(arr.geometry_traits());
build_landmark_set();//this->
}
virtual void _create_points_set(Points_set & /* points */)
{
- std::cerr << "should not reach here!"<< std::endl;
+ std::cerr << "should not reach here!" << std::endl;
CGAL_error();
}
- /*!
- * Creates the landmark set, using all arrangement vertices.
+ /*! Create the landmark set, using all arrangement vertices.
*/
virtual void build_landmark_set()
{
// Go over the arrangement, and insert all its vertices as landmarks.
- NN_Point_list nnp_list;
+ NN_Point_list nnp_list;
const Arrangement_2* arr = this->arrangement();
Vertex_const_iterator vit;
num_landmarks = 0;
@@ -120,10 +121,9 @@ public:
this->updated = true;
}
- /*!
- * Clear the landmark set.
+ /*! Clear the landmark set.
*/
- virtual void clear_landmark_set ()
+ virtual void clear_landmark_set()
{
this->nn.clear();
num_landmarks = 0;
@@ -132,13 +132,14 @@ public:
}
protected:
- /*! Handle a local change. */
+ /*! Handle a local change.
+ */
void _handle_local_change_notification()
{
// Rebuild the landmark set only if the number of small
// changes is greater than sqrt(num_landmarks).
- double nl = static_cast(num_landmarks);
- const int sqrt_num_landmarks = static_cast (std::sqrt (nl) + 0.5);
+ double nl = static_cast(num_landmarks);
+ const int sqrt_num_landmarks = static_cast(std::sqrt(nl) + 0.5);
this->num_small_not_updated_changes++;
if ((num_landmarks < 10) ||
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h
index 54125aa80f0..f2f1e77e561 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
-//
+//
//
// Author(s) : Idit Haran
@@ -22,106 +22,105 @@
#define CGAL_ARR_TRIANGULATION_POINT_LOCATION_FUNCTIONS_H
/*! \file
-* Member-function definitions for the Arr_triangulation_point_location
-* class.
+* Member-function definitions for the
+* Arr_triangulation_point_location class.
*/
-//#define CGAL_TRG_DEBUG
+// #define CGAL_TRG_DEBUG
#ifdef CGAL_TRG_DEBUG
- #define CGAL_TRG_PRINT_DEBUG(expr) std::cout << expr << std::endl
+ #define CGAL_TRG_PRINT_DEBUG(expr) std::cout << expr << std::endl
#else
- #define CGAL_TRG_PRINT_DEBUG(expr)
+ #define CGAL_TRG_PRINT_DEBUG(expr)
#endif
namespace CGAL {
+template
+typename Arr_triangulation_point_location::result_type
+Arr_triangulation_point_location::
+locate_in_unbounded(const Point_2& p) const
+{
+ CGAL_TRG_PRINT_DEBUG("unbounded face");
+
+ //! \todo Here we assume that there is only one unbounded face.
+ Face_const_handle face_found = this->arrangement()->unbounded_faces_begin();
+
+ // Check whether the query point coincides with any of the isolated
+ // vertices contained inside this face.
+ typename Traits_adaptor_2::Equal_2 equal = m_traits->equal_2_object();
+ Isolated_vertex_const_iterator iso_verts_it;
+ for (iso_verts_it = face_found->isolated_vertices_begin();
+ iso_verts_it != face_found->isolated_vertices_end(); ++iso_verts_it)
+ {
+ if (equal (p, iso_verts_it->point())) {
+ Vertex_const_handle vh = iso_verts_it;
+ return make_result(vh);
+ }
+ }
+ return make_result(face_found);
+}
+
//-----------------------------------------------------------------------------
// Locate the arrangement feature containing the given point.
//
-template
-typename Arr_triangulation_point_location::result_type
-Arr_triangulation_point_location::locate(const Point_2& p) const
+template
+typename Arr_triangulation_point_location::result_type
+Arr_triangulation_point_location::locate(const Point_2& p)
+ const
{
- CGAL_TRG_PRINT_DEBUG("------ locate point "<< p);
-
- //init output
- Face_const_handle face_found = this->arrangement()->unbounded_face();
+ CGAL_TRG_PRINT_DEBUG("------ locate point " << p);
//locate in the CDT
- CDT_Point p1 = static_cast (p);
+ CDT_Point p1 = static_cast (p);
//locate point
int li;
CDT_Locate_type cdt_lt;
- CDT_Face_handle fh = cdt.locate(p1,cdt_lt,li);
+ CDT_Face_handle fh = m_cdt.locate(p1, cdt_lt, li);
switch (cdt_lt) {
case CDT::OUTSIDE_AFFINE_HULL:
case CDT::OUTSIDE_CONVEX_HULL:
- {
- CGAL_TRG_PRINT_DEBUG("unbounded face" );
-
- // we still have to check whether the query point coincides with
- // any of the isolated vertices contained inside this face.
- Isolated_vertex_const_iterator iso_verts_it;
- typename Traits_adaptor_2::Equal_2 equal = traits->equal_2_object();
-
- for (iso_verts_it = face_found->isolated_vertices_begin();
- iso_verts_it != face_found->isolated_vertices_end(); ++iso_verts_it)
- {
- if (equal (p, iso_verts_it->point())) {
- Vertex_const_handle vh = iso_verts_it;
- return make_result(vh);
- }
- }
-
- return make_result(face_found);
- }
+ return locate_in_unbounded(p);
case CDT::VERTEX:
- {
- //get the vertex from li, which is the index of the vertex
- Vertex_const_handle vertex_found = fh->vertex(li)->info();
- CGAL_TRG_PRINT_DEBUG("vertex: "<< vertex_found->point());
- return make_result(vertex_found);
- }
+ //get the vertex from li, which is the index of the vertex
+ CGAL_TRG_PRINT_DEBUG("vertex: "<< fh->vertex(li)->info()->point());
+ return make_result(fh->vertex(li)->info());
case CDT::EDGE:
- {
- CGAL_TRG_PRINT_DEBUG("locate type = edge"<target()->point());
- }
- } while (++circ1 != circ1_done);
-
- return make_result(edeg_found);
- }
- //if the edge is not a constrained - its not an edge of the
- //plannar map, which means we're inside of a pm face -
- //lets look at the face as if it was a face case.
- // no break - continue to the face caes
+ Halfedge_const_handle edge_found;
+ do {
+ if (v2_of_edge == (*circ1).source()) {
+ edge_found = circ1;
+ CGAL_TRG_PRINT_DEBUG("edge_found = "
+ << edge_found->source()->point()
+ << " towards "
+ << edge_found->target()->point());
+ }
+ } while (++circ1 != circ1_done);
+ return make_result(edge_found);
}
+ // if the edge is not a constrained - its not an edge of the
+ // plannar map, which means we're inside of a pm face -
+ // lets look at the face as if it was a face case.
+ // no break - continue to the face caes
case CDT::FACE:
break;
@@ -131,78 +130,56 @@ Arr_triangulation_point_location::locate(const Point_2& p) const
CGAL_TRG_PRINT_DEBUG("FACE ");
//get 3 pm vertices of face
- Vertex_const_handle v0 = fh->vertex(0)->info();
+ Vertex_const_handle v0 = fh->vertex(0)->info();
Vertex_const_handle v1 = fh->vertex(1)->info();
Vertex_const_handle v2 = fh->vertex(2)->info();
//the vertices should not be isolated, since we do not insert the
- //isolated vertices as points in the triangulation, only edges
- // (and thus vertices inceident to this edge).
- //in the future it is possible to add isolated vertices to the
+ //isolated vertices as points in the triangulation, only edges
+ // (and thus vertices inceident to this edge).
+ //in the future it is possible to add isolated vertices to the
// triangulation, and then, when found, take its incident_face
CGAL_assertion(!v0->is_isolated());
CGAL_assertion(!v1->is_isolated());
CGAL_assertion(!v2->is_isolated());
- if (v0->is_isolated()) return make_result(v0->face());
- if (v1->is_isolated()) return make_result(v1->face());
- if (v2->is_isolated()) return make_result(v2->face());
+ // if (v0->is_isolated()) return make_result(v0->face());
+ // if (v1->is_isolated()) return make_result(v1->face());
+ // if (v2->is_isolated()) return make_result(v2->face());
- //find the face in the pm correspond to the 3 vertices
- Halfedge_around_vertex_const_circulator havc0 = v0->incident_halfedges();
- Halfedge_around_vertex_const_circulator havc0_done (havc0);
-
- Halfedge_around_vertex_const_circulator havc1 = v1->incident_halfedges();
- Halfedge_around_vertex_const_circulator havc1_done (havc1);
-
- Halfedge_around_vertex_const_circulator havc2 = v2->incident_halfedges();
- Halfedge_around_vertex_const_circulator havc2_done (havc2);
-
- //loop to find face
- bool found = false;
- bool found_unbounded = false;
+ // Find the face in the arrangement that contains the triangle
+ // Loop over the incident vertices of v0, and try to find a ccb that first
+ // contains v1 and then v2 in that order. If such a face does not exists,
+ // the unbounded face contains the triangle.
+ Halfedge_around_vertex_const_circulator havc0 = v0->incident_halfedges();
+ Halfedge_around_vertex_const_circulator havc0_done(havc0);
+ bool found_v2 = false;
+ Halfedge_const_handle he;
do {
- //get face from halfedge
- Face_const_handle f0 = (*havc0).face();
+ bool found_v1 = false;
+ found_v2 = false;
+ he = havc0->twin();
+ Halfedge_const_handle he_done(he);
do {
- Face_const_handle f1 = (*havc1).face();
- if ( f0 == f1 )
- {
- CGAL_TRG_PRINT_DEBUG("f0 == f1");
- do {
- Face_const_handle f2 = (*havc2).face();
- if ( f1 == f2 )
- {
- CGAL_TRG_PRINT_DEBUG("f1 == f2");
- if (face_found != f0) {
- face_found = f0;
- found = true;
- }
- else
- found_unbounded = true;
- }
- } while ((++havc2 != havc2_done) && !found );
+ if (!found_v1) {
+ if (he->target() == v1) found_v1 = true;
}
- } while ((++havc1 != havc1_done)&& !found );
- } while ((++havc0 != havc0_done)&& !found );
+ else if (!found_v2) {
+ if (he->target() == v2) {
+ found_v2 = true;
+ break;
+ }
+ }
+ he = he->next();
+ } while (he != he_done);
+ } while ((++havc0 != havc0_done) && !found_v2);
- if (face_found == this->arrangement()->unbounded_face())
- {
- if (! found_unbounded)
- {
- std::cerr<< "NOT GOOD - face not found" << std::endl;
- //debug - print some more info
- std::cout << "p = "<< p <point()
- <<", v1 = "<< v1->point()
- <<", v2 = "<point() <face() : this->arrangement()->unbounded_faces_begin();
// we still have to check whether the query point coincides with
// any of the isolated vertices contained inside this face.
- Isolated_vertex_const_iterator iso_verts_it;
- typename Traits_adaptor_2::Equal_2 equal = traits->equal_2_object();
-
+ typename Traits_adaptor_2::Equal_2 equal = m_traits->equal_2_object();
+ Isolated_vertex_const_iterator iso_verts_it;
for (iso_verts_it = face_found->isolated_vertices_begin();
iso_verts_it != face_found->isolated_vertices_end(); ++iso_verts_it)
{
@@ -210,7 +187,7 @@ Arr_triangulation_point_location::locate(const Point_2& p) const
Vertex_const_handle vh = iso_verts_it;
return make_result(vh);
}
- }
+ }
return make_result(face_found);
}
@@ -218,33 +195,24 @@ Arr_triangulation_point_location::locate(const Point_2& p) const
//----------------------------------------------------
/*! triangulate the arrangement into a cdt (Constaint Delauney Triangulation):
-go over all halfedges, and insert each halfedge as a constraint to the cdt.
+go over all halfedges, and insert each halfedge as a constraint to the cdt.
*/
-template
-void Arr_triangulation_point_location
-::clear_triangulation ()
-{
- cdt.clear();
-}
+template
+void Arr_triangulation_point_location::clear_triangulation()
+{ m_cdt.clear(); }
//----------------------------------------------------
/*! triangulate the arrangement into a cdt (Constaint Delauney Triangulation):
-go over all halfedges, and insert each halfedge as a constraint to the cdt.
+go over all halfedges, and insert each halfedge as a constraint to the cdt.
*/
-template
-void Arr_triangulation_point_location
-::build_triangulation ()
-{
+template
+void Arr_triangulation_point_location::build_triangulation()
+{
CGAL_TRG_PRINT_DEBUG("build_triangulation");
//Go over the arrangement, and create a triangulation of it
- Edge_const_iterator eit;
-
- eit = this->arrangement()->edges_begin();
-
- for (eit = this->arrangement()->edges_begin();
- eit != this->arrangement()->edges_end(); eit++)
- {
+ Edge_const_iterator eit = this->arrangement()->edges_begin();
+ for (; eit != this->arrangement()->edges_end(); ++eit) {
//get vertices from edge
Vertex_const_handle pm_vh1 = (*eit).source();
Vertex_const_handle pm_vh2 = (*eit).target();
@@ -261,35 +229,31 @@ void Arr_triangulation_point_location
CDT_Point cdt_p2 = static_cast (pm_p2);
//check if source point is equal to destination point
- if (traits->equal_2_object()(pm_p1, pm_p2))
- {
- std::cerr << "WARNING: source point is equal to destination point!!! "
- << pm_p1 << std::endl ;
- CDT_Vertex_handle cdt_vh1 = cdt.insert(cdt_p1);
+ if (m_traits->equal_2_object()(pm_p1, pm_p2)) {
+ std::cerr << "WARNING: source point is equal to destination point!!! "
+ << pm_p1 << std::endl ;
+ CDT_Vertex_handle cdt_vh1 = m_cdt.insert(cdt_p1);
cdt_vh1->info() = pm_vh1;
continue;
}
//insert vertices to the CDT
- CDT_Vertex_handle cdt_vh1 = cdt.insert(cdt_p1);
- CDT_Vertex_handle cdt_vh2 = cdt.insert(cdt_p2);
+ CDT_Vertex_handle cdt_vh1 = m_cdt.insert(cdt_p1);
+ CDT_Vertex_handle cdt_vh2 = m_cdt.insert(cdt_p2);
//connect new CDT vertex with Pm vertex
cdt_vh1->info() = pm_vh1;
cdt_vh2->info() = pm_vh2;
//add constraint from the two points
- cdt.insert_constraint(cdt_vh1, cdt_vh2);
+ m_cdt.insert_constraint(cdt_vh1, cdt_vh2);
//print
- CGAL_TRG_PRINT_DEBUG("source = " << pm_p1 << " , target = " << pm_p2 );
+ CGAL_TRG_PRINT_DEBUG("source = " << pm_p1 << " , target = " << pm_p2);
}
- //the triangulation is now updated
- updated_cdt = true;
-
- CGAL_assertion(cdt.is_valid());
- CGAL_TRG_PRINT_DEBUG("finished updating the CDT " );
+ CGAL_assertion(m_cdt.is_valid());
+ CGAL_TRG_PRINT_DEBUG("finished updating the CDT ");
}
} //namespace CGAL
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h
index dd108d7a6b4..f5b3b77c348 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h
@@ -14,7 +14,7 @@
//
// $URL: $
// $Id: $
-//
+//
//
// Author(s) : Efi Fogel
@@ -33,6 +33,7 @@
#include
+#include
#include
#ifdef CGAL_CFG_BOOST_VARIANT_SWAP_BUG
@@ -96,19 +97,19 @@ struct Arr_point_location_result {
static
inline Type make_result(T t) { return Type(t); }
- inline
+ inline
static
boost::optional empty_optional_result() { return boost::optional(); }
template
const T* assign(const Type& obj) const { return boost::get(&obj); }
#endif // CGAL_ARR_POINT_LOCATION_VERSION < 2
-
- //this one is only to remove warnings in functions
+
+ //this one is only to remove warnings in functions
static
- inline Type default_result(){
+ inline Type default_result(){
CGAL_error_msg("This functions should never have been called!");
- return Type();
+ return Type();
}
};
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h
index c690f63cfbd..1a04d7df16f 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h
@@ -2683,6 +2683,50 @@ namespace CGAL {
Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const
{ return Compare_y_near_boundary_2(*this); }
+ /*! A functor that indicates whether a geometric object lies on the
+ * vertical identification arc.
+ */
+ class Is_on_y_identification_2 {
+ protected:
+ typedef Arr_polyline_traits_2 Polyline_traits_2;
+ /*! The polyline traits (in case it has state) */
+ const Polyline_traits_2& m_poly_traits;
+
+ public:
+ /*! Constructor. */
+ Is_on_y_identification_2(const Polyline_traits_2& traits) :
+ m_poly_traits(traits)
+ {}
+
+ /*! Determine whether a point lies in the vertical boundary.
+ * \param p the point.
+ * \return a Boolean indicating whether p lies in the vertical boundary.
+ */
+ bool operator()(const Point_2& p) const
+ {
+ const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2();
+ return seg_traits->is_on_y_identification_2_object()(p);
+ }
+
+ /*! Determine whether an x-monotone curve lies in the vertical boundary.
+ * \param xcv the x-monotone curve.
+ * \return a Boolean indicating whether xcv lies in the vertical boundary.
+ */
+ bool operator()(const X_monotone_curve_2& xcv) const
+ {
+ const Segment_traits_2* seg_traits = m_poly_traits.segment_traits_2();
+ typename X_monotone_curve_2::Segment_const_iterator it;
+ for (it = xcv.begin_segments(); it != xcv.end_segments(); ++it)
+ if (! seg_traits->is_on_y_identification_2_object()(*it))
+ return false;
+ return true;
+ }
+ };
+
+ /*! Obtain a Is_on_y_identification_2 function object */
+ Is_on_y_identification_2 is_on_y_identification_2_object() const
+ { return Is_on_y_identification_2(*this); }
+
private:
/*
* Roadmap: locate() should return an iterator to the located segment
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h
index 0dc951f41cb..3433064bcec 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h
@@ -57,26 +57,26 @@
namespace CGAL {
// Forward declaration:
-template
+template
class Arrangement_on_surface_2;
/*! This class handles the topology for arrangements of great spherical
* arcs on the sphere embedded on 2D parametric surdace.
*/
-template >
+template >
class Arr_spherical_topology_traits_2 {
public:
///! \name The geometry-traits types.
//@{
- typedef GeomTraits Geometry_traits_2;
+ typedef GeomTraits_ Geometry_traits_2;
typedef typename Geometry_traits_2::Point_2 Point_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
//@}
///! \name The DCEL types.
//@{
- typedef T_Dcel Dcel;
+ typedef Dcel_ Dcel;
typedef typename Dcel::Size Size;
typedef typename Dcel::Vertex Vertex;
typedef typename Dcel::Halfedge Halfedge;
@@ -129,32 +129,34 @@ public:
* An auxiliary structure for rebinding the topology traits with a new
* geometry-traits class and a new DCEL class.
*/
- template
- struct rebind
- {
- typedef Arr_spherical_topology_traits_2 other;
+ template
+ struct rebind {
+ typedef Arr_spherical_topology_traits_2 other;
};
private:
-
//! A container of boundary vertices.
struct Vertex_key_comparer {
/*! Construct default */
- Vertex_key_comparer() : m_traits(NULL) {}
+ Vertex_key_comparer() : m_geom_traits(NULL) {}
/*! Construct */
- Vertex_key_comparer(const Traits_adaptor_2* traits) : m_traits(traits) {}
- const Traits_adaptor_2* m_traits;
+ Vertex_key_comparer(const Traits_adaptor_2* geom_traits) :
+ m_geom_traits(geom_traits)
+ {}
+
+ const Traits_adaptor_2* m_geom_traits;
+
bool operator()(const Point_2& p1, const Point_2& p2) const
{
- return (m_traits->compare_y_on_boundary_2_object()(p1, p2) ==
+ return (m_geom_traits->compare_y_on_boundary_2_object()(p1, p2) ==
SMALLER);
}
};
//! \todo define the key to be 'const Point_2*'.
- typedef std::map Vertex_map;
- typedef std::pair Vertex_value;
+ typedef std::map Vertex_map;
+ typedef std::pair Vertex_value;
protected:
// Data members:
@@ -174,14 +176,14 @@ protected:
Vertex_map m_boundary_vertices;
//! The geometry-traits adaptor.
- const Traits_adaptor_2* m_traits;
+ const Traits_adaptor_2* m_geom_traits;
- // Inidicates whether the traits object should evetually be freed.
- bool m_own_traits;
+ //! Inidicates whether the traits object should evetually be freed.
+ bool m_own_geom_traits;
// Copy constructor and assignment operator - not supported.
- Arr_spherical_topology_traits_2(const Self &);
- Self& operator=(const Self &);
+ Arr_spherical_topology_traits_2(const Self&);
+ Self& operator=(const Self&);
public:
///! \name Construction methods.
@@ -190,11 +192,14 @@ public:
/*! Default constructor. */
Arr_spherical_topology_traits_2();
- /*! Constructor with a geometry-traits class.
+ /*! Constructor from a geometry-traits object.
* \param traits the traits.
*/
Arr_spherical_topology_traits_2(const Geometry_traits_2* traits);
+ /*! Destructor */
+ ~Arr_spherical_topology_traits_2();
+
/*! Assign the contents of another topology-traits class.
* \param other the other spherical topology-traits.
*/
@@ -288,18 +293,16 @@ public:
const Vertex* north_pole() const { return m_north_pole; }
/*! Obtain the north pole (non-const version). */
- Vertex* north_pole()
- { return m_north_pole; }
+ Vertex* north_pole() { return m_north_pole; }
/*! Obtain a vertex on the line of discontinuity that corresponds to
* the given curve-end (or return NULL if no such vertex exists).
*/
Vertex* discontinuity_vertex(const X_monotone_curve_2 xc, Arr_curve_end ind)
{
- Point_2 key;
- key = (ind == ARR_MIN_END) ?
- m_traits->construct_min_vertex_2_object()(xc) :
- m_traits->construct_max_vertex_2_object()(xc);
+ Point_2 key = (ind == ARR_MIN_END) ?
+ m_geom_traits->construct_min_vertex_2_object()(xc) :
+ m_geom_traits->construct_max_vertex_2_object()(xc);
typename Vertex_map::iterator it = m_boundary_vertices.find(key);
return (it != m_boundary_vertices.end()) ? it->second : NULL;
}
@@ -308,27 +311,27 @@ public:
private:
/// \name Auxiliary type definitions.
//@{
- typedef Arrangement_on_surface_2 Arr;
+ typedef Arrangement_on_surface_2 Arr;
// Type definition for the constuction sweep-line visitor.
typedef Arr_construction_subcurve CSubcurve;
- typedef Arr_construction_event
+ typedef Arr_construction_event
CEvent;
- typedef Arr_spherical_construction_helper CHelper;
// Type definition for the basic insertion sweep-line visitor.
typedef Arr_basic_insertion_traits_2 BInsTraits;
typedef Arr_construction_subcurve BISubcurve;
- typedef Arr_construction_event BIEvent;
- typedef Arr_spherical_insertion_helper
+ typedef Arr_construction_event BIEvent;
+ typedef Arr_spherical_insertion_helper
BIHelper;
// Type definition for the insertion sweep-line visitor.
typedef Arr_insertion_traits_2 InsTraits;
typedef Arr_construction_subcurve ISubcurve;
typedef Arr_construction_event IEvent;
- typedef Arr_spherical_insertion_helper
+ typedef Arr_spherical_insertion_helper
IHelper;
// Type definition for the batched point-location sweep-line visitor.
@@ -340,17 +343,27 @@ private:
typedef Arr_spherical_vert_decomp_helper VdHelper;
// Type definition for the overlay sweep-line visitor.
- template
+ template
struct _Overlay_helper :
- public Arr_spherical_overlay_helper, Arr>,
- Arr_overlay_subcurve >
+ public Arr_spherical_overlay_helper
+ , Arr>,
+ Arr_overlay_subcurve >
{
- typedef Arr_spherical_overlay_helper, Arr>,
- Arr_overlay_subcurve > Base;
+ typedef ExGeomTraits_ Ex_geomt_raits;
+ typedef ArrangementA_ Arrangement_a;
+ typedef ArrangementB_ Arrangement_b;
+
+ typedef Arr_overlay_subcurve Overlay_subcurve;
+ typedef Arr_construction_event
+ Construction_event;
+
+ typedef Arr_spherical_overlay_helper
+ Base;
typedef typename Base::Traits_2 Traits_2;
typedef typename Base::Arrangement_red_2 Arrangement_red_2;
@@ -360,8 +373,9 @@ private:
typedef typename Base::Subcurve Subcurve;
typedef typename Base::Construction_helper Construction_helper;
- _Overlay_helper(const ArrangementA_* arrA, const ArrangementB_* arrB) :
- Base(arrA, arrB) {}
+ _Overlay_helper(const Arrangement_a* arr_a, const Arrangement_b* arr_b) :
+ Base(arr_a, arr_b)
+ {}
};
//@}
@@ -381,16 +395,16 @@ public:
typedef Arr_basic_insertion_sl_visitor
Sweep_line_non_intersecting_insertion_visitor;
- template
+ template
struct Sweep_line_batched_point_location_visitor :
public Arr_batched_pl_sl_visitor
{
- typedef OutputIterator_ Output_iterator;
+ typedef OutputIterator_ Output_iterator;
- typedef Arr_batched_pl_sl_visitor Base;
- typedef typename Base::Traits_2 Traits_2;
- typedef typename Base::Event Event;
- typedef typename Base::Subcurve Subcurve;
+ typedef Arr_batched_pl_sl_visitor Base;
+ typedef typename Base::Traits_2 Traits_2;
+ typedef typename Base::Event Event;
+ typedef typename Base::Subcurve Subcurve;
Sweep_line_batched_point_location_visitor(const Arr* arr,
Output_iterator& oi) :
@@ -398,16 +412,16 @@ public:
{}
};
- template
+ template
struct Sweep_line_vertical_decomposition_visitor :
public Arr_vert_decomp_sl_visitor
{
- typedef OutputIterator_ Output_iterator;
+ typedef OutputIterator_ Output_iterator;
typedef Arr_vert_decomp_sl_visitor Base;
- typedef typename Base::Traits_2 Traits_2;
- typedef typename Base::Event Event;
- typedef typename Base::Subcurve Subcurve;
+ typedef typename Base::Traits_2 Traits_2;
+ typedef typename Base::Event Event;
+ typedef typename Base::Subcurve Subcurve;
Sweep_line_vertical_decomposition_visitor(const Arr* arr,
Output_iterator* oi) :
@@ -415,41 +429,44 @@ public:
{}
};
- template
+ template
struct Sweep_line_overlay_visitor :
public Arr_overlay_sl_visitor
- <_Overlay_helper,
- ArrangementA_, ArrangementB_>, OverlayTraits_>
+ <_Overlay_helper,
+ ArrangementA_, ArrangementB_>, OverlayTraits_>
{
- typedef ArrangementA_ ArrangementA_2;
- typedef ArrangementB_ ArrangementB_2;
+ typedef ArrangementA_ Arrangement_a;
+ typedef ArrangementB_ Arrangement_b;
typedef Arr Arrangement_result_2;
typedef OverlayTraits_ Overlay_traits;
- typedef Arr_overlay_traits_2 Geom_ovl_traits_2;
+ typedef Arr_overlay_traits_2 Geom_ovl_traits_2;
- typedef _Overlay_helper
- Ovl_helper;
+ typedef _Overlay_helper
+ Ovl_helper;
- typedef Arr_overlay_sl_visitor Base;
+ typedef Arr_overlay_sl_visitor Base;
- typedef typename Base::Traits_2 Traits_2;
- typedef typename Base::Event Event;
- typedef typename Base::Subcurve Subcurve;
+ typedef typename Base::Traits_2 Traits_2;
+ typedef typename Base::Event Event;
+ typedef typename Base::Subcurve Subcurve;
- Sweep_line_overlay_visitor(const ArrangementA_2* arrA,
- const ArrangementB_2* arrB,
+ Sweep_line_overlay_visitor(const Arrangement_a* arr_a,
+ const Arrangement_b* arr_b,
Arrangement_result_2* arr_res,
Overlay_traits* overlay_tr) :
- Base(arrA, arrB, arr_res, overlay_tr)
+ Base(arr_a, arr_b, arr_res, overlay_tr)
{}
};
typedef Arr_inc_insertion_zone_visitor Zone_insertion_visitor;
- typedef Arr_naive_point_location Default_point_location_strategy;
+ typedef Arr_naive_point_location Default_point_location_strategy;
+ typedef Arr_naive_point_location Default_vertical_ray_shooting_strategy;
//@}
///! \name Topology-traits methods.
@@ -494,8 +511,11 @@ public:
* will form a hole in the original face.
*/
std::pair
- 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:
return (std::make_pair(true, true));
@@ -632,7 +652,6 @@ public:
//@}
protected:
-
/// \name Auxiliary functions.
//@{
@@ -643,17 +662,15 @@ protected:
* \pre v is a valid boundary.
* \return The curve that induces v.
*/
- const X_monotone_curve_2& _curve(const Vertex* v,
- Arr_curve_end& ind) const;
+ const X_monotone_curve_2& _curve(const Vertex* v, Arr_curve_end& ind) const;
/*! Return the halfedge, the target vertex of which is given, that is
* the predecessor of a halfedge, the curve of which is given, that is about
* to be inserted into the dcel.
*/
- Halfedge *
- _locate_around_vertex_on_discontinuity(Vertex* v,
- const X_monotone_curve_2& xc,
- Arr_curve_end ind) const;
+ Halfedge* _locate_around_vertex_on_discontinuity(Vertex* v,
+ const X_monotone_curve_2& xc,
+ Arr_curve_end ind) const;
/*! Return the halfedge, the target vertex of which is a given pole,
* that is the predecessor of a halfedge, the curve of which is given, that
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h
index 8adac1b9af1..b4a484d8f90 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h
@@ -14,9 +14,10 @@
//
// $URL$
// $Id$
-//
+//
//
// Author(s) : Ron Wein
+// Efi Fogel
#ifndef CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H
#define CGAL_ARR_BOUNDED_PLANAR_TOPOLOGY_TRAITS_2_IMPL_H
@@ -31,24 +32,22 @@ namespace CGAL {
//-----------------------------------------------------------------------------
// Assign the contents of another topology-traits class.
//
-template
-void Arr_bounded_planar_topology_traits_2::assign
- (const Self& other)
+template
+void Arr_bounded_planar_topology_traits_2::
+assign(const Self& other)
{
// Assign the base class.
- Base::assign (other);
+ Base::assign(other);
// Update the topology-traits properties after the DCEL have been updated.
dcel_updated();
-
- return;
}
//-----------------------------------------------------------------------------
// Initialize an empty DCEL structure.
//
-template
-void Arr_bounded_planar_topology_traits_2::init_dcel ()
+template
+void Arr_bounded_planar_topology_traits_2::init_dcel()
{
// Clear the current DCEL.
this->m_dcel.delete_all();
@@ -56,34 +55,26 @@ void Arr_bounded_planar_topology_traits_2::init_dcel ()
// Create the unbounded face.
unb_face = this->m_dcel.new_face();
- unb_face->set_unbounded (true);
- unb_face->set_fictitious (false);
-
- return;
+ unb_face->set_unbounded(true);
+ unb_face->set_fictitious(false);
}
//-----------------------------------------------------------------------------
// Make the necessary updates after the DCEL structure have been updated.
//
-template
-void Arr_bounded_planar_topology_traits_2::dcel_updated ()
+template
+void Arr_bounded_planar_topology_traits_2::dcel_updated()
{
// Go over the DCEL faces and locate the unbounded face.
- typename Dcel::Face_iterator fit;
-
unb_face = NULL;
- for (fit = this->m_dcel.faces_begin();
- fit != this->m_dcel.faces_end(); ++fit)
- {
- if (fit->is_unbounded())
- {
+ typename Dcel::Face_iterator fit = this->m_dcel.faces_begin();
+ for (; fit != this->m_dcel.faces_end(); ++fit) {
+ if (fit->is_unbounded()) {
unb_face = &(*fit);
break;
}
}
- CGAL_assertion (unb_face != NULL);
-
- return;
+ CGAL_assertion(unb_face != NULL);
}
} //namespace CGAL
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h
index dde38441972..059ccaf8808 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h
@@ -50,12 +50,11 @@ namespace CGAL {
* A base topology-traits class that encapsulates the embedding of 2D
* arrangements of bounded or unbounded curves on the plane.
*/
-template >
+template >
class Arr_planar_topology_traits_base_2
{
public:
-
///! \name The geometry-traits types.
//@{
typedef GeomTraits_ Geometry_traits_2;
@@ -75,54 +74,50 @@ public:
typedef typename Dcel::Isolated_vertex Isolated_vertex;
//@}
- typedef Arr_planar_topology_traits_base_2 Self;
+ typedef Arr_planar_topology_traits_base_2
+ Self;
protected:
-
- typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2;
+ typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2;
// Data members:
- Dcel m_dcel; // The DCEL.
+ Dcel m_dcel; // The DCEL.
- const Traits_adaptor_2* traits; // The geometry-traits adaptor.
- bool own_traits; // Inidicate whether we should evetually
- // free the traits object.
+ const Traits_adaptor_2* m_geom_traits; // The geometry-traits adaptor.
+ bool m_own_geom_traits; // Inidicate whether we should
+ // evetually free the traits object.
// Copy constructor and assignment operator - not supported.
- Arr_planar_topology_traits_base_2 (const Self& );
- Self& operator= (const Self& );
+ Arr_planar_topology_traits_base_2(const Self&);
+ Self& operator=(const Self&);
public:
-
///! \name Construction methods.
//@{
/*! Default constructor. */
- Arr_planar_topology_traits_base_2 () :
- own_traits (true)
- {
- traits = new Traits_adaptor_2;
- }
+ Arr_planar_topology_traits_base_2() :
+ m_own_geom_traits(true)
+ { m_geom_traits = new Traits_adaptor_2; }
/*! Constructor with a geometry-traits class. */
- Arr_planar_topology_traits_base_2 (const Geometry_traits_2 * geom_traits) :
- own_traits (false)
- {
- traits = static_cast(geom_traits);
- }
+ Arr_planar_topology_traits_base_2 (const Geometry_traits_2* geom_traits) :
+ m_own_geom_traits(false)
+ { m_geom_traits = static_cast(geom_traits); }
/*! Assign the contents of another topology-traits class. */
- void assign (const Self& other);
+ void assign(const Self& other);
/*! Destructor. */
- virtual ~Arr_planar_topology_traits_base_2 ()
+ virtual ~Arr_planar_topology_traits_base_2()
{
// Clear the DCEL.
m_dcel.delete_all();
- if (own_traits)
- delete traits;
+ if (m_own_geom_traits && (m_geom_traits != NULL)) {
+ delete m_geom_traits;
+ m_geom_traits = NULL;
+ }
}
//@}
@@ -130,16 +125,10 @@ public:
//@{
/*! Get the DCEL (const version). */
- const Dcel& dcel () const
- {
- return (m_dcel);
- }
+ const Dcel& dcel() const { return m_dcel; }
/*! Get the DCEL (non-const version). */
- Dcel& dcel ()
- {
- return (m_dcel);
- }
+ Dcel& dcel() { return (m_dcel); }
/*!
* Receive a notification on the creation of a new boundary vertex that
@@ -150,11 +139,11 @@ public:
* \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 *,
- const X_monotone_curve_2& ,
- Arr_curve_end,
- Arr_parameter_space /* ps_x */,
- Arr_parameter_space /* ps_y */)
+ void notify_on_boundary_vertex_creation(Vertex*,
+ const X_monotone_curve_2& ,
+ Arr_curve_end,
+ Arr_parameter_space /* ps_x */,
+ Arr_parameter_space /* ps_y */)
{
// In the planar-topology traits this function should never be invoked:
return;
@@ -170,9 +159,11 @@ 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& swap_predecessors) const {
+ bool
+ let_me_decide_the_outer_ccb(std::pair /* signs1 */,
+ std::pair /* signs2 */,
+ bool& swap_predecessors) const
+ {
swap_predecessors = false;
return false;
}
@@ -188,11 +179,14 @@ public:
* will form a hole in the original face.
*/
std::pair
- 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 /* signs1 */,
+ std::pair /* signs2 */) const
+ {
// In case of a planar topology, connecting two vertices on the same
// inner CCB closes a new face that becomes a hole in the original face:
- return (std::make_pair (true, true));
+ return (std::make_pair(true, true));
}
/*!
@@ -203,7 +197,7 @@ public:
* \param f must not be fictitious, and v must not lie at infinity.
* \return Whether p is contained in f's interior.
*/
- bool is_in_face (const Face *f, const Point_2& p, const Vertex *v) const;
+ bool is_in_face(const Face* f, const Point_2& p, const Vertex* v) const;
//@}
/// \name Additional accessors, specialized for this topology-traits class.
@@ -222,8 +216,8 @@ public:
* \param v The vertex.
* \return The result of the comparison of the x-coordinates of p and v.
*/
- virtual Comparison_result compare_x (const Point_2& p,
- const Vertex* v) const = 0;
+ virtual Comparison_result compare_x(const Point_2& p,
+ const Vertex* v) const = 0;
/*!
* Compare the given vertex (which may lie at infinity) and the given point.
@@ -242,8 +236,8 @@ public:
* \pre p should lie in the x-range of the given edge.
* \return The relative y-position of the point p and the edge.
*/
- virtual Comparison_result compare_y_at_x (const Point_2& p,
- const Halfedge* he) const = 0;
+ virtual Comparison_result compare_y_at_x(const Point_2& p,
+ const Halfedge* he) const = 0;
//@}
};
@@ -254,43 +248,41 @@ public:
//-----------------------------------------------------------------------------
// Assign the contents of another topology-traits class.
//
-template
-void Arr_planar_topology_traits_base_2::assign
- (const Self& other)
+template
+void
+Arr_planar_topology_traits_base_2::assign(const Self& other)
{
// Clear the current DCEL and duplicate the other DCEL.
m_dcel.delete_all();
- m_dcel.assign (other.m_dcel);
+ m_dcel.assign(other.m_dcel);
// Take care of the traits object.
- if (own_traits && traits != NULL)
- delete traits;
+ if (m_own_geom_traits && (m_geom_traits != NULL)) {
+ delete m_geom_traits;
+ m_geom_traits = NULL;
+ }
- if (other.own_traits)
- traits = new Traits_adaptor_2;
- else
- traits = other.traits;
- own_traits = other.own_traits;
+ if (other.m_own_geom_traits) m_geom_traits = new Traits_adaptor_2;
+ else m_geom_traits = other.m_geom_traits;
- return;
+ m_own_geom_traits = other.m_own_geom_traits;
}
//-----------------------------------------------------------------------------
// Determine whether the given vertex lies in the interior of the given face.
//
-template
+template
bool Arr_planar_topology_traits_base_2::
-is_in_face(const Face *f, const Point_2& p, const Vertex *v) const
+is_in_face(const Face* f, const Point_2& p, const Vertex* v) const
{
- CGAL_precondition (v == NULL || ! v->has_null_point());
- CGAL_precondition (v == NULL ||
- traits->equal_2_object()(p, v->point()));
+ CGAL_precondition((v == NULL) || ! v->has_null_point());
+ CGAL_precondition((v == NULL) ||
+ m_geom_traits->equal_2_object()(p, v->point()));
// In case the face is unbounded and has no outer ccbs, this is the single
// unbounded face of an arrangement of bounded curves. This face obviously
// contains any point in its interior.
- if (f->is_unbounded() && f->number_of_outer_ccbs() == 0)
- return (true);
+ if (f->is_unbounded() && (f->number_of_outer_ccbs() == 0)) return true;
// Keep a counter of the number of x-monotone curves that intersect an upward
// vertical emanating from p (except for some degenerate cases that are
@@ -302,7 +294,7 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const
// We begin by comparing p to the source vertex of the first halfedge.
// Note that if p coincides with this vertex, p is obviously not in the
// interior of the component.
- const Halfedge *first = *(f->outer_ccbs_begin());
+ const Halfedge* first = *(f->outer_ccbs_begin());
// Some left ends of curves may not yet have the curve assigned,
@@ -317,34 +309,31 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const
}
- const Halfedge *curr = first;
- Comparison_result res_source;
- Comparison_result res_target;
- Comparison_result res_y_at_x;
+ const Halfedge* curr = first;
+ Comparison_result res_source;
+ Comparison_result res_target;
+ Comparison_result res_y_at_x;
- if (curr->opposite()->vertex() == v)
- return (false);
+ if (curr->opposite()->vertex() == v) return false;
- res_source = compare_xy (p, curr->opposite()->vertex());
+ res_source = compare_xy(p, curr->opposite()->vertex());
- do
- {
+ do {
// Compare p to the target vertex of the current halfedge.
// If the vertex v associated with p (if v is given and is not NULL)
// on the boundary of the component, p is obviously not in the interior
// the component.
- if (curr->vertex() == v)
- return (false);
+ if (curr->vertex() == v) return false;
// We jump over vertices at TOP/BOTTOM that do not yet have a curve
- if( curr->vertex()->parameter_space_in_x()==ARR_INTERIOR
- && curr->has_null_curve()
- && curr->next()->has_null_curve()){
+ if ((curr->vertex()->parameter_space_in_x() == ARR_INTERIOR) &&
+ curr->has_null_curve() && curr->next()->has_null_curve())
+ {
curr = curr->next();
continue;
}
- res_target = compare_xy (p, curr->vertex());
+ res_target = compare_xy(p, curr->vertex());
// In case the current halfedge belongs to an "antenna", namely its
// incident face is the same as its twin's, we can simply skip it
@@ -361,19 +350,16 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const
// (by "tilted" we mean the angle it forms with the x-axis is
// PI/2 + epsilon, where epsilon is arbitrarily small), then we hit
// the x-monotone curve associated with curr once.
- if (res_source != res_target)
- {
- res_y_at_x = compare_y_at_x (p, curr);
+ if (res_source != res_target) {
+ res_y_at_x = compare_y_at_x(p, curr);
- if (res_y_at_x == SMALLER)
- {
- n_ray_intersections++;
+ if (res_y_at_x == SMALLER) {
+ ++n_ray_intersections;
}
- else if (res_y_at_x == EQUAL)
- {
+ else if (res_y_at_x == EQUAL) {
// In this case p lies on the current edge, so it is obviously not
// contained in the interior of the component.
- return (false);
+ return false;
}
}
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h
index d30bed1ec27..85d273dc88f 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel).
+// Copyright (c) 2007,2009,2010,2011,2013 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
-//
+//
// Author(s) : Baruch Zukerman
// Ron Wein
// Efi Fogel
@@ -49,6 +49,7 @@ public:
typedef Sweep_line_empty_visitor Base_visitor;
typedef typename Base_visitor::Event Event;
typedef typename Base_visitor::Subcurve Subcurve;
+ typedef typename Event::Subcurve_iterator Subcurve_iterator;
protected:
@@ -56,16 +57,16 @@ protected:
// Data members:
//! The topology-traits class.
- const Topology_traits * m_top_traits;
+ const Topology_traits* m_top_traits;
//! The unbounded arrangement face.
- Face_const_handle m_unb_face;
+ Face_const_handle m_spherical_face;
public:
/*! Constructor.
* \param arr The arrangement.
*/
- Arr_spherical_batched_pl_helper(const Arrangement_2 *arr) :
+ Arr_spherical_batched_pl_helper(const Arrangement_2* arr) :
m_top_traits(arr->topology_traits())
{}
@@ -74,22 +75,64 @@ public:
/*! A notification issued before the sweep process starts. */
void before_sweep()
- {
- // Get the unbounded face.
- m_unb_face = Face_const_handle(m_top_traits->unbounded_face());
- }
+ { m_spherical_face = Face_const_handle(m_top_traits->spherical_face()); }
/*! A notification invoked after the sweep-line finishes handling the given
* event.
*/
- void after_handle_event(Event * ) { return; }
+ void after_handle_event(Event* event) {
+
+ if (event->parameter_space_in_y() == ARR_TOP_BOUNDARY) {
+ Arr_curve_end ind = ((event->number_of_left_curves() == 0) &&
+ (event->number_of_right_curves() != 0)) ?
+ ARR_MIN_END : ARR_MAX_END;
+ Subcurve_iterator it, nit, it_end;
+ if (ind == ARR_MIN_END) {
+ it = nit = event->right_curves_begin();
+ it_end = event->right_curves_end();
+ } else {
+ it = nit = event->left_curves_begin();
+ it_end = event->left_curves_end();
+ }
+
+ ++nit;
+ if (it != it_end) {
+ while (nit != it_end) {
+ ++it;
+ ++nit;
+ }
+ }
+ const Subcurve* sc = *it;
+ // pick the one facing the top right corner now
+ m_spherical_face = sc->last_curve().halfedge_handle()->face();
+ }
+
+ // EBEB 2013-12-012 do similar stuff for right boundary
+ if (event->parameter_space_in_y() == ARR_RIGHT_BOUNDARY) {
+ Subcurve_iterator it, nit, it_end;
+ it = nit = event->left_curves_begin();
+ it_end = event->left_curves_end();
+
+ ++nit;
+ if (it != it_end) {
+ while (nit != it_end) {
+ ++it;
+ ++nit;
+ }
+ }
+ const Subcurve* sc = *it;
+ // pick the one facing the top right corner now
+ CGAL_assertion(sc->last_curve().halfedge_handle()->direction() == ARR_LEFT_TO_RIGHT);
+ m_spherical_face = sc->last_curve().halfedge_handle()->face();
+ }
+
+
+ return;
+ }
//@}
- /*! Get the current top face. */
- Face_const_handle top_face() const
- {
- return m_unb_face;
- }
+ /*! Obtain the current top face. */
+ Face_const_handle top_face() const { return m_spherical_face; }
};
} //namespace CGAL
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h
index d4edb223b17..4e53ebca441 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h
@@ -14,7 +14,7 @@
//
// $URL$
// $Id$
-//
+//
// Author(s) : Efi Fogel
// Ron Wein
@@ -29,33 +29,47 @@
namespace CGAL {
/*! \brief constructs default */
-template
+template