// Copyright (c) 2003-2004 Utrecht University (The Netherlands), // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; version 2.1 of the License. // See the file LICENSE.LGPL distributed with CGAL. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // // // Author(s) : Sylvain Pion #ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H #define CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H // Generic functions taking "user classes" as parameters, calling the // internal functions (in *_internal*.h, namespace CGALi) taking a kernel as // additional parameter, which themselves call the corresponding kernel // functors. #include #include #include CGAL_BEGIN_NAMESPACE template < class K > bool operator==(const Point_2 &p, const Origin& o) { return p == Point_2(o); } template < class K > bool operator!=(const Point_2 &p, const Origin& o) { return p != Point_2(o); } template < class K > inline Angle angle(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::angle(p, q, r, K()); } template < class K > inline bool are_ordered_along_line(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::are_ordered_along_line(p, q, r, K()); } template < class K > inline bool are_strictly_ordered_along_line(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::are_strictly_ordered_along_line(p, q, r, K()); } template < class K > inline typename K::FT area(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::area(p, q, r, K()); } template inline typename K::Line_2 bisector(const Point_2 &p, const Point_2 &q) { return CGALi::bisector(p, q, K()); } template inline typename K::Line_2 bisector(const Line_2 &l1, const Line_2 &l2) { return CGALi::bisector(l1, l2, K()); } template < class K > inline typename K::Point_2 centroid(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::centroid(p, q, r, K()); } template < class K > inline typename K::Point_2 centroid(const Triangle_2 &t) { return CGALi::centroid(t, K()); } template < class K > inline typename K::Point_2 centroid(const Point_2 &p, const Point_2 &q, const Point_2 &r, const Point_2 &s) { return CGALi::centroid(p, q, r, s, K()); } template < class K > inline typename K::Point_2 circumcenter(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::circumcenter(p, q, r, K()); } template < class K > inline typename K::Point_2 circumcenter(const Triangle_2 &t) { return CGALi::circumcenter(t, K()); } template < class K > inline bool collinear(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::collinear(p, q, r, K()); } template < class K > inline bool collinear_are_ordered_along_line(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::collinear_are_ordered_along_line(p, q, r, K()); } template < class K > inline bool collinear_are_strictly_ordered_along_line(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::collinear_are_strictly_ordered_along_line(p, q, r, K()); } template < typename K > inline Comparison_result compare_angle_with_x_axis(const Direction_2& d1, const Direction_2& d2) { return CGALi::compare_angle_with_x_axis(d1, d2, K()); } template inline Comparison_result compare_distance_to_point(const Point_2& p, const Point_2& q, const Point_2& r) { return CGALi::compare_distance_to_point(p, q, r, K()); } template inline Comparison_result compare_signed_distance_to_line(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) { return CGALi::compare_signed_distance_to_line(p, q, r, s, K()); } template inline Comparison_result compare_signed_distance_to_line(const Line_2& l, const Point_2& p, const Point_2& q) { return CGALi::compare_signed_distance_to_line(l, p, q, K()); } /* FIXME : Undocumented, obsolete... template < class K > inline Comparison_result compare_lexicographically_xy(const Point_2 &p, const Point_2 &q) { return K().compare_xy_2_object()(p, q); } */ template < class K > inline Comparison_result compare_slopes(const Line_2 &l1, const Line_2 &l2) { return CGALi::compare_slopes(l1, l2, K()); } template < class K > inline Comparison_result compare_slopes(const Segment_2 &s1, const Segment_2 &s2) { return CGALi::compare_slopes(s1, s2, K()); } template < class K > inline Comparison_result compare_x(const Point_2 &p, const Point_2 &q) { return CGALi::compare_x(p, q, K()); } template < class K > inline Comparison_result compare_x(const Point_2& p, const Line_2& l1, const Line_2& l2) { return CGALi::compare_x(p, l1, l2, K()); } template < class K > inline Comparison_result compare_x(const Line_2 &l, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_x(l, h1, h2, K()); } template < class K > inline Comparison_result compare_x(const Line_2 &l1, const Line_2 &h1, const Line_2 &l2, const Line_2 &h2) { return CGALi::compare_x(l1, h1, l2, h2, K()); } template < class K > inline Comparison_result compare_x_at_y(const Point_2& p, const Line_2& h) { return CGALi::compare_x_at_y(p, h, K()); } /* Undocumented template < class K > inline Comparison_result compare_x_at_y(const Point_2& p, const Segment_2& s) { return CGALi::compare_x_at_y(p, s, K()); } */ template < class K > inline Comparison_result compare_x_at_y(const Point_2 &p, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_x_at_y(p, h1, h2, K()); } template < class K > inline Comparison_result compare_x_at_y(const Line_2 &l1, const Line_2 &l2, const Line_2 &h) { return CGALi::compare_x_at_y(l1, l2, h, K()); } template < class K > inline Comparison_result compare_x_at_y(const Line_2 &l1, const Line_2 &l2, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_x_at_y(l1, l2, h1, h2, K()); } template < class K > inline Comparison_result compare_xy(const Point_2 &p, const Point_2 &q) { return CGALi::compare_xy(p, q, K()); } template < class K > inline Comparison_result compare_y(const Point_2 &p, const Point_2 &q) { return CGALi::compare_y(p, q, K()); } template < class K > inline Comparison_result compare_y(const Point_2 &p, const Line_2 &l1, const Line_2 &l2) { return CGALi::compare_y(p, l1, l2, K()); } template < class K > inline Comparison_result compare_y(const Line_2 &l1, const Line_2 &l2, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_y(l1, l2, h1, h2, K()); } template < class K > inline Comparison_result compare_y(const Line_2 &l, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_y(l, h1, h2, K()); } template < class K > inline Comparison_result compare_y_at_x(const Point_2 &p, const Segment_2 &s) { return CGALi::compare_y_at_x(p, s, K()); } template < class K > inline Comparison_result compare_y_at_x(const Point_2 &p, const Segment_2 &s1, const Segment_2 &s2) { return CGALi::compare_y_at_x(p, s1, s2, K()); } template < class K > inline Comparison_result compare_y_at_x(const Point_2 &p, const Line_2 &h) { return CGALi::compare_y_at_x(p, h, K()); } template < class K > inline Comparison_result compare_y_at_x(const Point_2 &p, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_y_at_x(p, h1, h2, K()); } template < class K > inline Comparison_result compare_y_at_x(const Line_2 &l1, const Line_2 &l2, const Line_2 &h) { return CGALi::compare_y_at_x(l1, l2, h, K()); } template < class K > inline Comparison_result compare_y_at_x(const Line_2 &l1, const Line_2 &l2, const Line_2 &h1, const Line_2 &h2) { return CGALi::compare_y_at_x(l1, l2, h1, h2, K()); } template < class K > inline Comparison_result compare_yx(const Point_2 &p, const Point_2 &q) { return CGALi::compare_yx(p, q, K()); } template < class K > inline typename K::FT determinant(const Vector_2 &v0, const Vector_2 &v1) { return CGALi::determinant(v0, v1, K()); } template inline bool has_larger_distance_to_point(const Point_2& p, const Point_2& q, const Point_2& r) { return CGALi::has_larger_distance_to_point(p, q, r, K()); } template inline bool has_smaller_distance_to_point(const Point_2& p, const Point_2& q, const Point_2& r) { return CGALi::has_smaller_distance_to_point(p, q, r, K()); } template inline bool has_smaller_signed_distance_to_line(const Line_2& l, const Point_2& p, const Point_2& q) { return CGALi::has_smaller_signed_distance_to_line(l, p, q, K()); } template inline bool has_larger_signed_distance_to_line(const Line_2& l, const Point_2& p, const Point_2& q) { return CGALi::has_larger_signed_distance_to_line(l, p, q, K()); } template inline bool has_larger_signed_distance_to_line(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) { return CGALi::has_larger_signed_distance_to_line(p, q, r, s, K()); } template inline bool has_smaller_signed_distance_to_line(const Point_2& p, const Point_2& q, const Point_2& r, const Point_2& s) { return CGALi::has_smaller_signed_distance_to_line(p, q, r, s, K()); } template < class K > inline bool left_turn(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::left_turn(p, q, r, K()); } template < class K > inline bool less_x(const Point_2 &p, const Point_2 &q) { return CGALi::less_x(p, q, K()); } template < class K > inline bool less_y(const Point_2 &p, const Point_2 &q) { return CGALi::less_y(p, q, K()); } template < class K > inline bool lexicographically_xy_larger(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_xy_larger(p, q, K()); } template < class K > inline bool lexicographically_xy_larger_or_equal(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_xy_larger_or_equal(p, q, K()); } template < class K > inline bool lexicographically_xy_smaller(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_xy_smaller(p, q, K()); } template < class K > inline bool lexicographically_xy_smaller_or_equal(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_xy_smaller_or_equal(p, q, K()); } template < class K > inline bool lexicographically_yx_smaller(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_yx_smaller(p, q, K()); } template < class K > inline bool lexicographically_yx_smaller_or_equal(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_yx_smaller_or_equal(p, q, K()); } // FIXME : Undocumented template < class K > inline bool lexicographically_yx_larger(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_yx_larger(p, q, K()); } // FIXME : Undocumented template < class K > inline bool lexicographically_yx_larger_or_equal(const Point_2 &p, const Point_2 &q) { return CGALi::lexicographically_yx_larger_or_equal(p, q, K()); } template < class K > inline typename K::Point_2 midpoint(const Point_2 &p, const Point_2 &q) { return CGALi::midpoint(p, q, K()); } template < class K > inline typename K::Point_2 max_vertex(const Iso_rectangle_2 &ir) { return CGALi::max_vertex(ir, K()); } template < class K > inline typename K::Point_2 min_vertex(const Iso_rectangle_2 &ir) { return CGALi::min_vertex(ir, K()); } // FIXME TODO : What do we do with the operators ? // They have no counter part with the kernel argument... template < class K > inline bool operator<(const Direction_2& d1, const Direction_2& d2) { return compare_angle_with_x_axis(d1, d2) == SMALLER; } template < class K > inline bool operator>(const Direction_2& d1, const Direction_2& d2) { return compare_angle_with_x_axis(d1, d2) == LARGER; } template < class K > inline bool operator>=(const Direction_2& d1, const Direction_2& d2) { return compare_angle_with_x_axis(d1, d2) != SMALLER; } template < class K > inline bool operator<=(const Direction_2& d1, const Direction_2& d2) { return compare_angle_with_x_axis(d1, d2) != LARGER; } template < class K > inline bool operator==(const Point_2& p, const Point_2& q) { return K().equal_2_object()(p, q); } template < class K > inline bool operator!=(const Point_2& p, const Point_2& q) { return ! (p == q); } template < class K > inline bool operator<(const Point_2& p, const Point_2& q) { return K().less_xy_2_object()(p, q); } template < class K > inline bool operator>(const Point_2& p, const Point_2& q) { return K().less_xy_2_object()(q, p); } template < class K > inline bool operator<=(const Point_2& p, const Point_2& q) { return ! K().less_xy_2_object()(q, p); } template < class K > inline bool operator>=(const Point_2& p, const Point_2& q) { return ! K().less_xy_2_object()(p, q); } template < class K > inline bool operator==(const Vector_2& v, const Vector_2& w) { return K().equal_2_object()(v, w); } template < class K > inline bool operator!=(const Vector_2& v, const Vector_2& w) { return ! (v == w); } template < class K > inline typename K::Vector_2 operator*(const typename CGAL_WRAP(K)::FT &c, const Vector_2 &w) { return K().construct_scaled_vector_2_object()(w, c); } template < class K > inline typename K::Vector_2 operator*(const Vector_2 &w, const typename CGAL_WRAP(K)::FT &c) { return K().construct_scaled_vector_2_object()(w, c); } template < class K > inline typename K::Vector_2 operator*(const typename First_if_different::Type &c, const Vector_2 &w) { return K().construct_scaled_vector_2_object()(w, c); } template < class K > inline typename K::Vector_2 operator*(const Vector_2 &w, const typename First_if_different::Type &c) { return K().construct_scaled_vector_2_object()(w, c); } template < class K > inline typename K::FT operator*(const Vector_2 &v, const Vector_2 &w) { return K().compute_scalar_product_2_object()(v, w); } template < class K > inline typename K::Point_2 operator+(const Point_2 &p, const Vector_2 &v) { return K().construct_translated_point_2_object()(p, v); } template < class K > inline typename K::Point_2 operator+(const Origin &o, const Vector_2 &v) { return K().construct_translated_point_2_object()(o, v); } template < class K > inline typename K::Point_2 operator-(const Point_2 &p, const Vector_2 &v) { return K().construct_translated_point_2_object() (p, K().construct_opposite_vector_2_object()(v)); } template < class K > inline typename K::Point_2 operator-(const Origin &o, const Vector_2 &v) { return K().construct_translated_point_2_object() (o, K().construct_opposite_vector_2_object()(v)); } template < class K > inline typename K::Vector_2 operator-(const Point_2 &p, const Point_2 &q) { return K().construct_vector_2_object()(q, p); } template < class K > inline typename K::Vector_2 operator-(const Point_2 &p, const Origin &o) { return K().construct_vector_2_object()(o, p); } template < class K > inline typename K::Vector_2 operator-(const Origin &o, const Point_2 &q) { return K().construct_vector_2_object()(q, o); } template inline Orientation orientation(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::orientation(p, q, r, K()); } template inline Orientation orientation(const Vector_2 &u, const Vector_2 &v) { return CGALi::orientation(u, v, K()); } // parallel() functions are in global_functions.h template inline bool right_turn(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::right_turn(p, q, r, K()); } template inline Bounded_side side_of_bounded_circle(const Point_2 &p, const Point_2 &q, const Point_2 &r, const Point_2 &t) { return CGALi::side_of_bounded_circle(p, q, r, t, K()); } template inline Bounded_side side_of_bounded_circle(const Point_2 &p, const Point_2 &q, const Point_2 &r) { return CGALi::side_of_bounded_circle(p, q, r, K()); } template inline Oriented_side side_of_oriented_circle(const Point_2 &p, const Point_2 &q, const Point_2 &r, const Point_2 &t) { return CGALi::side_of_oriented_circle(p, q, r, t, K()); } template < class K > inline typename K::FT squared_radius(const Point_2 &p, const Point_2 &q) { return CGALi::squared_radius(p, q, K()); } template < class K > CGAL_KERNEL_INLINE typename K::FT squared_radius(const Point_2& p, const Point_2& q, const Point_2& r) { return CGALi::squared_radius(p, q, r, K()); } template < class K > inline bool x_equal(const Point_2 &p, const Point_2 &q) { return CGALi::x_equal(p, q, K()); } template < class K > inline bool y_equal(const Point_2 &p, const Point_2 &q) { return CGALi::y_equal(p, q, K()); } CGAL_END_NAMESPACE #endif // CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H