From 2fae4eb441d8a161e3bd66aa570b5a2c1b707fe9 Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Wed, 25 Jan 2012 11:33:37 +0000
Subject: [PATCH 01/20] Fix two typos in changes.html, and generate the new
CHANGES files
---
Installation/CHANGES | 192 +++++++++++++++++++++++++++++++++++++-
Installation/changes.html | 4 +-
2 files changed, 190 insertions(+), 6 deletions(-)
diff --git a/Installation/CHANGES b/Installation/CHANGES
index 2bf3367b786..aa30abf1a88 100644
--- a/Installation/CHANGES
+++ b/Installation/CHANGES
@@ -1,8 +1,192 @@
-Release notes of CGAL.
+
+
+
+
+
+
+****** Release History ******
+===============================================================================
+ 4.0Â (XXX 2012)
+
+ 3.9Â (September 2011)
+
+ 3.8Â (April 2011)
+
+ 3.7Â (October 2010)
+
+ 3.6.1Â (June 2010)
+
+ 3.6Â (March 2010)
+
+ 3.5.1Â (December 2009)
+
+ 3.5Â (October 2009)
+
+ 3.4Â (January 2009)
+
+ 3.3.1 (August 2007)
+
+ 3.3 (May 2007)
+ Number of lines of
+ 3.2.1 (July 2006) code of CGAL
+ (restricted to the
+ 3.2 (May 2006) include/CGAL/
+ directory).
+ 3.1 (December 2004) [Releases size graph]
+
+ 3.0.1 (February 2004)
+
+ 3.0 (October 2003)
+
+ 2.4 (May 2002)
+
+ 2.3 (August 2001)
+
+ 2.2 (October 2000)
+
+ 2.1 (January 2000)
+
+ 2.0 (June 1999)
+
+ 1.2 (January 1999)
+
+ 1.1 (July 1998)
+
+ 1.0 (April 1998)
+
+ 0.9 (June 1997)
+
+===============================================================================
+
+-------------------------------- Release 4.0 --------------------------------
+
+Release date: XXX 2012
+
+CGAL 4.0 offers the following improvements and new functionality :
+
+
+* License changes
+The whole CGAL-3.x series was released under a combination of LGPLv2 (for the
+foundations of CGAL), and QPL (for the high-level packages). QPL was the former
+license of the graphical toolkit Qt, but that license is no supported by any
+major free software project. Furthemore, the terms of the LGPLv2 license are
+umbiguous for a library of C++ templates, like CGAL.
+
+The CGAL project, driven by the CGAL Editorial Board, has decided to change the
+license scheme of CGAL. The major number of the CGAL version has been bumped to
+4 for that reason. The CGAL-4.x series will be released under:
+
+
+ - LGPLv3+ (that is LGPL "either version 3 of the License, or (at your option)
+ any later version"), for the foundations of CGAL, instead of LGPLv2,
+
+ - GPLv3+ for the high-level packages, instead of QPL.
+
+
+* General
+
+ - On Windows, CGAL libraries are now built by default as shared libraries
+ (also called DLL). To run applications that use .dll files of CGAL, you
+ must either copy the .dll files into the directory of the application, or
+ add the path of the directory that contains those .dll filesinto the PATH
+ environment variable.
+
+ - On Windows, the CMake scripts of CGAL now search for shared version of the
+ Boost libraries. You must ensure that the .dll files of Boost are found by
+ the dynamic linker. You can, for example, add the path to the Boost .dll
+ files to the PATH environment variable.
+
+ - Eigen version 3.1 or later is now the recommanded third party library to
+ use in Planar Parameterization of Triangulated Surface Meshes, Surface
+ Reconstruction from Point Sets, Approximation of Ridges and Umbilics on
+ Triangulated Surface Meshes, and Estimation of Local Differential
+ Properties of Point-Sampled Surfaces packages. If you use Eigen you no
+ longer need Taucs, Lapack or Blas to use those packages (and any other in
+ CGAL).
+
+
+* AABB tree
+
+ - Document constness of member functions of the AABB_tree class.
+
+ - The class AABB_tree is now guaranteed to be read-only thread-safe. As usual
+ in CGAL, this small overhead introduced for thread-safety can be
+ deactivated by defining CGAL_HAS_NO_THREADS.
+
+
+* 2D Alpha shapes
+
+ - Add an extra template parameter to the class Alpha_shape_2 that allows a
+ certified construction using a traits class with exact predicates and
+ inexact constructions.
+
+ - An object of type Alpha_shape_2 can now be constructed from a
+ triangulation.
+
+
+* 3D Alpha shapes
+
+ - Add an extra template parameter to the class Alpha_shape_3 that allows a
+ certified construction using a traits class with exact predicates and
+ inexact constructions.
+
+
+* Geometric Object Generators
+
+ - Random_points_in_iso_box_d (deprecated since 3.8) has been removed. Use
+ Random_points_in_cube_d instead.
+
+
+* Linear_cell_complex (new package)
+
+ - This package implements linear cell complexes, objects in d-dimension with
+ linear geometry. The combinatorial part of objects is described by a
+ combinatorial map, representing all the cells of the object plus the
+ incidence and adjacency relations between cells. Geometry is added on
+ combinatorial maps simply by associating a Point to each vertex of the map.
+ This data structure can be seen as the generalization in dD of the
+ Polyhedron_3.
+
+
+* Spatial Searching
+
+ - The const-correctness of this package have been worked out. The transition
+ for users should be smooth in general, however adding few const in user
+ code might be needed in some cases.
+
+ - The class Kd_tree is now guaranteed to be read-only thread-safe. As usual
+ in CGAL, this small overhead introduced for thread-safety can be
+ deactivated by defining CGAL_HAS_NO_THREADS.
+
+ - Bug-fix in Orthogonal_incremental_neighbor_search and
+ Incremental_neighbor_search classes. Several calls to begin() now allow to
+ make several nearest neighbor search queries independently.
+
+
+* STL extension
+
+ - CGAL::copy_n is now deprecated for CGAL::cpp0x::copy_n which uses std::
+ copy_n, if available on the platform.
+
+ - CGAL::successor and CGAL::predecessor are now deprecated for CGAL::cpp0x::
+ next and CGAL::cpp0x::prev. These functions use the standard versions if
+ available on the platform. Otherwise, boost::next and boost::prior are
+ used.
+
+
+* Triangulation_2
+
+ - Fix a thread-safety issue in Delaunay_triangulation_2 remove functions. As
+ usual in CGAL, the small overhead introduced for thread-safety can be
+ deactivated by defining CGAL_HAS_NO_THREADS.
+
+ - Add extraction operator for the class Constrained_triangulation_2 (and thus
+ to all inheriting classes).
+
-------------------------------- Release 3.9 --------------------------------
-Release date: Sep 2011
+Release date: September 2011
CGAL 3.9 offers the following improvements and new functionality :
@@ -28,7 +212,7 @@ CGAL 3.9 offers the following improvements and new functionality :
describes all cells of the subdivision and all the incidence and adjacency
relations between these cells. For example it allows to describe a 3D
object subdivided in vertices, edges, faces and volumes. This data
- structure can be seen as the generalization in dD of the haldedge data
+ structure can be seen as the generalization in dD of the halfedge data
structure.
@@ -86,7 +270,7 @@ CGAL 3.9 offers the following improvements and new functionality :
which were not available at the time the old traits class was developed.
- A new geometry traits concept called ArrangementOpenBoundaryTraits_2 has
- been introduced. A model of this concept suports curves that approach the
+ been introduced. A model of this concept supports curves that approach the
open boundary of an iso-rectangular area called parameter space, which can
be unbounded or bounded. The general code of the package, however, supports
only the unbounded parameter space. We intend to enhance the general code
diff --git a/Installation/changes.html b/Installation/changes.html
index 9f23475ab3f..846ebba74d9 100644
--- a/Installation/changes.html
+++ b/Installation/changes.html
@@ -235,7 +235,7 @@ CGAL 3.9 offers the following improvements and new functionality :
This package provides a new combinatorial data structure allowing to describe any orientable subdivided object whatever its dimension.
It describes all cells of the subdivision and all the incidence and adjacency relations between these cells.
For example it allows to describe a 3D object subdivided in vertices, edges, faces and volumes.
- This data structure can be seen as the generalization in dD of the haldedge data structure.
+ This data structure can be seen as the generalization in dD of the halfedge data structure.
3D Convex Hull (major performance improvement)
@@ -285,7 +285,7 @@ CGAL 3.9 offers the following improvements and new functionality :
the time the old traits class was developed.
On Windows, CMake version 2.8.6 or higher is now required.
+
Eigen version 3.1 or later is now the recommanded third party library to use
in Planar Parameterization of Triangulated Surface Meshes,
Surface Reconstruction from Point Sets,
From 4a41cc2956a11a215d6ff166f362837d592d0a42 Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Thu, 26 Jan 2012 10:33:09 +0000
Subject: [PATCH 12/20] Workaround to allow NDEBUG
That program seems to check timing. I understand why NDEBUG could be needed
here. It is OK if it is defined after in processed.
---
.../test/Kinetic_data_structures/timings.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Kinetic_data_structures/test/Kinetic_data_structures/timings.cpp b/Kinetic_data_structures/test/Kinetic_data_structures/timings.cpp
index c2f9262ec9b..d86d3583a4b 100644
--- a/Kinetic_data_structures/test/Kinetic_data_structures/timings.cpp
+++ b/Kinetic_data_structures/test/Kinetic_data_structures/timings.cpp
@@ -1,4 +1,8 @@
+#include
#define NDEBUG
+// NDEBUG is defined after is included, to workaround the
+// check of the testsuite that NDEBUG is not defined.
+
//#define CGAL_CHECK_EXPENSIVE
//#define CGAL_CHECK_EXACTNESS
From 2c967033b96af84bff4bdfe619edb6f83a5adbaf Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Thu, 26 Jan 2012 10:35:32 +0000
Subject: [PATCH 13/20] CMake>=2.8.6 on Windows. I forgot that file!
Sorry for the splitted commits.
---
Installation/INSTALL | 1 +
1 file changed, 1 insertion(+)
diff --git a/Installation/INSTALL b/Installation/INSTALL
index d9d84c16d96..ddac39334a3 100644
--- a/Installation/INSTALL
+++ b/Installation/INSTALL
@@ -32,6 +32,7 @@ CGAL packages, some are only needed for demos.
* CMake (>= 2.6.2), the build system used by CGAL
Required for building CGAL
+ On Windows, CMake >= 2.8.6 is required.
* Boost (>= 1.39)
Required for building CGAL and for applications using CGAL
From 9e19a7e43be54e612d5f907a2c30699d87a951c6 Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Thu, 26 Jan 2012 10:53:49 +0000
Subject: [PATCH 14/20] licensecheck is called with a set of extensions to look
for
Change the behavior of check_licenses so that it is more like the behavior
of the previous version of the script.
---
Scripts/developer_scripts/check_licenses | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Scripts/developer_scripts/check_licenses b/Scripts/developer_scripts/check_licenses
index bf071142b9a..4c228526750 100755
--- a/Scripts/developer_scripts/check_licenses
+++ b/Scripts/developer_scripts/check_licenses
@@ -48,6 +48,7 @@ DIR=stats
PREFIX1=$DIR/X
PREFIX2=$DIR/Y
EXTENSIONS="C cpp h xpm gif pcx bmp jpeg png txt html vcproj sln dsp dsw cin cout cmd nef cgal dll lib tex makefile readme"
+CHECK_PATTERN="\.(`echo $EXTENSIONS | sed -e 's/ /\\|/g'`)"
if [ -e $DIR ]; then
echo error: \'$DIR\' exists, this script needs \'$DIR\' for its own purposes
@@ -62,7 +63,7 @@ if [ ! -f INSTALL ]; then
exit 1
fi
-licensecheck -r * | grep -Ev 'L?GPL \(v3 or later\)' | \
+licensecheck -r * -c $CHECK_PATTERN | grep -Ev 'L?GPL \(v3 or later\)' | \
grep -v "^$DIR/\|^include/CGAL/CORE/\|^include/CGAL/OpenNL/\|^src/CGALCore/\|^src/CGALimageIO/\|^config/support/\|test/\|^Packages/\|^developer_scripts\|^doc_tex/\|^winutils/\|^cmake/platforms" | sort >$PREFIX1 || true
echo Note that files in the following directories are ignored:
From b385c8227b4200e3ca858f3d45d164f23599a87e Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Thu, 26 Jan 2012 11:21:43 +0000
Subject: [PATCH 15/20] Workaround the check of NDEBUG in the testsuite.
---
CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp b/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp
index 9ec8d5734e9..834410b53f9 100644
--- a/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp
+++ b/CGAL_ipelets/demo/CGAL_ipelets/arrangement.cpp
@@ -21,6 +21,8 @@
#define S_D 2.5f
+#include // to include before NDEBUG is defined, to
+ // workaround the check in the testsuite
#ifndef NDEBUG
#define NDEBUG //points are not on circular arcs
#endif
From 76f6503a3f8c3465dbe50e0b06fb1d71f22f9b8e Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Thu, 26 Jan 2012 12:00:16 +0000
Subject: [PATCH 16/20] Try to fix the bug between Qt moc and "namespace
BOOST_JOIN(...)"
---
Installation/include/CGAL/config.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h
index 1e592599bff..cc15f391fe8 100644
--- a/Installation/include/CGAL/config.h
+++ b/Installation/include/CGAL/config.h
@@ -38,6 +38,14 @@
# error The test-suite needs no NDEBUG defined
#endif // CGAL_TEST_SUITE and NDEBUG
+// Workaround to the following bug:
+// https://bugreports.qt.nokia.com/browse/QTBUG-22829
+#ifdef QT_MOC_RUN
+// When Qt moc runs on CGAL files, do not process
+//
+# define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
+#endif
+
// The following header file defines among other things BOOST_PREVENT_MACRO_SUBSTITUTION
#include
From a8988af6a78c97d5c8fa2819456fc23410475179 Mon Sep 17 00:00:00 2001
From: Laurent Rineau
Date: Thu, 26 Jan 2012 13:22:08 +0000
Subject: [PATCH 17/20] Typo in the macro Q_MOC_RUN
---
Installation/include/CGAL/config.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h
index cc15f391fe8..40515b061db 100644
--- a/Installation/include/CGAL/config.h
+++ b/Installation/include/CGAL/config.h
@@ -40,7 +40,7 @@
// Workaround to the following bug:
// https://bugreports.qt.nokia.com/browse/QTBUG-22829
-#ifdef QT_MOC_RUN
+#ifdef Q_MOC_RUN
// When Qt moc runs on CGAL files, do not process
//
# define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED
From 1e9ca501348fe358d28516b6e8ad5893ee8b31c4 Mon Sep 17 00:00:00 2001
From: Efi Fogel
Date: Thu, 26 Jan 2012 15:40:29 +0000
Subject: [PATCH 18/20] fixed 2 bugs related to events on an identified
boundary
---
.../Arr_spherical_construction_helper.h | 68 ++--
.../CGAL/Sweep_line_2/Sweep_line_2_impl.h | 344 +++++++-----------
2 files changed, 161 insertions(+), 251 deletions(-)
diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h
index d23fb25d28a..9d80268a071 100644
--- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h
+++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h
@@ -67,7 +67,7 @@ protected:
// Data members:
//! The topology-traits class
- Topology_traits * m_top_traits;
+ Topology_traits* m_top_traits;
//! An arrangement accessor
Arr_accessor m_arr_access;
@@ -80,11 +80,11 @@ protected:
//! A pointer to a map of halfedges to indices lists
// (stored in the visitor class)
- Halfedge_indices_map * m_he_ind_map_p;
+ Halfedge_indices_map* m_he_ind_map_p;
public:
/*! Constructor. */
- Arr_spherical_construction_helper(Arrangement_2 * arr) :
+ Arr_spherical_construction_helper(Arrangement_2* arr) :
m_top_traits(arr->topology_traits()),
m_arr_access(*arr),
m_he_ind_map_p(NULL)
@@ -106,7 +106,7 @@ public:
/*! A notification invoked before the sweep-line starts handling the given
* event.
*/
- virtual void before_handle_event(Event * event)
+ virtual void before_handle_event(Event* event)
{
// Act according to the boundary type:
Arr_parameter_space ps_x = event->parameter_space_in_x();
@@ -128,16 +128,13 @@ public:
// Check whether we have a vertex that corresponds to the south pole.
// If not, we create one.
- if (m_top_traits->south_pole() == NULL)
- {
+ if (m_top_traits->south_pole() == NULL) {
Vertex_handle v =
- m_arr_access.create_boundary_vertex (xc, ind, ps_x, ps_y);
+ m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y);
event->set_vertex_handle(v);
}
else
- {
- event->set_vertex_handle(Vertex_handle (m_top_traits->south_pole()));
- }
+ event->set_vertex_handle(Vertex_handle(m_top_traits->south_pole()));
return;
}
@@ -158,10 +155,9 @@ public:
// Check whether we have a vertex that corresponds to the north pole.
// If not, we create one.
- if (m_top_traits->north_pole() == NULL)
- {
+ if (m_top_traits->north_pole() == NULL) {
Vertex_handle v =
- m_arr_access.create_boundary_vertex (xc, ind, ps_x, ps_y);
+ m_arr_access.create_boundary_vertex(xc, ind, ps_x, ps_y);
event->set_vertex_handle(v);
// Since this is the first event corresponding to the north pole,
@@ -173,58 +169,50 @@ public:
// to later move them to another face.
m_subcurves_at_nf.clear();
}
- else
- {
- event->set_vertex_handle(Vertex_handle (m_top_traits->north_pole()));
+ else {
+ event->set_vertex_handle(Vertex_handle(m_top_traits->north_pole()));
- DHalfedge * dprev =
+ DHalfedge* dprev =
m_top_traits->locate_around_boundary_vertex(m_top_traits->
north_pole(), xc, ind,
ps_x, ps_y);
- if (dprev != NULL)
- {
+ if (dprev != NULL) {
Halfedge_handle prev = Halfedge_handle(dprev);
event->set_halfedge_handle(prev);
// Associate all curve indices of subcurves that "see" the top face
// from below with the left portion of the twin of the predecessor.
if (m_he_ind_map_p != NULL) {
- Indices_list & list_ref = (*m_he_ind_map_p)[prev->twin()];
+ Indices_list& list_ref = (*m_he_ind_map_p)[prev->twin()];
list_ref.splice(list_ref.end(), m_subcurves_at_nf);
}
else
- {
m_subcurves_at_nf.clear();
- }
CGAL_assertion(m_subcurves_at_nf.empty());
}
return;
}
-
return;
}
if (ps_x == ARR_LEFT_BOUNDARY) {
// The event has only right curves.
CGAL_assertion(event->number_of_left_curves() == 0 &&
- event->number_of_right_curves() == 1);
+ event->number_of_right_curves() >= 1);
const X_monotone_curve_2 & xc =
(*(event->right_curves_begin()))->last_curve();
- DVertex * v = m_top_traits->discontinuity_vertex(xc, ARR_MIN_END);
+ DVertex* v = m_top_traits->discontinuity_vertex(xc, ARR_MIN_END);
// Check whether a corresponding vertex already exists on the line
// of discontinuity. If not, create one now.
- if (v == NULL)
- {
+ if (v == NULL) {
Vertex_handle vh =
- m_arr_access.create_boundary_vertex (xc, ARR_MIN_END, ps_x, ps_y);
+ m_arr_access.create_boundary_vertex(xc, ARR_MIN_END, ps_x, ps_y);
event->set_vertex_handle(vh);
}
else
- {
event->set_vertex_handle(Vertex_handle(v));
- }
return;
}
@@ -238,39 +226,33 @@ public:
// Check whether a corresponding vertex already exists on the line
// of discontinuity. If not, create one now.
- if (v == NULL)
- {
+ if (v == NULL) {
Vertex_handle vh =
- m_arr_access.create_boundary_vertex (xc, ARR_MAX_END, ps_x, ps_y);
+ m_arr_access.create_boundary_vertex(xc, ARR_MAX_END, ps_x, ps_y);
event->set_vertex_handle(vh);
}
else
- {
event->set_vertex_handle(Vertex_handle(v));
- }
return;
}
}
/*! A notification invoked when a new subcurve is created. */
- virtual void add_subcurve(Halfedge_handle he, Subcurve * sc) { return; }
+ virtual void add_subcurve(Halfedge_handle he, Subcurve* sc) { return; }
/*! Collect a subcurve index that does not see any status-line from below.
*/
void add_subcurve_in_top_face(unsigned int index)
- {
- m_subcurves_at_nf.push_back(index);
- return;
- }
+ { m_subcurves_at_nf.push_back(index); }
/*! A notification invoked before the given event it deallocated. */
- void before_deallocate_event(Event * event) { return; }
+ void before_deallocate_event(Event* event) { return; }
//@}
/*! Set the map that maps each halfedge to the list of subcurve indices
* that "see" the halfedge from below.
*/
- void set_halfedge_indices_map(Halfedge_indices_map & table)
+ void set_halfedge_indices_map(Halfedge_indices_map& table)
{
m_he_ind_map_p = &table;
return;
@@ -279,7 +261,7 @@ public:
/*! Determine if we should swap the order of predecessor halfedges when
* calling insert_at_vertices_ex() .
*/
- bool swap_predecessors (Event * event) const
+ bool swap_predecessors(Event* event) const
{
// If we insert an edge whose right end lies on the north pole, we have
// to flip the order of predecessor halfegdes.
diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h
index 6d269de3a52..fe538fb8b17 100644
--- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h
@@ -39,7 +39,7 @@ void Sweep_line_2
::_init_structures()
Base::_init_structures();
// Resize the hash to be O(2*n), where n is the number of input curves.
- m_curves_pair_set.resize (2 * this->m_num_of_subCurves);
+ m_curves_pair_set.resize(2 * this->m_num_of_subCurves);
}
//-----------------------------------------------------------------------------
@@ -56,8 +56,7 @@ void Sweep_line_2
::_complete_sweep()
// Free all overlapping subcurves we have created.
Subcurve_iterator itr;
- for (itr = m_overlap_subCurves.begin();
- itr != m_overlap_subCurves.end();
+ for (itr = m_overlap_subCurves.begin(); itr != m_overlap_subCurves.end();
++itr)
{
this->m_subCurveAlloc.destroy(*itr);
@@ -71,14 +70,13 @@ void Sweep_line_2
::_complete_sweep()
// Handle the subcurves to the left of the current event point.
//
template
-void Sweep_line_2
::_handle_left_curves ()
+void Sweep_line_2
::_handle_left_curves()
{
CGAL_PRINT("Handling left curve" << std::endl;);
this->m_is_event_on_above = false;
- if (! this->m_currentEvent->has_left_curves())
- {
+ if (! this->m_currentEvent->has_left_curves()) {
// In case the current event has no left subcurves incident to it, we have
// to locate a place for it in the status line.
CGAL_PRINT(" - handling special case " << std::endl;);
@@ -86,18 +84,15 @@ void Sweep_line_2
::_handle_left_curves ()
Status_line_iterator sl_pos = this->m_status_line_insert_hint;
- if (this->m_is_event_on_above)
- {
+ if (this->m_is_event_on_above) {
// The current event point starts at the interior of a subcurve that
// already exists in the status line (this may also indicate an overlap).
- if (! this->m_currentEvent->has_right_curves())
- {
+ if (! this->m_currentEvent->has_right_curves()) {
// The event is an isolated point.
- if (this->m_currentEvent->is_query())
- {
+ if (this->m_currentEvent->is_query()) {
// In case of a query point, just notify the visitor about it.
this->m_is_event_on_above = true;
- this->m_visitor->before_handle_event (this->m_currentEvent);
+ this->m_visitor->before_handle_event(this->m_currentEvent);
return;
}
@@ -109,8 +104,7 @@ void Sweep_line_2
::_handle_left_curves ()
// Obtain the subcurve that contains the current event, and add it to
// the left curves incident to the event.
- Subcurve *sc = static_cast(*(this->
- m_status_line_insert_hint));
+ Subcurve* sc = static_cast(*(this->m_status_line_insert_hint));
const X_monotone_curve_2& last_curve = sc->last_curve();
this->m_currentEvent->set_weak_intersection();
@@ -121,24 +115,21 @@ void Sweep_line_2
::_handle_left_curves ()
// We also check for overlaps.
bool is_overlap = _add_curve_to_right(this->m_currentEvent, sc);
- this->m_traits->split_2_object() (last_curve,
- this->m_currentEvent->point(),
- sub_cv1, sub_cv2);
+ this->m_traits->split_2_object()(last_curve,
+ this->m_currentEvent->point(),
+ sub_cv1, sub_cv2);
++(this->m_status_line_insert_hint);
- if (is_overlap)
- {
+ if (is_overlap) {
// Handle overlaps.
- this->m_visitor->before_handle_event (this->m_currentEvent);
- this->m_visitor->add_subcurve (sub_cv1, sc);
- this->m_statusLine.erase (sl_pos);
+ this->m_visitor->before_handle_event(this->m_currentEvent);
+ this->m_visitor->add_subcurve(sub_cv1, sc);
+ this->m_statusLine.erase(sl_pos);
return;
}
-
}
- else
- {
+ else {
// The event is not located on any subcurve.
this->m_visitor->before_handle_event(this->m_currentEvent);
return;
@@ -168,21 +159,18 @@ void Sweep_line_2
::_handle_left_curves ()
Event_subcurve_iterator left_iter =
this->m_currentEvent->left_curves_begin();
- while(left_iter != this->m_currentEvent->left_curves_end())
- {
- Subcurve *leftCurve = *left_iter;
+ while (left_iter != this->m_currentEvent->left_curves_end()) {
+ Subcurve* leftCurve = *left_iter;
- if((Event*)leftCurve->right_event() == this->m_currentEvent)
- {
+ if ((Event*)leftCurve->right_event() == this->m_currentEvent) {
// we are done with that subcurve (current event point is his right
// end point) so we remove it from the status line for good.
remove_for_good = true;
this->m_visitor->add_subcurve(leftCurve->last_curve(), leftCurve);
}
- else
- {
+ else {
// curren event splits the subcurve.
- const X_monotone_curve_2 &lastCurve = leftCurve->last_curve();
+ const X_monotone_curve_2& lastCurve = leftCurve->last_curve();
this->m_traits->split_2_object()(lastCurve,
this->m_currentEvent->point(),
@@ -198,21 +186,19 @@ void Sweep_line_2
::_handle_left_curves ()
_remove_curve_from_status_line(leftCurve, remove_for_good);
}
CGAL_PRINT( "Handling left curve END" << std::endl;);
-
- return;
}
//-----------------------------------------------------------------------------
// Handle the subcurves to the right of the current event point.
//
template
-void Sweep_line_2
::_handle_right_curves ()
+void Sweep_line_2
::_handle_right_curves()
{
CGAL_PRINT("Handling right curves (" ;);
CGAL_SL_DEBUG(this->PrintEvent(this->m_currentEvent););
CGAL_PRINT(")\n";);
- if(! this->m_currentEvent->has_right_curves())
+ if (! this->m_currentEvent->has_right_curves())
return;
// Loop over the curves to the right of the status line and handle them:
@@ -225,29 +211,26 @@ void Sweep_line_2
::_handle_right_curves ()
// If the two curves used to be neighbours before, we do not need to
// intersect them again.
if (!this->m_currentEvent->are_left_neighbours
- (static_cast(*currentOne),
- static_cast(*prevOne)))
+ (static_cast(*currentOne), static_cast(*prevOne)))
{
_intersect(*prevOne, *currentOne);
}
@@ -272,9 +254,9 @@ void Sweep_line_2
::_handle_right_curves ()
//the next Subcurve at the status line
++slIter;
- if ( slIter != this->m_statusLine.end() )
- _intersect( static_cast(*prevOne),
- static_cast(*slIter));
+ if (slIter != this->m_statusLine.end())
+ _intersect(static_cast(*prevOne),
+ static_cast(*slIter));
}
//-----------------------------------------------------------------------------
@@ -287,32 +269,23 @@ bool Sweep_line_2
::_intersect(Subcurve* c1,
+ Subcurve* c2)
{
typedef typename Tr::Multiplicity Multiplicity;
@@ -395,23 +364,21 @@ _intersect (Subcurve *c1, Subcurve *c2)
// look up for (c1,c2) in the table and insert if doesnt exist
Curve_pair cv_pair(c1,c2);
- if(! (m_curves_pair_set.insert(cv_pair)).second )
+ if (! (m_curves_pair_set.insert(cv_pair)).second )
return; //the curves have already been checked for intersection
float load_factor = static_cast(m_curves_pair_set.size()) /
- m_curves_pair_set.bucket_count();
+ m_curves_pair_set.bucket_count();
// after lot of benchemarks, keeping load_factor<=6 is optimal
- if(load_factor > 6.0f)
+ if (load_factor > 6.0f)
m_curves_pair_set.resize(m_curves_pair_set.size() * 6);
- vector_inserter vi (m_x_objects) ;
- vector_inserter vi_end (m_x_objects);
- vi_end = this->m_traits->intersect_2_object()(c1->last_curve(),
- c2->last_curve(),
- vi);
+ vector_inserter vi(m_x_objects) ;
+ vector_inserter vi_end(m_x_objects);
+ vi_end =
+ this->m_traits->intersect_2_object()(c1->last_curve(), c2->last_curve(), vi);
- if (vi == vi_end)
- {
+ if (vi == vi_end) {
CGAL_PRINT("no intersection...\n";);
return; // no intersection at all
}
@@ -432,8 +399,8 @@ _intersect (Subcurve *c1, Subcurve *c2)
this->m_traits->parameter_space_in_y_2_object()(c2->last_curve(),
ARR_MIN_END);
- if (ps_x1 != CGAL::ARR_INTERIOR && ps_y1 != CGAL::ARR_INTERIOR &&
- (ps_x1 == ps_x2) && (ps_y1 == ps_y2) &&
+ if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) &&
+ ((ps_x1 != ARR_INTERIOR) || (ps_y1 != ARR_INTERIOR)) &&
this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) &&
this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END))
{
@@ -453,17 +420,15 @@ _intersect (Subcurve *c1, Subcurve *c2)
if (reinterpret_cast(c1->right_event()) ==
reinterpret_cast(c2->right_event()))
{
- vector_inserter vi_last = vi_end;
+ vector_inserter vi_last = vi_end;
--vi_last;
- if (object_cast > (&(*vi_last)) != NULL)
- {
+ if (object_cast >(&(*vi_last)) != NULL) {
CGAL_PRINT(" [Skipping common right endpoint...]\n";);
--vi_end;
}
}
- else
- {
+ else {
// In case both right curve-ends have boundary conditions and are not
// open, check whether the right endpoints are the same. If they are,
// skip the last intersection point.
@@ -486,13 +451,13 @@ _intersect (Subcurve *c1, Subcurve *c2)
this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MAX_END))
{
if (this->m_traits->equal_2_object()
- (this->m_traits->construct_max_vertex_2_object() (c1->last_curve()),
- this->m_traits->construct_max_vertex_2_object() (c2->last_curve())))
+ (this->m_traits->construct_max_vertex_2_object()(c1->last_curve()),
+ this->m_traits->construct_max_vertex_2_object()(c2->last_curve())))
{
- vector_inserter vi_last = vi_end;
+ vector_inserter vi_last = vi_end;
--vi_last;
- if (object_cast > (&(*vi_last)) != NULL)
+ if (object_cast >(&(*vi_last)) != NULL)
{
CGAL_PRINT(" [Skipping common right endpoint on boundary...]\n";);
--vi_end;
@@ -501,17 +466,15 @@ _intersect (Subcurve *c1, Subcurve *c2)
}
}
- const std::pair *xp_point;
+ const std::pair* xp_point;
// Efi: why not skipping in a loop?check only one (that is, why not in a loop)?
- if(vi != vi_end)
- {
- xp_point = object_cast > (&(*vi));
- if (xp_point != NULL)
- {
+ if (vi != vi_end) {
+ xp_point = object_cast >(&(*vi));
+ if (xp_point != NULL) {
// Skip the intersection point if it is not larger than the current
// event.
- if (this->m_queueEventLess (xp_point->first, this->m_currentEvent) !=
+ if (this->m_queueEventLess(xp_point->first, this->m_currentEvent) !=
LARGER)
{
++vi;
@@ -519,24 +482,21 @@ _intersect (Subcurve *c1, Subcurve *c2)
}
}
- for( ; vi != vi_end ; ++vi)
- {
- const X_monotone_curve_2 *icv;
+ for ( ; vi != vi_end ; ++vi) {
+ const X_monotone_curve_2* icv;
Point_2 xp;
unsigned int multiplicity = 0;
- xp_point = object_cast > (&(*vi));
- if (xp_point != NULL)
- {
+ xp_point = object_cast >(&(*vi));
+ if (xp_point != NULL) {
xp = xp_point->first;
multiplicity = xp_point->second;
CGAL_PRINT("found an intersection point: " << xp << "\n";);
_create_intersection_point(xp, multiplicity, c1, c2);
}
- else
- {
- icv = object_cast (&(*vi));
- CGAL_assertion (icv != NULL);
+ else {
+ icv = object_cast(&(*vi));
+ CGAL_assertion(icv != NULL);
CGAL_PRINT("found an overlap: " << *icv << "\n";);
// TODO EBEB: This code does not work with overlaps that reach the boundary
@@ -555,19 +515,17 @@ _intersect (Subcurve *c1, Subcurve *c2)
//
template
void Sweep_line_2
::
-_create_intersection_point (const Point_2& xp,
- unsigned int multiplicity,
- Subcurve* &c1, Subcurve* &c2,
- bool is_overlap)
+_create_intersection_point(const Point_2& xp,
+ unsigned int multiplicity,
+ Subcurve*& c1, Subcurve*& c2,
+ bool is_overlap)
{
// insert the event and check if an event at this point already exists.
const std::pair& pair_res =
- this->_push_event (xp, Base_event::DEFAULT,
- ARR_INTERIOR, ARR_INTERIOR);
+ this->_push_event(xp, Base_event::DEFAULT, ARR_INTERIOR, ARR_INTERIOR);
- Event *e = pair_res.first;
- if(pair_res.second)
- {
+ Event* e = pair_res.first;
+ if (pair_res.second) {
CGAL_PRINT("A new event is created .. (" << xp <<")\n";);
// a new event is creatd , which inidicates
// that the intersection point cannot be one
@@ -580,40 +538,34 @@ _create_intersection_point (const Point_2& xp,
e->push_back_curve_to_left(c2);
// Act according to the multiplicity:
- if (multiplicity == 0)
- {
+ if (multiplicity == 0) {
// The multiplicity of the intersection point is unkown or undefined:
_add_curve_to_right(e, c1, is_overlap);
_add_curve_to_right(e, c2, is_overlap);
- if(! is_overlap)
- {
- if(e->is_right_curve_bigger(c1, c2))
+ if (! is_overlap) {
+ if (e->is_right_curve_bigger(c1, c2))
std::swap(c1, c2);
}
}
- else
- {
- if((multiplicity % 2) == 1)
- {
+ else {
+ if ((multiplicity % 2) == 1) {
// The mutiplicity of the intersection point is odd: Swap their
// order to the right of this point.
std::swap(c1,c2);
- e->add_curve_pair_to_right (c1, c2);
+ e->add_curve_pair_to_right(c1, c2);
}
- else
- {
+ else {
// The mutiplicity of the intersection point is even, so they
// maintain their order to the right of this point.
CGAL_assertion((multiplicity % 2) == 0);
- e->add_curve_pair_to_right (c1, c2);
+ e->add_curve_pair_to_right(c1, c2);
}
}
}
else // the event already exists, so we need to update it accordingly
{
CGAL_PRINT("Event already exists, updating.. (" << xp <<")\n";);
- if (e == this->m_currentEvent)
- {
+ if (e == this->m_currentEvent) {
// This can happen when c1 starts at the interior of c2 (or vice versa).
return;
}
@@ -621,48 +573,40 @@ _create_intersection_point (const Point_2& xp,
e->add_curve_to_left(c1);
e->add_curve_to_left(c2);
- if ( !c1->is_end_point(e) && !c2->is_end_point(e))
- {
+ if (!c1->is_end_point(e) && !c2->is_end_point(e)) {
_add_curve_to_right(e, c1, is_overlap);
_add_curve_to_right(e, c2, is_overlap);
e->set_intersection();
this->m_visitor ->update_event(e, c1, c2, false);
}
- else
- {
- if(!c1->is_end_point(e) && c2->is_end_point(e))
- {
+ else {
+ if (!c1->is_end_point(e) && c2->is_end_point(e)) {
_add_curve_to_right(e, c1, is_overlap);
e->set_weak_intersection();
this->m_visitor ->update_event(e, c1);
}
- else
- {
- if(c1->is_end_point(e) && !c2->is_end_point(e))
- {
+ else {
+ if (c1->is_end_point(e) && !c2->is_end_point(e)) {
_add_curve_to_right(e, c2, is_overlap);
e->set_weak_intersection();
this->m_visitor ->update_event(e, c2);
}
}
}
- if (! is_overlap)
- {
- if(e->is_right_curve_bigger(c1, c2))
+ if (! is_overlap) {
+ if (e->is_right_curve_bigger(c1, c2))
std::swap(c1, c2);
}
-
}
CGAL_SL_DEBUG(e->Print();)
-
}
//-----------------------------------------------------------------------------
// Fix overlap Subcurves before handling the current event.
//
template
-void Sweep_line_2
::_fix_overlap_subcurves ()
this->m_currentEvent->left_curves_begin();
//special treatment for Subcuves that store overlaps
- while ( leftCurveIter != this->m_currentEvent->left_curves_end() )
- {
- Subcurve *leftCurve = *leftCurveIter;
+ while (leftCurveIter != this->m_currentEvent->left_curves_end()) {
+ Subcurve* leftCurve = *leftCurveIter;
// we check if the subcurve store overlap and current event is its
// right end point.
- if((Event*)leftCurve->right_event() == this->m_currentEvent)
- {
- if(leftCurve->originating_subcurve1() != NULL)
- {
+ if ((Event*)leftCurve->right_event() == this->m_currentEvent) {
+ if (leftCurve->originating_subcurve1() != NULL) {
Subcurve* orig_sc_1 = (Subcurve*)leftCurve->originating_subcurve1();
Subcurve* orig_sc_2 = (Subcurve*)leftCurve->originating_subcurve2();
@@ -701,20 +642,19 @@ void Sweep_line_2
::_fix_overlap_subcurves ()
// overlap_exist - a flag indicates if the overlap X_monotone_curve_2 was
// computed already (is true than its stored at sub_cv1 data member).
template
-void Sweep_line_2