From f1398a80dfee6ff6859c6c311b392640059ba5a5 Mon Sep 17 00:00:00 2001 From: Shai Hirsch Date: Fri, 3 May 2002 10:09:59 +0000 Subject: [PATCH] Changing Point, Curve and X_curve to their _2 versions. --- .../examples/Sweep_line_2/example1.C | 14 ++++---- .../examples/Sweep_line_2/example2.C | 30 ++++++++--------- .../examples/Sweep_line_2/example3.C | 14 ++++---- .../examples/Sweep_line_2/example4.C | 32 ++++++++----------- .../examples/Sweep_line_2/example5.C | 16 +++++----- 5 files changed, 49 insertions(+), 57 deletions(-) diff --git a/Packages/Sweep_line_2/examples/Sweep_line_2/example1.C b/Packages/Sweep_line_2/examples/Sweep_line_2/example1.C index 1eec3808d9e..342bf3bccc5 100644 --- a/Packages/Sweep_line_2/examples/Sweep_line_2/example1.C +++ b/Packages/Sweep_line_2/examples/Sweep_line_2/example1.C @@ -41,9 +41,9 @@ typedef CGAL::Quotient NT; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_exact_traits Traits; -typedef Traits::Point Point; -typedef Traits::X_curve X_curve; -typedef Traits::Curve Curve; +typedef Traits::Point_2 Point_2; +typedef Traits::X_curve_2 X_curve_2; +typedef Traits::Curve_2 Curve_2; typedef CGAL::Pm_default_dcel Dcel; typedef CGAL::Planar_map_2 PM; @@ -51,9 +51,9 @@ typedef CGAL::Pm_file_writer Pm_writer; int main() { - PM pm; - int num_segments; - std::vector segments; + PM pm; + int num_segments; + std::vector segments; std::cout << " * * * Demonstrating a trivial use of the sweep line algorithm" << std::endl << std::endl; @@ -66,7 +66,7 @@ int main() while (num_segments--) { std::cin >> x1 >> y1 >> x2 >> y2; - segments.push_back(Curve(Point(x1, y1), Point(x2, y2))); + segments.push_back(Curve_2(Point_2(x1, y1), Point_2(x2, y2))); } // Construct the planar map Traits traits; diff --git a/Packages/Sweep_line_2/examples/Sweep_line_2/example2.C b/Packages/Sweep_line_2/examples/Sweep_line_2/example2.C index 9b257aa296b..e78332e4f70 100644 --- a/Packages/Sweep_line_2/examples/Sweep_line_2/example2.C +++ b/Packages/Sweep_line_2/examples/Sweep_line_2/example2.C @@ -19,35 +19,33 @@ typedef CGAL::Quotient NT; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_polyline_traits Traits; -typedef Traits::Point Point; -typedef Traits::Curve Curve; +typedef Traits::Point_2 Point_2; +typedef Traits::Curve_2 Curve_2; typedef CGAL::Pm_default_dcel Dcel; typedef CGAL::Planar_map_2 PM; typedef CGAL::Pm_file_writer Pm_writer; -CGAL_BEGIN_NAMESPACE - -std::ostream & operator<<(std::ostream & os, const Curve & cv) +std::ostream & operator<<(std::ostream & os, const Curve_2 & cv) { - typedef Curve::const_iterator Points_iterator; + typedef Curve_2::const_iterator Points_iterator; - os<>(std::istream & in, Curve & cv) +std::istream & operator>>(std::istream & in, Curve_2 & cv) { std::size_t size; in >> size; for (unsigned int i = 0; i < size; i++){ - Point p; + Point_2 p; in >> p; cv.push_back(p); } @@ -55,30 +53,28 @@ std::istream & operator>>(std::istream & in, Curve & cv) return in; } -CGAL_END_NAMESPACE - // Read polylines from the input template void read_polylines(Container& curves) { - int num_polylines = 0; + int num_polylines = 0; std::cin >> num_polylines; std::cout << "number of polylines is : " << num_polylines << std::endl; while (num_polylines--) { - Curve polyline; + Curve_2 polyline; - std::cin>>polyline; + std::cin >> polyline; curves.push_back(polyline); } } int main() { - PM pm; - std::vector polylines; + PM pm; + std::vector polylines; // Read input read_polylines(polylines); diff --git a/Packages/Sweep_line_2/examples/Sweep_line_2/example3.C b/Packages/Sweep_line_2/examples/Sweep_line_2/example3.C index 3fb68188748..8633ce81c84 100644 --- a/Packages/Sweep_line_2/examples/Sweep_line_2/example3.C +++ b/Packages/Sweep_line_2/examples/Sweep_line_2/example3.C @@ -13,15 +13,15 @@ typedef CGAL::Quotient NT; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_exact_traits Traits; -typedef Traits::Point Point; -typedef Traits::Curve Curve; +typedef Traits::Point_2 Point_2; +typedef Traits::Curve_2 Curve_2; int main() { // Read input - int num_segments; - std::list segments; + int num_segments; + std::list segments; std::cin >> num_segments; NT x1, y1, x2, y2; @@ -29,12 +29,12 @@ int main() while (num_segments--) { std::cin >> x1 >> y1 >> x2 >> y2; - segments.push_back(Curve(Point(x1, y1), Point(x2, y2))); + segments.push_back(Curve_2(Point_2(x1, y1), Point_2(x2, y2))); } // Use a sweep to create the sub curves Traits traits; - std::list subcurves; + std::list subcurves; CGAL::sweep_to_produce_subcurves_2(segments.begin(), segments.end(), traits, @@ -46,7 +46,7 @@ int main() << subcurves.size(); std::cout << std::endl; - for (std::list::iterator scv_iter = subcurves.begin(); + for (std::list::iterator scv_iter = subcurves.begin(); scv_iter != subcurves.end(); scv_iter++) std::cout<< *scv_iter<< std::endl; diff --git a/Packages/Sweep_line_2/examples/Sweep_line_2/example4.C b/Packages/Sweep_line_2/examples/Sweep_line_2/example4.C index bf082cafbd7..cb789710bb7 100644 --- a/Packages/Sweep_line_2/examples/Sweep_line_2/example4.C +++ b/Packages/Sweep_line_2/examples/Sweep_line_2/example4.C @@ -16,38 +16,34 @@ typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_polyline_traits Traits; -typedef Traits::Point Point; -typedef Traits::Curve Curve; +typedef Traits::Point_2 Point_2; +typedef Traits::Curve_2 Curve_2; -CGAL_BEGIN_NAMESPACE - -std::ostream & operator<<(std::ostream & os, const Curve & cv) +std::ostream & operator<<(std::ostream & os, const Curve_2 & cv) { - typedef Curve::const_iterator Points_iterator; + typedef Curve_2::const_iterator Points_iterator; - os<>(std::istream & in, Curve & cv) +std::istream & operator>>(std::istream & in, Curve_2 & cv) { - std::size_t size; + std::size_t size; in >> size; for (unsigned int i = 0; i < size; i++){ - Point p; + Point_2 p; in >> p; cv.push_back(p); } return in; } -CGAL_END_NAMESPACE - // Read polylines from the input template @@ -56,10 +52,10 @@ void read_polylines(Container & curves) int num_polylines = 0; std::cin >> num_polylines; - std::cout<<"number of polylines is : " << num_polylines<>polyline; curves.push_back(polyline); polyline.clear(); @@ -68,17 +64,17 @@ void read_polylines(Container & curves) int main() { // Read input - std::list polylines; + std::list polylines; read_polylines(polylines); // Use a sweep to create the sub curves Traits traits; - std::list subcurves; + std::list subcurves; CGAL::sweep_to_produce_subcurves_2(polylines.begin(),polylines.end(), traits, std::back_inserter(subcurves)); // Write output - for (std::list::iterator scv_iter = subcurves.begin(); + for (std::list::iterator scv_iter = subcurves.begin(); scv_iter != subcurves.end(); scv_iter++) std::cout << *scv_iter << std::endl; diff --git a/Packages/Sweep_line_2/examples/Sweep_line_2/example5.C b/Packages/Sweep_line_2/examples/Sweep_line_2/example5.C index c688b526375..1db93954dc0 100644 --- a/Packages/Sweep_line_2/examples/Sweep_line_2/example5.C +++ b/Packages/Sweep_line_2/examples/Sweep_line_2/example5.C @@ -28,17 +28,17 @@ typedef CGAL::Quotient NT; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_exact_traits Traits; -typedef Traits::Point Point; -typedef Traits::Curve Curve; +typedef Traits::Point_2 Point_2; +typedef Traits::Curve_2 Curve_2; typedef CGAL::Pm_default_dcel Dcel; typedef CGAL::Planar_map_2 PM; int main() { - PM pm; - int num_segments; - std::vector segments; + PM pm; + int num_segments; + std::vector segments; std::cout << " * * * Demonstrating a trivial usage of the sweep line "; std::cout << "algorithm" << std::endl << std::endl; @@ -48,13 +48,13 @@ int main() while (num_segments--) { - Curve cv; + Curve_2 cv; std::cin >> cv; segments.push_back(cv); } // Use a sweep to find the points induced in the arrangement - std::vector points; + std::vector points; Traits traits; CGAL::sweep_to_produce_points_2(segments.begin(), segments.end(), @@ -65,7 +65,7 @@ int main() std::cout << " * * * Printing list of all points in the arrangement "; std::cout << "induced by the input segments" << std::endl; - for (std::vector::iterator p_iter = points.begin(); + for (std::vector::iterator p_iter = points.begin(); p_iter != points.end(); ++p_iter) std::cout<< *p_iter << std::endl;