diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp index 2fed27334fc..bde12918ab3 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter.cpp @@ -27,23 +27,17 @@ typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; -// instead of -// typedef CGAL::Cartesian Rat_kernel; -// typedef CGAL::Cartesian Alg_kernel; -// typedef CGAL::Arr_Bezier_curve_traits_2 -// Traits_2; -// workaround for VC++ -struct Rat_kernel : public CGAL::Cartesian {}; -struct Alg_kernel : public CGAL::Cartesian {}; -struct Traits_2 : - public CGAL::Arr_Bezier_curve_traits_2 {}; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_Bezier_curve_traits_2 + Traits_2; typedef Rat_kernel::Point_2 Rat_point_2; typedef Traits_2::Curve_2 Bezier_curve_2; typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef CGAL::Gps_traits_2 Gps_traits_2; -typedef Gps_traits_2::General_polygon_2 Polygon_2; -typedef Gps_traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; +typedef Gps_traits_2::General_polygon_2 Polygon_2; +typedef Gps_traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; typedef std::list Polygon_set; /*! Read a general polygon with holes, formed by Bezier curves, from the @@ -65,15 +59,14 @@ bool read_Bezier_polygon (const char* filename, Polygon_with_holes_2& P) // Read the curves one by one, and construct the general polygon these // curve form (the outer boundary and the holes inside it). - Traits_2 traits; - Traits_2::Make_x_monotone_2 make_x_monotone = - traits.make_x_monotone_2_object(); - bool first = true; - Rat_point_2 p_0; + Traits_2 traits; + Traits_2::Make_x_monotone_2 mk_x_monotone = traits.make_x_monotone_2_object(); + bool first = true; + Rat_point_2 p_0; std::list xcvs; - Rat_kernel ker; - Rat_kernel::Equal_2 equal = ker.equal_2_object(); - std::list pgns; + Rat_kernel ker; + Rat_kernel::Equal_2 equal = ker.equal_2_object(); + std::list pgns; for (k = 0; k < n_curves; k++) { // Read the current curve and subdivide it into x-monotone subcurves. @@ -83,7 +76,7 @@ bool read_Bezier_polygon (const char* filename, Polygon_with_holes_2& P) X_monotone_curve_2 xcv; in_file >> B; - make_x_monotone (B, std::back_inserter (x_objs)); + mk_x_monotone (B, std::back_inserter (x_objs)); for (xoit = x_objs.begin(); xoit != x_objs.end(); ++xoit) { if (CGAL::assign (xcv, *xoit)) @@ -130,12 +123,12 @@ bool read_Bezier_polygon (const char* filename, Polygon_with_holes_2& P) } // The main program. -int main (int argc, char *argv[]) +int main (int argc, char* argv[]) { // Get the name of the input files from the command line, or use the default // char_g.dat and char_m.dat files if no command-line parameters are given. - const char *filename1 = (argc > 1) ? argv[1] : "char_g.dat"; - const char *filename2 = (argc > 2) ? argv[2] : "char_m.dat"; + const char* filename1 = (argc > 1) ? argv[1] : "char_g.dat"; + const char* filename2 = (argc > 2) ? argv[2] : "char_m.dat"; // Read the general polygons from the input files. CGAL::Timer timer; diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp index 48a2b1a01b2..f1d859964a5 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp @@ -28,16 +28,10 @@ typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; -// instead of -// typedef CGAL::Cartesian Rat_kernel; -// typedef CGAL::Cartesian Alg_kernel; -// typedef CGAL::Arr_Bezier_curve_traits_2 -// Traits_2; -// workaround for VC++ -struct Rat_kernel : public CGAL::Cartesian {}; -struct Alg_kernel : public CGAL::Cartesian {}; -struct Traits_2 : - public CGAL::Arr_Bezier_curve_traits_2 {}; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_Bezier_curve_traits_2 + Traits_2; typedef Rat_kernel::Point_2 Bezier_rat_point; typedef Traits_2::Curve_2 Bezier_curve; @@ -97,7 +91,8 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) std::string format ; std::getline(in_file,format); - bool lDoubleFormat = ( format.length() >= 6 && format.substr(0,6) == "DOUBLE") ; + bool lDoubleFormat = ( format.length() >= 6 && + format.substr(0,6) == "DOUBLE") ; // Red the number of bezier polygon with holes unsigned int n_regions ; @@ -130,7 +125,8 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) std::list::const_iterator xoit; Bezier_X_monotone_curve xcv; Bezier_traits traits; - Bezier_traits::Make_x_monotone_2 make_x_monotone = traits.make_x_monotone_2_object(); + Bezier_traits::Make_x_monotone_2 make_x_monotone = + traits.make_x_monotone_2_object(); Bezier_curve B = read_bezier_curve(in_file, lDoubleFormat); if ( B.number_of_control_points() >= 2 ) @@ -153,7 +149,8 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) CGAL::Orientation orient = pgn.orientation(); std::cout << " Orientation: " << orient << std::endl ; - if (( b == 0 && orient == CGAL::CLOCKWISE) || ( b > 0 && orient == CGAL::COUNTERCLOCKWISE)) + if (( b == 0 && orient == CGAL::CLOCKWISE) || + ( b > 0 && orient == CGAL::COUNTERCLOCKWISE)) { std::cout << " Reversing orientation: " << std::endl ; pgn.reverse_orientation(); @@ -168,22 +165,24 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) if ( polygons.size() > 1 ) { - for ( Bezier_polygon_vector::const_iterator it = CGAL::successor(polygons.begin()) - ; it != polygons.end() - ; ++ it - ) + Bezier_polygon_vector::const_iterator it; + for ( it = CGAL::successor(polygons.begin()); it != polygons.end(); + ++ it ) pwh.add_hole(*it); } if ( is_valid_polygon_with_holes(pwh, rSet.traits() ) ) { - std::cout << " Inserting bezier polygon with holes made of " << polygons.size() << " boundaries into Set." << std::endl ; + std::cout << " Inserting bezier polygon with holes made of " + << polygons.size() << " boundaries into Set." + << std::endl ; rSet.join(pwh) ; std::cout << " Done." << std::endl ; } else { - std::cout << " **** Bezier polygon wiht holes IS NOT VALID ****" << std::endl ; + std::cout << " **** Bezier polygon wiht holes IS NOT VALID ****" + << std::endl ; } } @@ -192,11 +191,13 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) } catch( std::exception const& x ) { - std::cout << "Exception ocurred during reading of bezier polygon set:" << x.what() << std::endl ; + std::cout << "Exception ocurred during reading of bezier polygon set:" + << x.what() << std::endl ; } catch(...) { - std::cout << "Exception ocurred during reading of bezier polygon set." << std::endl ; + std::cout << "Exception ocurred during reading of bezier polygon set." + << std::endl ; } } @@ -204,11 +205,11 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) } // The main program. -int main (int argc, char **argv) +int main (int argc, char* argv[]) { - const char *filename1 = (argc > 1) ? argv[1] : "char_g.bps"; - const char *filename2 = (argc > 2) ? argv[2] : "char_m.bps"; - const char *bop = (argc > 3) ? argv[3] : "i"; + const char* filename1 = (argc > 1) ? argv[1] : "char_g.bps"; + const char* filename2 = (argc > 2) ? argv[2] : "char_m.bps"; + const char* bop = (argc > 3) ? argv[3] : "i"; // Read the general polygons from the input files. CGAL::Timer timer; @@ -244,11 +245,12 @@ int main (int argc, char **argv) } catch( std::exception const& x ) { - std::cout << "Exception ocurred during the boolean operation:" << x.what() << std::endl ; + std::cout << "Exception ocurred during the boolean operation:" << x.what() + << std::endl ; } catch(...) { - std::cout << "Exception ocurred during the boolean operation." << std::endl ; + std::cout << "Exception ocurred during the boolean operation." << std::endl; } timer.stop(); diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp index 1eb31752b60..77aeb25e426 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/circle_segment.cpp @@ -2,25 +2,23 @@ * Handling circles and linear segments concurrently. */ -#include "bso_rational_nt.h" -#include +#include #include #include #include #include -typedef CGAL::Lazy_exact_nt Lazy_exact_nt; -typedef CGAL::Cartesian Kernel; -typedef Kernel::Point_2 Point_2; -typedef Kernel::Circle_2 Circle_2; -typedef CGAL::Gps_circle_segment_traits_2 Traits_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef Kernel::Circle_2 Circle_2; +typedef CGAL::Gps_circle_segment_traits_2 Traits_2; -typedef CGAL::General_polygon_set_2 Polygon_set_2; -typedef Traits_2::General_polygon_2 Polygon_2; -typedef Traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; -typedef Traits_2::Curve_2 Curve_2; -typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef CGAL::General_polygon_set_2 Polygon_set_2; +typedef Traits_2::General_polygon_2 Polygon_2; +typedef Traits_2::General_polygon_with_holes_2 Polygon_with_holes_2; +typedef Traits_2::Curve_2 Curve_2; +typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; // Construct a polygon from a circle. Polygon_2 construct_polygon (const Circle_2& circle) diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp index 7d25d9c6779..1bcabc2ee3d 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/conic_traits_adapter.cpp @@ -26,16 +26,10 @@ typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; -// instead of -//typedef CGAL::Cartesian Rat_kernel; -//typedef CGAL::Cartesian Alg_kernel; -//typedef CGAL::Arr_conic_traits_2 -// Conic_traits_2; -// workaround for VC++ -struct Rat_kernel : public CGAL::Cartesian {}; -struct Alg_kernel : public CGAL::Cartesian {}; -struct Conic_traits_2 : - public CGAL::Arr_conic_traits_2 {}; +typedef CGAL::Cartesian Rat_kernel; +typedef CGAL::Cartesian Alg_kernel; +typedef CGAL::Arr_conic_traits_2 + Conic_traits_2; typedef CGAL::General_polygon_2 Polygon_2; typedef CGAL::Gps_traits_2 Traits_2; diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/connect_polygon.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/connect_polygon.cpp index 87c49df2792..9f38405097e 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/connect_polygon.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/connect_polygon.cpp @@ -2,31 +2,28 @@ * Connecting a polygon with holes. */ -#include "bso_rational_nt.h" -#include +#include #include #include -typedef CGAL::Cartesian Kernel; -typedef Kernel::Point_2 Point_2; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; -int main (int argc, char **argv) +int main (int argc, char* argv[]) { // Get the name of the input file from the command line, or use the default // pgn_holes.dat file if no command-line parameters are given. //more data files can be found under test data //boundary no other connections are made. - const char *filename = (argc > 1) ? argv[1] : "pgn_holes.dat"; - + const char* filename = (argc > 1) ? argv[1] : "pgn_holes.dat"; std::ifstream input_file (filename); - if (! input_file.is_open()) { std::cerr << "Failed to open the " << filename < +#include #include -// instead of -//typedef CGAL::Cartesian Kernel; -// workaround for VC++ -struct Kernel : public CGAL::Cartesian {}; -typedef Kernel::Point_2 Point_2; -typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; #include "print_utils.h" diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/dxf_union.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/dxf_union.cpp index 7f452985d58..039c1cf7587 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/dxf_union.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/dxf_union.cpp @@ -2,9 +2,7 @@ * Computing the union of a set of circular polygons read from a DXF file. */ -#include "bso_rational_nt.h" -#include -#include +#include #include #include #include @@ -14,8 +12,7 @@ #include #include -typedef CGAL::Lazy_exact_nt Lazy_exact_nt; -typedef CGAL::Cartesian Kernel; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Gps_circle_segment_traits_2 Traits_2; typedef Traits_2::Polygon_2 Circ_polygon_2; typedef Traits_2::Polygon_with_holes_2 Circ_polygon_with_holes_2; @@ -27,20 +24,15 @@ static const int DEFAULT_GROUP_SIZE = 5; // The command line should be: // ex_dxf_union [DXF file] [simplify] [group size] -int main (int argc, char **argv) +int main (int argc, char* argv[]) { // Open the input DXF file. - const char *filename = "test.dxf"; - - if (argc >= 2) - filename = argv[1]; - + const char* filename = (argc >= 2) ? argv[1] : "test.dxf"; std::ifstream input_file (filename); - if (! input_file.is_open()) { std::cerr << "Failed to open the " << filename < +#include #include #include #include #include -// instead of -//typedef CGAL::Cartesian Kernel; -// workaround for VC++ -struct Kernel : public CGAL::Cartesian {}; - -typedef Kernel::Point_2 Point_2; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; -typedef CGAL::Polygon_set_2 Polygon_set_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; +typedef CGAL::Polygon_set_2 Polygon_set_2; #include "print_utils.h" diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp index b773a38e6b2..c86ab45606b 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/set_union.cpp @@ -2,8 +2,7 @@ * Computing the union of a set of circles. */ -#include "bso_rational_nt.h" -#include +#include #include #include #include @@ -12,17 +11,16 @@ #include #include -typedef CGAL::Lazy_exact_nt Lazy_exact_nt; -typedef CGAL::Cartesian Kernel; -typedef Kernel::Point_2 Point_2; -typedef Kernel::Circle_2 Circle_2; -typedef CGAL::Gps_circle_segment_traits_2 Traits_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef Kernel::Circle_2 Circle_2; +typedef CGAL::Gps_circle_segment_traits_2 Traits_2; -typedef CGAL::General_polygon_set_2 Polygon_set_2; -typedef Traits_2::Polygon_2 Polygon_2; -typedef Traits_2::Polygon_with_holes_2 Polygon_with_holes_2; -typedef Traits_2::Curve_2 Curve_2; -typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; +typedef CGAL::General_polygon_set_2 Polygon_set_2; +typedef Traits_2::Polygon_2 Polygon_2; +typedef Traits_2::Polygon_with_holes_2 Polygon_with_holes_2; +typedef Traits_2::Curve_2 Curve_2; +typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; // Construct a polygon from a circle. Polygon_2 construct_polygon (const Circle_2& circle) @@ -48,7 +46,7 @@ Polygon_2 construct_polygon (const Circle_2& circle) } // The main program: -int main (int argc, char * argv[]) +int main (int argc, char* argv[]) { // Read the number of circles from the command line. unsigned int n_circles = 8; diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/simple_join_intersect.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/simple_join_intersect.cpp index 059e7f6944e..e031611a54d 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/simple_join_intersect.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/simple_join_intersect.cpp @@ -2,20 +2,15 @@ * Computing the union and the intersection of two simple polygons. */ -#include "bso_rational_nt.h" -#include +#include #include #include -// instead of -//typedef CGAL::Cartesian Kernel; -// workaround for VC++ -struct Kernel : public CGAL::Cartesian {}; - -typedef Kernel::Point_2 Point_2; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; -typedef std::list Pwh_list_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; +typedef std::list Pwh_list_2; #include "print_utils.h" diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/symmetric_difference.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/symmetric_difference.cpp index 594f5dcdc34..ccd2fdff9a8 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/symmetric_difference.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/symmetric_difference.cpp @@ -2,21 +2,16 @@ * Computing the symmetric difference of two polygons with holes. */ -#include "bso_rational_nt.h" -#include +#include #include #include -// instead of -//typedef CGAL::Cartesian Kernel; -// workaround for VC++ -struct Kernel : public CGAL::Cartesian {}; - -typedef Kernel::Point_2 Point_2; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; -typedef std::list Pwh_list_2; +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; +typedef std::list Pwh_list_2; #include "print_utils.h"