From 3fee342ef73ef7fcd7ddeef10bc315f3d4d38d94 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 4 Apr 2007 13:56:30 +0000 Subject: [PATCH] fixed order of boost and CGAL header files --- .../Arrangement_2/bgl_primal_adapter.cpp | 69 +++++++++---------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/Arrangement_2/examples/Arrangement_2/bgl_primal_adapter.cpp b/Arrangement_2/examples/Arrangement_2/bgl_primal_adapter.cpp index 49d23a9d26b..128656bd462 100644 --- a/Arrangement_2/examples/Arrangement_2/bgl_primal_adapter.cpp +++ b/Arrangement_2/examples/Arrangement_2/bgl_primal_adapter.cpp @@ -5,12 +5,11 @@ #include #include #include - -#include - #include #include +#include + typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Traits_2; typedef Traits_2::Point_2 Point_2; @@ -21,71 +20,65 @@ typedef CGAL::Arrangement_2 Arrangement_2; class Edge_length_func { public: - // Boost property type definitions: - typedef boost::readable_property_map_tag category; - typedef double value_type; - typedef value_type reference; - typedef Arrangement_2::Halfedge_handle key_type; + typedef boost::readable_property_map_tag category; + typedef double value_type; + typedef value_type reference; + typedef Arrangement_2::Halfedge_handle key_type; - double operator() (Arrangement_2::Halfedge_handle e) const + double operator()(Arrangement_2::Halfedge_handle e) const { - const double x1 = CGAL::to_double (e->source()->point().x()); - const double y1 = CGAL::to_double (e->source()->point().y()); - const double x2 = CGAL::to_double (e->target()->point().x()); - const double y2 = CGAL::to_double (e->target()->point().y()); + const double x1 = CGAL::to_double(e->source()->point().x()); + const double y1 = CGAL::to_double(e->source()->point().y()); + const double x2 = CGAL::to_double(e->target()->point().x()); + const double y2 = CGAL::to_double(e->target()->point().y()); const double diff_x = x2 - x1; const double diff_y = y2 - y1; - return (std::sqrt (diff_x*diff_x + diff_y*diff_y)); + return std::sqrt(diff_x*diff_x + diff_y*diff_y); } }; -double get (Edge_length_func edge_length, Arrangement_2::Halfedge_handle e) +double get(Edge_length_func edge_length, Arrangement_2::Halfedge_handle e) { - return (edge_length (e)); + return edge_length(e); } -int main () +int main() { Arrangement_2 arr; // Construct an arrangement of seven intersecting line segments. // We keep a handle for the vertex v_0 that corresponds to the point (1,1). Arrangement_2::Halfedge_handle e = - insert_non_intersecting_curve (arr, Segment_2 (Point_2 (1, 1), - Point_2 (7, 1))); + insert_non_intersecting_curve(arr, Segment_2(Point_2(1, 1), Point_2(7, 1))); Arrangement_2::Vertex_handle v0 = e->source(); - insert_curve (arr, Segment_2 (Point_2 (1, 1), Point_2 (3, 7))); - insert_curve (arr, Segment_2 (Point_2 (1, 4), Point_2 (7, 1))); - insert_curve (arr, Segment_2 (Point_2 (2, 2), Point_2 (9, 3))); - insert_curve (arr, Segment_2 (Point_2 (2, 2), Point_2 (4, 4))); - insert_curve (arr, Segment_2 (Point_2 (7, 1), Point_2 (9, 3))); - insert_curve (arr, Segment_2 (Point_2 (3, 7), Point_2 (9, 3))); + insert_curve(arr, Segment_2(Point_2(1, 1), Point_2(3, 7))); + insert_curve(arr, Segment_2(Point_2(1, 4), Point_2(7, 1))); + insert_curve(arr, Segment_2(Point_2(2, 2), Point_2(9, 3))); + insert_curve(arr, Segment_2(Point_2(2, 2), Point_2(4, 4))); + insert_curve(arr, Segment_2(Point_2(7, 1), Point_2(9, 3))); + insert_curve(arr, Segment_2(Point_2(3, 7), Point_2(9, 3))); // Create a mapping of the arrangement vertices to indices. - CGAL::Arr_vertex_index_map index_map (arr); + CGAL::Arr_vertex_index_map index_map(arr); // Perform Dijkstra's algorithm from the vertex v0. - Edge_length_func edge_length; - CGAL::Arr_vertex_property_map dist_map (index_map); - - boost::dijkstra_shortest_paths (arr, v0, - boost::vertex_index_map (index_map). - weight_map (edge_length). - distance_map (dist_map)); - + Edge_length_func edge_length; + CGAL::Arr_vertex_property_map dist_map(index_map); + boost::dijkstra_shortest_paths(arr, v0, + boost::vertex_index_map(index_map). + weight_map(edge_length). + distance_map(dist_map)); + // Print the results: Arrangement_2::Vertex_iterator vit; std::cout << "The distances of the arrangement vertices from (" << v0->point() << ") :" << std::endl; for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) - { std::cout << "(" << vit->point() << ") at distance " << dist_map[vit] << std::endl; - } - return (0); + return 0; }