Commit Graph

78 Commits

Author SHA1 Message Date
Sébastien Loriot c99b69a0e7 add missing license headers 2024-01-04 13:50:15 +01:00
Sébastien Loriot e7c26349f2 move header in a package to GPL 2024-01-04 13:36:34 +01:00
albert-github 7a62583efa spelling corrections
Some spelling corrections (Directories starting with `C`)
2022-11-14 19:14:33 +01:00
Andreas Fabri dc531cbaa9 Convex_hull_2 2022-09-27 08:40:26 +01:00
Mael Rouxel-Labbé 1c19734490 Add missing header include 2022-07-02 18:02:44 +02:00
Mael Rouxel-Labbé 75441da5ed Remove a disable_warning.h 2022-07-01 23:49:57 +02:00
Mael Rouxel-Labbé 2e330b1342 Improve CH2 tests 2022-07-01 23:49:31 +02:00
Mael Rouxel-Labbé 13b4060644 Fix eddy/bykat returning collinear vertices on the hull
In these two algorithms, points farthest from a line must be found.
In case of multiple points at the same distance, an "extremity"
of this set of points must be returned.

This was properly documented in the Less_signed_distance_to_line_2
functor of the ConvexHullTraits_2 concept:

[ ... ]
The predicate must provide a total order compatible with convexity,
<I>i.e.</I>, for any line segment \f$ s\f$ one of the endpoints
of \f$ s\f$ is the smallest point among the points on \f$ s\f$,
with respect to the order given by `Less_signed_distance_to_line_2`.
[ ... ]

And specific models did respect this requirement. However, the kernel
is supposed to also be a model of ConvexHullTraits_2, but
Kernel_23::LessSignedDistanceToLine_2 does not require this, and
the models (EPICK, Simple_Cartesian, etc.) do not implement it.
Hence, if a kernel was used as geometric traits for 2D Convex Hull
algorithms, one might not get the expected extreme point when
there are multiple points at the same distance to a line at some
point in the algorithm.

The algorithm recovered, but this created extra points on the hull.

Fixing the functor in the kernel would create an inconsistency
with Kernel_23::Compare_signed_distance_to_line_2, so instead
this commit changes the concept and the code to require
providing Compare_signed_distance_to_line_2 and then uses Less_xy
in the code in case of EQUAL return (that is actually how it was
done in the Convex_hull_2-specific versions of the ConvexHullTraits_2
model).
2022-07-01 13:35:59 +02:00
Mael Rouxel-Labbé 2b245d870e Remove long-deprecated Convex_hull_2 projection traits 2022-06-30 15:20:23 +02:00
Mael Rouxel-Labbé 96e565777f Remove useless "using namespace boost" (boost::bind was replaced with lambdas) 2022-06-30 09:32:45 +02:00
Sébastien Loriot 98e471849b moving files from internal to PKG/internal 2021-08-26 11:33:39 +02:00
Laurent Rineau 21755b1123 Merge pull request #5245 from GilesBathgate/create-assertions-fix
Allow -DNDEBUG and CGAL_nnn_assertions at the same time
2021-03-24 15:05:41 +01:00
Sébastien Loriot 4bb0406240 do not include boost/bind.hpp (shouldn't be used anymore) + fix remaining bind
(nasty using namespace boost!)
2021-02-12 15:35:19 +01:00
Andreas Fabri 51086d5678 When using a reference for the functor we must generate a new functor in the for loop 2021-01-28 17:12:26 +00:00
Sébastien Loriot c4ad713b9e replace bind in Convex_hull_2 2021-01-06 12:59:11 +01:00
Giles Bathgate 5a36ff89b5 Drop NDEBUG it is already visible through CGAL_NO_ASSERTIONS 2020-12-04 19:42:21 +00:00
Laurent Rineau 319383c963 Revert "Merge pull request #4519 from lrineau/Kernel_23-Epeck_objects_in_Compact_container-lrineau_gdamiand"
This reverts commit bcab082f82, reversing
changes made to 2d3e126450.
2020-05-20 09:47:58 +02:00
Sébastien Loriot 97e46accad extra run of the script to remove tabs and trailing whitespaces 2020-03-26 19:26:37 +01:00
Sébastien Loriot 34ce87be56 Update branch from master after trailing whitespaces and tabs removal 2020-03-26 19:26:15 +01:00
Sébastien Loriot 0779373835 extra run of the script to remove tabs and trailing whitespaces
right after the  merge of 4.14 release branch

+ manual fix on one line in:
    * Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h
    * .travis/generate_travis.sh
2020-03-26 14:16:06 +01:00
Guillaume Damiand f3bb8f1100 Bug fix 2020-03-18 08:36:07 +01:00
Sébastien Loriot 52164b1fba First pass on removing license notice in header for LGPL files 2019-10-19 15:40:30 +02:00
Sébastien Loriot 254d60f642 First pass on removing license notice in header for GPL files 2019-10-19 15:23:19 +02:00
Sébastien Loriot 7356421d80 introduce Commercial license SPDX tag 2019-10-19 12:15:19 +02:00
Sébastien Loriot 9bd9c68b83 update LGPL[23]+ and GPL[23]+ SPDX tags
ack -l --no-svg "SPDX-License-Identifier: GPL-3.0\+" | xargs sed -i "s/SPDX-License-Identifier: GPL-3.0+/SPDX-License-Identifier: GPL-3.0-or-later/"
ack -l --no-svg "SPDX-License-Identifier: LGPL-3.0\+" | xargs sed -i "s/SPDX-License-Identifier: LGPL-3.0+/SPDX-License-Identifier: LGPL-3.0-or-later/"
ack -l --no-svg "SPDX-License-Identifier: GPL-2.0\+" | xargs sed -i "s/SPDX-License-Identifier: GPL-2.0+/SPDX-License-Identifier: GPL-2.0-or-later/"
ack -l --no-svg "SPDX-License-Identifier: LGPL-2.0\+" | xargs sed -i "s/SPDX-License-Identifier: LGPL-2.0+/SPDX-License-Identifier: LGPL-2.0-or-later/"
2019-10-18 21:57:54 +02:00
Sebastien Loriot a24f22bd01
Merge pull request #3833 from afabri/Convex_hull_2-indices-GF
Convex_hull_2: Add an adapter
2019-04-18 15:53:59 +02:00
Sebastien Loriot 1406fb22d2 Apply suggestions from code review
Co-Authored-By: afabri <andreas.fabri@geometryfactory.com>
2019-04-12 12:37:45 +02:00
Andreas Fabri 58f53c3711 fix typo 2019-04-04 16:49:51 +02:00
Andreas Fabri 5e9b8e3bbf Add an adapter so that one can sort arbitary things and access the point via a property map 2019-04-03 16:23:58 +02:00
Sébastien Loriot f62624c4f9 replace cpp11::tuple by std::tuple 2019-03-29 13:28:33 +01:00
Sébastien Loriot ce126b87c6 remove cpp11::copy_n, cpp11::prev, and cpp11::next and use std instead 2019-03-29 13:28:32 +01:00
Sébastien Loriot 0685423ae8 update from cgal/master 2018-11-02 11:32:31 +01:00
Andreas Fabri 97b5c37b6e Fix includes 2018-05-04 09:00:11 +02:00
Mael Rouxel-Labbé ba3a59ed5a Merge branch 'Periodic_3_mesh_3-Feature-MBogdanov-old' into Periodic_3_mesh_3-Feature-MBogdanov 2017-11-30 15:54:00 +01:00
Sébastien Loriot ee57fc2d6c add SPDX identifier for files under the GPL-3+ license 2017-11-12 10:17:51 +01:00
Mael Rouxel-Labbé 538cad303f Purged Convex_hull_traits_2
It's pointless to write all these functions... (and it was incomplete anyway).
2017-10-22 23:32:54 +02:00
Mael Rouxel-Labbé 41f5c47394 Misc minor changes
Indentation, comments, whitespace, etc.
2017-10-22 23:28:37 +02:00
Sébastien Loriot 50510c05ea add include directive for license of all GPL header files
done using:
ack-grep "^GPL" */package_info/*/license.txt -l | awk -F "/" '{print $1}' > /tmp/gpl_packages
for i in `cat /tmp/gpl_packages | \
          grep -v Operations_on_polyhedra | \
          grep -v Algebraic_kernel_for_circles | \
          grep -v Algebraic_kernel_for_spheres | \
          grep -v Polyhedron_IO`;
do
  echo $i
  python Scripts/developer_scripts/add_license_in_pkg_header.py $i
done
python Scripts/developer_scripts/add_license_in_pkg_header.py Operations_on_polyhedra Polygon_mesh_processing
python Scripts/developer_scripts/add_license_in_pkg_header.py Algebraic_kernel_for_circles Circular_kernel_2
python Scripts/developer_scripts/add_license_in_pkg_header.py Algebraic_kernel_for_spheres Circular_kernel_3
python Scripts/developer_scripts/add_license_in_pkg_header.py Polyhedron_IO Polyhedron
2017-01-19 15:20:25 +01:00
Sébastien Loriot edbe8bb9e7 remove unused variable 2015-12-29 16:55:04 +01:00
Andreas Fabri 6c547e5663 Mainly added includes 2013-09-13 22:24:30 +02:00
Laurent Rineau d19578725b Fix warnings 2013-02-07 18:15:23 +01:00
Laurent Rineau e87dad0f95 Fix all warnings in demo/Polyhedron/
The compilation was fix g++-4.8, and the flags:
  --std=c++11 -frounding-math Wall -Wno-array-bounds -Wno-uninitialized
2013-02-06 17:03:20 +01:00
Sébastien Loriot 82b2ebc865 apply the cpp0x namespace renaming in all files 2012-12-19 11:33:17 +01:00
Laurent Rineau db194534c7 First big patch to fix -Wunused-local-typedefs
-Wunused-local-typedefs is a new warning flag of gcc-4.7, and it will enabled
 by -Wall since gcc-4.8 (not yet released).

The fix is a big set of removals of unused typedefs (or comments, or moves,
depending on the context).
2012-08-01 13:29:16 +00:00
Sébastien Loriot 3de45905c0 use a dedicated version of the function assigning points to region in case
at least two extreme points are identical.

for the archive here is the result of the benchmark like done for r69398.
br_spl correspond to the same code but replacing the implementation of 
ch_akl_toussaint_assign_points_to_regions_deg by:
  for ( ; first != last; ++first )
  {
    //note that e!=w and s!=n except if the convex hull is a point (they are lexicographically sorted)
    if ( left_turn(*e, *w, *first ) )   
    {
        if (s!=w && left_turn( *s, *w, *first ) )       region1.push_back( *first );
        else if (e!=s && left_turn( *e, *s, *first ) )  region2.push_back( *first );
    }
    else
    {
        if (n!=e && left_turn( *n, *e, *first ) )       region3.push_back( *first );
        else if (w!=n && left_turn( *w, *n, *first ) )  region4.push_back( *first );
    }
  }  

The conclusion is that that version is always the fastest.

2 extreme points 
    using vector
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |  1.34  |  2.61  | 16.15  | 16.69 |  18.31 |  20.91  |
    |branch   |  0.10  |  0.74  |  9.24  | 11.0  |  12.74 |  15.24  |
    |br_spl   |  0.12  |  0.91  | 10.18  | 11.88 |  13.68 |  15.88  |
    |--------------------------------------------------------------- 

    using list
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |  1.27  |  2.66  |  16.09 | 16.66 |  18.19  | 21.21  |
    |branch   |  0.10  |  0.8   |   9.49 | 11.36 |  13.09  | 15.55  |
    |br_spl   |  0.13  |  0.9   |  10.32 | 12.00 |  13.93  | 16.14  |
    --------------------------------------------------------------- |

 
3 extreme points
    using vector
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |   1.34 |   2.46 |  14.26 | 14.81 |   16.40 | 18.48  |
    |branch   |   0.18 |   0.87 |  10.07 | 11.76 |   13.52 | 15.59  |
    |br_spl   |   0.12 |   0.98 |  10.41 | 12.07 |   13.94 | 15.93  |
    |---------------------------------------------------------------| 

    using list
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |   1.32 |   2.45 |  14.17 | 14.76 |   16.62 | 18.61  |
    |branch   |   0.19 |   0.86 |  10.21 | 12.03 |   13.66 | 15.96  |
    |br_spl   |   0.16 |   0.94 |  10.74 | 12.38 |   14.39 | 16.31  |
    |---------------------------------------------------------------| 

Convex hull is 2 points
    using vector
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |  0.19  |  1.39  |  13.54 | 13.46 |  14.16  | 14.05  |
    |branch   |  0.11  |  0.54  |   5.02 |  4.96 |   5.09  |  5.06  |
    |br_spl   |  0.12  |  0.94  |   9.02 |  9.0  |   8.98  |  9.13  |
    |---------------------------------------------------------------| 

    using list
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |   0.18 |   1.46 |  13.89 | 13.88 |   14.44 | 14.11  |
    |branch   |   0.14 |   0.58 |   5.12 |  5.07 |    5.07 |  5.29  |
    |br_spl   |   0.14 |   0.97 |   9.28 |  9.28 |    9.30 |  9.54  |
    |---------------------------------------------------------------| 

4 extreme points
    using vector
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------| 
    |next     |   2.37 |   2.97 |   9.84 |  8.07 |    7.76 | 9.0    |
    |branch   |   0.10 |   0.50 |   6.76 |  7.36 |    7.42 | 8.66   |
    |br_spl   |   0.13 |   0.46 |   6.74 |  7.30 |    7.38 | 8.65   |
    |---------------------------------------------------------------|

    using list
    |nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|
    |nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
    |---------------------------------------------------------------|
    |next     |   2.34 |   3.07 |   9.91 |  8.01 |    7.78 | 9.17   |
    |branch   |   0.11 |   0.54 |   6.78 |  7.44 |    7.58 | 8.93   |
    |br_spl   |   0.14 |   0.50 |   6.82 |  7.44 |    7.51 | 8.94   |
    |---------------------------------------------------------------|
2012-05-31 12:48:42 +00:00
Sébastien Loriot d6f0881f52 make sure ranges are not empty.
benchmark results are still valid
2012-05-30 15:52:46 +00:00
Sébastien Loriot a4b5ae22aa The akl_toussaint algo first determines extreme points along x and y axis, and then
associates each input point outside the diamond defined by the aforementioned extreme points
to one of the 4 regions defined. The old implementation did not take into account 
the fact that the extreme points where also tested, which resulted in filter failures.

To avoid that, the range of input points is split (artificially) in 5 ranges and
the association part is done for each range. The implementation is faster when using
random access iterators as input.

Here is the result of a benchmark on random points in a disk.
In order to have significant running time, the same convex hull
is computed several times (nb runs) and the total time is reported.


Using a vector of points as input

nb pts   |     10 |   100  |   1000 | 10000 |  100000 | 1000000|  
nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
---------------------------------------------------------------
next     | 2.34s  | 2.95s  |  9.88s | 8.02s | 7.80s   | 9.06s  |
branch   | 0.11s  | 0.49s  |  6.79s | 7.49s | 7.43s   | 8.74s  |
---------------------------------------------------------------


Using a list of points as input

nb pts   |     10 |    100 |   1000 | 10000 |  100000 | 1000000|  
nb runs  | 100001 | 100001 | 100001 | 10001 |    1001 |     101|
---------------------------------------------------------------
next     |  2.34s | 3.16s  |  9.85s | 8.08s |   7.84s | 9.27s  |
branch   |  0.14s | 0.54s  |  6.93s | 7.51s |   7.61s | 8.98s  |
---------------------------------------------------------------
2012-05-30 15:17:59 +00:00
Sébastien Loriot 19857458b6 deprecation warnings 2012-05-28 07:28:03 +00:00
Laurent Rineau 8f59fd9592 Turn QPL into LGPLv3+ 2012-01-13 16:33:35 +00:00
Philipp Möller 8eb30ef805 Replaced all uses of predecessor/successor with prev/next. 2011-06-07 16:21:58 +00:00