From d0f7159b9ca5c944efc3641d6ef1e8c5392a6787 Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Tue, 21 Jan 2025 19:30:38 +0530 Subject: [PATCH 1/9] +testing --- Orthtree/examples/Orthtree/octree_build_from_point_set.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp b/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp index c4226b0dbe8..c0240fd96fc 100644 --- a/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp +++ b/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp @@ -13,6 +13,7 @@ using Point_set = CGAL::Point_set_3; using Point_map = Point_set::Point_map; using Octree = CGAL::Octree; + int main(int argc, char **argv) { // Point set will be used to hold our points From 93f02ccd6138fd2a0a32b273f31f0e74ea190d05 Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Tue, 21 Jan 2025 19:32:32 +0530 Subject: [PATCH 2/9] +testing2 --- Orthtree/examples/Orthtree/octree_build_from_point_set.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp b/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp index c0240fd96fc..c4226b0dbe8 100644 --- a/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp +++ b/Orthtree/examples/Orthtree/octree_build_from_point_set.cpp @@ -13,7 +13,6 @@ using Point_set = CGAL::Point_set_3; using Point_map = Point_set::Point_map; using Octree = CGAL::Octree; - int main(int argc, char **argv) { // Point set will be used to hold our points From 724ef989782c9357ae20a4708f9a655ab0b71d5b Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Tue, 21 Jan 2025 23:12:12 +0530 Subject: [PATCH 3/9] avoid using c style arrays --- .../examples/Min_circle_2/min_circle_2.cpp | 8 ++++---- .../examples/Min_circle_2/min_circle_homogeneous_2.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp index e45b00c7b87..3ccc5aeb677 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp @@ -4,7 +4,7 @@ #include #include - +#include typedef CGAL::Simple_cartesian K; typedef CGAL::Min_sphere_of_points_d_traits_2 Traits; typedef CGAL::Min_sphere_of_spheres_d Min_circle; @@ -14,14 +14,14 @@ int main( int, char**) { const int n = 100; - Point P[n]; + std::vector P(n); CGAL::Random r; // random number generator for ( int i = 0; i < n; ++i){ - P[ i] = Point(r.get_double(), r.get_double()); + P.at(i) = Point(r.get_double(), r.get_double()); } - Min_circle mc( P, P+n); + Min_circle mc( P.begin(), P.begin() + n); Min_circle::Cartesian_const_iterator ccib = mc.center_cartesian_begin(), ccie = mc.center_cartesian_end(); std::cout << "center:"; diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp index 238887de2e4..8ca9d53e4eb 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp @@ -2,7 +2,7 @@ #include #include #include - +#include #include // typedefs @@ -16,15 +16,15 @@ int main( int, char**) { const int n = 100; - Point P[n]; + std::vector P(n); for ( int i = 0; i < n; ++i){ - P[i] = Point( (i%2 == 0 ? i : -i), 0, 1); + P.at(i) = Point( (i%2 == 0 ? i : -i), 0, 1); // (0,0), (-1,0), (2,0), (-3,0), ... } - Min_circle mc1( P, P+n, false); // very slow - Min_circle mc2( P, P+n, true); // fast + Min_circle mc1( P.begin(), P.begin() + n, false); // very slow + Min_circle mc2( P.begin(), P.begin() +n, true); // fast CGAL::IO::set_pretty_mode( std::cout); std::cout << mc2; From 6b0a8c5b6d665fba1b8073d8be202300018aa15f Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Wed, 22 Jan 2025 17:56:58 +0530 Subject: [PATCH 4/9] Used std::array instead of std::vector as the size is known at compile time --- Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp | 4 ++-- .../examples/Min_circle_2/min_circle_homogeneous_2.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp index 3ccc5aeb677..376c9b7b22c 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include typedef CGAL::Simple_cartesian K; typedef CGAL::Min_sphere_of_points_d_traits_2 Traits; typedef CGAL::Min_sphere_of_spheres_d Min_circle; @@ -14,7 +14,7 @@ int main( int, char**) { const int n = 100; - std::vector P(n); + std::array P; CGAL::Random r; // random number generator for ( int i = 0; i < n; ++i){ diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp index 8ca9d53e4eb..be8bf06c4b2 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include // typedefs @@ -16,7 +16,7 @@ int main( int, char**) { const int n = 100; - std::vector P(n); + std::array P; for ( int i = 0; i < n; ++i){ P.at(i) = Point( (i%2 == 0 ? i : -i), 0, 1); From 27c788d1d3549268c34ffe6d49b4eb2b5966d0f6 Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Wed, 22 Jan 2025 19:27:31 +0530 Subject: [PATCH 5/9] Used std::arr.end() instead of adding n to the .begin() iterator --- Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp | 2 +- .../examples/Min_circle_2/min_circle_homogeneous_2.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp index 376c9b7b22c..a899152fad8 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp @@ -21,7 +21,7 @@ main( int, char**) P.at(i) = Point(r.get_double(), r.get_double()); } - Min_circle mc( P.begin(), P.begin() + n); + Min_circle mc( P.begin(), P.end()); Min_circle::Cartesian_const_iterator ccib = mc.center_cartesian_begin(), ccie = mc.center_cartesian_end(); std::cout << "center:"; diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp index be8bf06c4b2..90e8fffc663 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp @@ -23,8 +23,8 @@ main( int, char**) // (0,0), (-1,0), (2,0), (-3,0), ... } - Min_circle mc1( P.begin(), P.begin() + n, false); // very slow - Min_circle mc2( P.begin(), P.begin() +n, true); // fast + Min_circle mc1( P.begin(), P.end(), false); // very slow + Min_circle mc2( P.begin(), P.end(), true); // fast CGAL::IO::set_pretty_mode( std::cout); std::cout << mc2; From 057caa3d1939f89d4d520c69d60b9b3fc6d747c2 Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Sun, 26 Jan 2025 17:54:36 +0530 Subject: [PATCH 6/9] used std::array for point storage in the following examples of Bounding_volumes (1)min_annulus_d_fast_exact.cpp (2)min_annulus_d.cpp (3)min_ellipse_2.cpp (4)min_sphere_3.cpp (5)min_sphere_homogenous_3.cpp --- .../examples/Min_annulus_d/min_annulus_d.cpp | 5 +++-- .../Min_annulus_d/min_annulus_d_fast_exact.cpp | 6 +++--- .../examples/Min_ellipse_2/min_ellipse_2.cpp | 10 +++++----- .../examples/Min_sphere_d/min_sphere_3.cpp | 8 ++++---- .../examples/Min_sphere_d/min_sphere_homogeneous_3.cpp | 6 +++--- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp index d02136e8426..1d10fde3ece 100644 --- a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp +++ b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #ifdef CGAL_USE_GMP #include @@ -25,10 +26,10 @@ typedef CGAL::Min_annulus_d Min_annulus; int main() { // points on the squares [-1,1]^2 and [-2,2]^2 - Point P[8] = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), + std::array P = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; - Min_annulus ma(P, P+8); + Min_annulus ma(P.begin(), P.end()); assert (ma.is_valid()); // get center of annulus diff --git a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp index 07bb660370b..88e2a295bb4 100644 --- a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp +++ b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp @@ -11,7 +11,7 @@ typedef CGAL::Exact_integer ET; #include #include - +#include // use an inexact kernel... typedef CGAL::Homogeneous K; typedef K::Point_2 Point; @@ -24,10 +24,10 @@ typedef CGAL::Min_annulus_d Min_annulus; int main() { // points on the squares [-1,1]^2 and [-2,2]^2 - Point P[8] = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), + std::array P = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; - Min_annulus ma(P, P+8); + Min_annulus ma(P.begin(), P.end()); assert (ma.is_valid()); // get center of annulus diff --git a/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp b/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp index a5f5935e5b4..74677b064c9 100644 --- a/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp +++ b/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp @@ -4,7 +4,7 @@ #include #include - +#include typedef CGAL::Exact_rational NT; typedef CGAL::Cartesian K; typedef CGAL::Point_2 Point; @@ -16,20 +16,20 @@ int main( int, char**) { const int n = 200; - Point P[n]; + std::array P; for ( int i = 0; i < n; ++i) - P[ i] = Point( i % 2 ? i : -i , 0); + P.at(i) = Point( i % 2 ? i : -i , 0); // (0,0), (-1,0), (2,0), (-3,0) std::cout << "Computing ellipse (without randomization)..."; std::cout.flush(); - Min_ellipse me1( P, P+n, false); // very slow + Min_ellipse me1( P.begin(), P.end(), false); // very slow std::cout << "done." << std::endl; std::cout << "Computing ellipse (with randomization)..."; std::cout.flush(); - Min_ellipse me2( P, P+n, true); // fast + Min_ellipse me2( P.begin(), P.end(), true); // fast std::cout << "done." << std::endl; // because all input points are collinear, the ellipse is diff --git a/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp b/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp index 32e92903271..f581df9bd58 100644 --- a/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp +++ b/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp @@ -5,7 +5,7 @@ #include #include - +#include typedef CGAL::Simple_cartesian K; typedef CGAL::Min_sphere_of_points_d_traits_3 Traits; typedef CGAL::Min_sphere_of_spheres_d Min_sphere; @@ -16,16 +16,16 @@ const int d = 3; // dimension of points int main () { - Point P[n]; // n points + std::array P; // n points CGAL::Random r; // random number generator for (int i=0; i P; // n points CGAL::Random r; // random number generator for (int i=0; i Date: Tue, 28 Jan 2025 19:10:52 +0530 Subject: [PATCH 7/9] fixed indentation and new line after header inclusion --- Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp | 2 +- .../examples/Min_annulus_d/min_annulus_d_fast_exact.cpp | 3 ++- Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp index 1d10fde3ece..b9ccd6cd412 100644 --- a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp +++ b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp @@ -27,7 +27,7 @@ int main() { // points on the squares [-1,1]^2 and [-2,2]^2 std::array P = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), - Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; + Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; Min_annulus ma(P.begin(), P.end()); assert (ma.is_valid()); diff --git a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp index 88e2a295bb4..5f8e5c5517d 100644 --- a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp +++ b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp @@ -12,6 +12,7 @@ typedef CGAL::Exact_integer ET; #include #include #include + // use an inexact kernel... typedef CGAL::Homogeneous K; typedef K::Point_2 Point; @@ -25,7 +26,7 @@ int main() { // points on the squares [-1,1]^2 and [-2,2]^2 std::array P = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), - Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; + Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; Min_annulus ma(P.begin(), P.end()); assert (ma.is_valid()); diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp index a899152fad8..a3fcbfa7c4d 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_2.cpp @@ -5,6 +5,7 @@ #include #include + typedef CGAL::Simple_cartesian K; typedef CGAL::Min_sphere_of_points_d_traits_2 Traits; typedef CGAL::Min_sphere_of_spheres_d Min_circle; From 9b0450f541c6f98173187fc916bceb175f5cc886 Mon Sep 17 00:00:00 2001 From: Anirudh Lakhanpal Date: Wed, 29 Jan 2025 20:09:12 +0530 Subject: [PATCH 8/9] made required changes related to indentation and include spacing --- Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp | 2 +- .../examples/Min_circle_2/min_circle_homogeneous_2.cpp | 1 + Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp | 1 + Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp | 1 + .../examples/Min_sphere_d/min_sphere_homogeneous_3.cpp | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp index b9ccd6cd412..15a4ee3f1f6 100644 --- a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp +++ b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d.cpp @@ -27,7 +27,7 @@ int main() { // points on the squares [-1,1]^2 and [-2,2]^2 std::array P = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), - Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; + Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; Min_annulus ma(P.begin(), P.end()); assert (ma.is_valid()); diff --git a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp index 90e8fffc663..4cdc3a56d57 100644 --- a/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp +++ b/Bounding_volumes/examples/Min_circle_2/min_circle_homogeneous_2.cpp @@ -2,6 +2,7 @@ #include #include #include + #include #include diff --git a/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp b/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp index 74677b064c9..6012d079933 100644 --- a/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp +++ b/Bounding_volumes/examples/Min_ellipse_2/min_ellipse_2.cpp @@ -5,6 +5,7 @@ #include #include + typedef CGAL::Exact_rational NT; typedef CGAL::Cartesian K; typedef CGAL::Point_2 Point; diff --git a/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp b/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp index f581df9bd58..9c2a5222ef1 100644 --- a/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp +++ b/Bounding_volumes/examples/Min_sphere_d/min_sphere_3.cpp @@ -6,6 +6,7 @@ #include #include #include + typedef CGAL::Simple_cartesian K; typedef CGAL::Min_sphere_of_points_d_traits_3 Traits; typedef CGAL::Min_sphere_of_spheres_d Min_sphere; diff --git a/Bounding_volumes/examples/Min_sphere_d/min_sphere_homogeneous_3.cpp b/Bounding_volumes/examples/Min_sphere_d/min_sphere_homogeneous_3.cpp index ea1d14b4590..936e566c60b 100644 --- a/Bounding_volumes/examples/Min_sphere_d/min_sphere_homogeneous_3.cpp +++ b/Bounding_volumes/examples/Min_sphere_d/min_sphere_homogeneous_3.cpp @@ -6,6 +6,7 @@ #include #include +#include typedef CGAL::Homogeneous K; typedef CGAL::Min_sphere_annulus_d_traits_3 Traits; From 89d5b50f3232f6e462a3cbc97fcce280b160e6a8 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 29 Jan 2025 16:17:20 +0100 Subject: [PATCH 9/9] Update Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp --- .../examples/Min_annulus_d/min_annulus_d_fast_exact.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp index 5f8e5c5517d..8c4de47087e 100644 --- a/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp +++ b/Bounding_volumes/examples/Min_annulus_d/min_annulus_d_fast_exact.cpp @@ -26,7 +26,7 @@ int main() { // points on the squares [-1,1]^2 and [-2,2]^2 std::array P = { Point(-1,-1), Point(-1,1), Point(1,-1), Point(1,1), - Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; + Point(-2,-2), Point(-2,2), Point(2,-2), Point(2,2)}; Min_annulus ma(P.begin(), P.end()); assert (ma.is_valid());