From a2fc6e18309e0d94ac22bff75a8f652ce11d997c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Oct 2017 12:55:21 +0100 Subject: [PATCH] Make Partition_2 work with g++ --- Nef_S2/include/CGAL/Nef_S2/Sphere_circle.h | 3 ++- Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h | 11 ++++++++--- .../include/CGAL/Partition_2/Indirect_edge_compare.h | 12 ++++++------ .../CGAL/Partition_2/Partition_opt_cvx_edge.h | 3 ++- .../include/CGAL/Partition_2/Partitioned_polygon_2.h | 8 ++++---- .../CGAL/Partition_2/partition_approx_convex_2.h | 3 ++- .../CGAL/Partition_2/partition_optimal_convex_2.h | 11 +++++++---- .../CGAL/Partition_2/partition_y_monotone_2.h | 11 ++++++----- .../CGAL/Polygon_2/Polygon_2_algorithms_impl.h | 3 ++- 9 files changed, 39 insertions(+), 26 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_circle.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_circle.h index 7dc5d9442f3..8f01003eb83 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_circle.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_circle.h @@ -71,7 +71,8 @@ between $p$ and $q$. If $p$ and $q$ are antipodal of each other then we create any great circle that contains $p$ and $q$.}*/ { Point_3 p1(0,0,0), p4 = CGAL::ORIGIN + ((Base*) this)->orthogonal_vector(); if ( p != q.antipode() ) { - if (R_().orientation_3_object()(p1,p,q,p4) != CGAL::POSITIVE ) + if (R_().orientation_3_object()(p1,Point_3(p), + Point_3(q), p4) != CGAL::POSITIVE ) *this = Self(opposite()); } else { /* previous method was: *this = Self(Plane_3(p1,q-p)); diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h index 9c8feaadae2..e8a420b186e 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h @@ -193,13 +193,18 @@ void split_halfcircle(Sphere_segment& s1, bool is_short() const /*{\Mop a segment is short iff it is shorter than a halfcircle.}*/ { - return R().orientation_3_object()(Point_3(0,0,0), source(), target(), - CGAL::ORIGIN + this->ptr()->c_.orthogonal_vector()) + return R().orientation_3_object()(Point_3(0,0,0), + Point_3(source()), + Point_3(target()), + CGAL::ORIGIN + + this->ptr()->c_.orthogonal_vector()) == CGAL::POSITIVE; } bool is_long() const /*{\Mop a segment is long iff it is longer than a halfcircle.}*/ -{ return R().orientation_3_object()(Point_3(0,0,0), source(), target(), +{ return R().orientation_3_object()(Point_3(0,0,0), + Point_3(source()), + Point_3(target()), CGAL::ORIGIN + this->ptr()->c_.orthogonal_vector()) == CGAL::NEGATIVE; } diff --git a/Partition_2/include/CGAL/Partition_2/Indirect_edge_compare.h b/Partition_2/include/CGAL/Partition_2/Indirect_edge_compare.h index 6f269f2e877..b856109fd60 100644 --- a/Partition_2/include/CGAL/Partition_2/Indirect_edge_compare.h +++ b/Partition_2/include/CGAL/Partition_2/Indirect_edge_compare.h @@ -61,13 +61,13 @@ class Indirect_edge_compare ForwardCirculator edge_vtx_2 = edge_vtx_1; edge_vtx_2++; // check for horizontal edge - if(_compare_y_2((*edge_vtx_1), (*edge_vtx_2)) == EQUAL) + if(_compare_y_2(Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)) == EQUAL) { // compare the smaller x and vertex x - if(_compare_x_2(*edge_vtx_1, *edge_vtx_2) == SMALLER) - return _compare_x_2(*edge_vtx_1, *vertex) == LARGER; + if(_compare_x_2(Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)) == SMALLER) + return _compare_x_2(Point_2(*edge_vtx_1), Point_2(*vertex)) == LARGER; else - return _compare_x_2(*edge_vtx_2, *vertex) == LARGER; + return _compare_x_2(Point_2(*edge_vtx_2), Point_2(*vertex)) == LARGER; } else { @@ -110,11 +110,11 @@ class Indirect_edge_compare { Point_2 p_max; Point_2 q_max; - if (_compare_x_2(*p, *after_p) == SMALLER) + if (_compare_x_2(Point_2(*p), Point_2(*after_p)) == SMALLER) p_max = *after_p; else p_max = *p; - if (_compare_x_2(*q, *after_q) == SMALLER) + if (_compare_x_2(Point_2(*q), Point_2(*after_q)) == SMALLER) q_max = *after_q; else q_max = *q; diff --git a/Partition_2/include/CGAL/Partition_2/Partition_opt_cvx_edge.h b/Partition_2/include/CGAL/Partition_2/Partition_opt_cvx_edge.h index 8b9432a4e6e..46fd9024d33 100644 --- a/Partition_2/include/CGAL/Partition_2/Partition_opt_cvx_edge.h +++ b/Partition_2/include/CGAL/Partition_2/Partition_opt_cvx_edge.h @@ -67,7 +67,8 @@ public: _validity = PARTITION_OPT_CVX_NOT_VALID; - Turn_reverser right_turn(left_turn); + Turn_reverser right_turn(left_turn); if (right_turn(p1, p2, p3)) _validity = PARTITION_OPT_CVX_START_VALID; if (right_turn(p4, p5, p6)) { diff --git a/Partition_2/include/CGAL/Partition_2/Partitioned_polygon_2.h b/Partition_2/include/CGAL/Partition_2/Partitioned_polygon_2.h index 8c5a0c2b52c..77817ee49c8 100644 --- a/Partition_2/include/CGAL/Partition_2/Partitioned_polygon_2.h +++ b/Partition_2/include/CGAL/Partition_2/Partitioned_polygon_2.h @@ -47,15 +47,15 @@ public: _vertex(vertex), _prev_v_ref(prev_ref) { - _vertex_orientation = _orientation(*_prev_v_ref, vertex, *next_ref); + _vertex_orientation = _orientation(Point_2(*_prev_v_ref), Point_2(vertex), Point_2(*next_ref)); } bool operator()(Iterator d1, Iterator d2) { - Orientation d1_orientation = _orientation(*_prev_v_ref, _vertex, *d1); - Orientation d2_orientation = _orientation(*_prev_v_ref, _vertex, *d2); - Orientation d1_to_d2 = _orientation(*d1, _vertex, *d2); + Orientation d1_orientation = _orientation(Point_2(*_prev_v_ref), Point_2(_vertex), Point_2(*d1)); + Orientation d2_orientation = _orientation(Point_2(*_prev_v_ref), Point_2(_vertex), Point_2(*d2)); + Orientation d1_to_d2 = _orientation(Point_2(*d1), Point_2(_vertex), Point_2(*d2)); // if both diagonals are on the same side of the line from previous // vertex to this vertex then d1 comes before d2 (in CW order from diff --git a/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h index 0fcec830a29..29d14ee2e19 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h @@ -53,8 +53,9 @@ bool partition_appx_cvx_is_edge_through_interior(const Point_2& before_s, { // determine if the edge goes through the interior of the polygon or not typedef typename Traits::Left_turn_2 Left_turn_2; + typedef typename Traits::Point_2 Bare_point_2; Left_turn_2 left_turn = traits.left_turn_2_object(); - Turn_reverser right_turn(left_turn); + Turn_reverser right_turn(left_turn); if (right_turn(before_s, source, after_s)) // concave angle { if (right_turn(before_s, source, target) && diff --git a/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h index 8ea50ad3f0a..6486c724875 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h @@ -209,11 +209,13 @@ bool collinearly_visible(unsigned int edge_num1, unsigned int e_num, const Traits& traits) { typedef typename Traits::Orientation_2 Orientation_2; + typedef typename Traits::Point_2 Point_2; Orientation_2 orientation = traits.orientation_2_object(); if ((e_num == edge_num1+1 || e_num+1 == edge_num2) && edges[edge_num1][edge_num2].is_visible() && - orientation(polygon[edge_num1], polygon[e_num], polygon[edge_num2]) == + orientation(Point_2(polygon[edge_num1]), Point_2(polygon[e_num]), + Point_2(polygon[edge_num2])) == COLLINEAR) return true; else @@ -364,6 +366,7 @@ void make_collinear_vertices_visible(Polygon& polygon, { typedef typename Polygon::size_type size_type; typedef typename Traits::Orientation_2 Orientation_2; + typedef typename Traits::Point_2 Point_2; Orientation_2 orientation = traits.orientation_2_object(); size_type i; @@ -380,7 +383,7 @@ void make_collinear_vertices_visible(Polygon& polygon, j = 1; size_type start_i = 0; while (i > 0 && - orientation(polygon[i], polygon[prev_j], polygon[j]) == COLLINEAR) + orientation(Point_2(polygon[i]), Point_2(polygon[prev_j]), Point_2(polygon[j])) == COLLINEAR) { prev_j = i; start_i = i; @@ -390,7 +393,7 @@ void make_collinear_vertices_visible(Polygon& polygon, prev_j = 1; j = 2; while (j < polygon.size() && - orientation(polygon[i], polygon[prev_j], polygon[j]) == COLLINEAR) + orientation(Point_2(polygon[i]), Point_2(polygon[prev_j]), Point_2(polygon[j])) == COLLINEAR) { i++; prev_j++; @@ -419,7 +422,7 @@ void make_collinear_vertices_visible(Polygon& polygon, prev_j = i+1; j = i+2; while (j < polygon.size() && - orientation(polygon[i], polygon[prev_j], polygon[j]) == + orientation(Point_2(polygon[i]), Point_2(polygon[prev_j]), Point_2(polygon[j])) == COLLINEAR) { j++; diff --git a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h index a4b9179476a..92d0eec4431 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h @@ -83,8 +83,8 @@ Partition_y_mono_vertex_type partition_y_mono_vertex_type( #endif typename Traits::Compare_y_2 compare_y_2 = traits.compare_y_2_object(); - if (compare_y_2(*previous, *c) == EQUAL && - compare_y_2(*next, *c) == EQUAL) + if (compare_y_2(Point_2(*previous), Point_2(*c)) == EQUAL && + compare_y_2(Point_2(*next), Point_2(*c)) == EQUAL) return PARTITION_Y_MONO_COLLINEAR_VERTEX; typename Traits::Less_yx_2 less_yx = traits.less_yx_2_object(); @@ -300,16 +300,17 @@ template bool partition_y_mono_interior_to_right(BidirectionalCirculator c, const Traits& traits) { + typedef typename Traits::Point_2 Point_2; typename Traits::Compare_y_2 compare_y_2 = traits.compare_y_2_object(); - + BidirectionalCirculator previous = c; previous--; - Comparison_result cmp_y = compare_y_2(*previous, *c); + Comparison_result cmp_y = compare_y_2(Point_2(*previous), Point_2(*c)); if (cmp_y == LARGER) return true; BidirectionalCirculator next = c; next++; - if (cmp_y == EQUAL && compare_y_2(*next, *c) == SMALLER) return true; + if (cmp_y == EQUAL && compare_y_2(Point_2(*next), Point_2(*c)) == SMALLER) return true; return false; } diff --git a/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h b/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h index 03d79f002b7..2ae98e403cc 100644 --- a/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h +++ b/Polygon/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h @@ -416,7 +416,8 @@ Orientation orientation_2(ForwardIterator first, // of the points (prev,i,next) will coincide // return the orientation of the triple (prev,i,next) - return traits.orientation_2_object()(*prev, *i, *next); + typedef typename Traits::Point_2 Point; + return traits.orientation_2_object()(Point(*prev), Point(*i), Point(*next)); } } //namespace CGAL