BWAPI
|
00001 // Copyright (c) 2003-2004 Utrecht University (The Netherlands), 00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), 00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg 00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), 00005 // and Tel-Aviv University (Israel). All rights reserved. 00006 // 00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public License as 00009 // published by the Free Software Foundation; version 2.1 of the License. 00010 // See the file LICENSE.LGPL distributed with CGAL. 00011 // 00012 // Licensees holding a valid commercial license may use this file in 00013 // accordance with the commercial license agreement provided with the software. 00014 // 00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 // 00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Kernel_23/include/CGAL/Kernel/global_functions_2.h $ 00019 // $Id: global_functions_2.h 50420 2009-07-07 10:33:38Z afabri $ 00020 // 00021 // 00022 // Author(s) : Sylvain Pion 00023 00024 #ifndef CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H 00025 #define CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H 00026 00027 // Generic functions taking "user classes" as parameters, calling the 00028 // internal functions (in *_internal*.h, namespace CGALi) taking a kernel as 00029 // additional parameter, which themselves call the corresponding kernel 00030 // functors. 00031 00032 #include <CGAL/user_classes.h> 00033 #include <CGAL/Kernel/global_functions_internal_2.h> 00034 #include <CGAL/Kernel/mpl.h> 00035 00036 CGAL_BEGIN_NAMESPACE 00037 00038 template < class K > 00039 typename K::Boolean 00040 operator==(const Point_2<K> &p, const Origin& o) 00041 { 00042 return p == Point_2<K>(o); 00043 } 00044 00045 template < class K > 00046 typename K::Boolean 00047 operator!=(const Point_2<K> &p, const Origin& o) 00048 { 00049 return p != Point_2<K>(o); 00050 } 00051 00052 template < class K > 00053 inline 00054 Angle 00055 angle(const Point_2<K> &p, 00056 const Point_2<K> &q, 00057 const Point_2<K> &r) 00058 { 00059 return CGALi::angle(p, q, r, K()); 00060 } 00061 00062 template < class K > 00063 inline 00064 typename K::Boolean 00065 are_ordered_along_line(const Point_2<K> &p, 00066 const Point_2<K> &q, 00067 const Point_2<K> &r) 00068 { 00069 return CGALi::are_ordered_along_line(p, q, r, K()); 00070 } 00071 00072 template < class K > 00073 inline 00074 typename K::Boolean 00075 are_strictly_ordered_along_line(const Point_2<K> &p, 00076 const Point_2<K> &q, 00077 const Point_2<K> &r) 00078 { 00079 return CGALi::are_strictly_ordered_along_line(p, q, r, K()); 00080 } 00081 00082 template < class K > 00083 inline 00084 typename K::FT 00085 area(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r) 00086 { 00087 return CGALi::area(p, q, r, K()); 00088 } 00089 00090 template < class K > 00091 inline 00092 typename K::Point_2 00093 barycenter(const Point_2<K> &p1, const typename K::FT& w1, 00094 const Point_2<K> &p2) 00095 { 00096 return CGALi::barycenter(p1, w1, p2, K()); 00097 } 00098 00099 template < class K > 00100 inline 00101 typename K::Point_2 00102 barycenter(const Point_2<K> &p1, const typename K::FT& w1, 00103 const Point_2<K> &p2, const typename K::FT& w2) 00104 { 00105 return CGALi::barycenter(p1, w1, p2, w2, K()); 00106 } 00107 00108 template < class K > 00109 inline 00110 typename K::Point_2 00111 barycenter(const Point_2<K> &p1, const typename K::FT& w1, 00112 const Point_2<K> &p2, const typename K::FT& w2, 00113 const Point_2<K> &p3) 00114 { 00115 return CGALi::barycenter(p1, w1, p2, w2, p3, K()); 00116 } 00117 00118 template < class K > 00119 inline 00120 typename K::Point_2 00121 barycenter(const Point_2<K> &p1, const typename K::FT& w1, 00122 const Point_2<K> &p2, const typename K::FT& w2, 00123 const Point_2<K> &p3, const typename K::FT& w3) 00124 { 00125 return CGALi::barycenter(p1, w1, p2, w2, p3, w3, K()); 00126 } 00127 00128 template < class K > 00129 inline 00130 typename K::Point_2 00131 barycenter(const Point_2<K> &p1, const typename K::FT& w1, 00132 const Point_2<K> &p2, const typename K::FT& w2, 00133 const Point_2<K> &p3, const typename K::FT& w3, 00134 const Point_2<K> &p4) 00135 { 00136 return CGALi::barycenter(p1, w1, p2, w2, p3, w3, p4, K()); 00137 } 00138 00139 template < class K > 00140 inline 00141 typename K::Point_2 00142 barycenter(const Point_2<K> &p1, const typename K::FT& w1, 00143 const Point_2<K> &p2, const typename K::FT& w2, 00144 const Point_2<K> &p3, const typename K::FT& w3, 00145 const Point_2<K> &p4, const typename K::FT& w4) 00146 { 00147 return CGALi::barycenter(p1, w1, p2, w2, p3, w3, p4, w4, K()); 00148 } 00149 00150 template <typename K> 00151 inline 00152 typename K::Line_2 00153 bisector(const Point_2<K> &p, const Point_2<K> &q) 00154 { 00155 return CGALi::bisector(p, q, K()); 00156 } 00157 00158 template <typename K> 00159 inline 00160 typename K::Line_2 00161 bisector(const Line_2<K> &l1, const Line_2<K> &l2) 00162 { 00163 return CGALi::bisector(l1, l2, K()); 00164 } 00165 00166 template < class K > 00167 inline 00168 typename K::Point_2 00169 centroid(const Point_2<K> &p, 00170 const Point_2<K> &q, 00171 const Point_2<K> &r) 00172 { 00173 return CGALi::centroid(p, q, r, K()); 00174 } 00175 00176 template < class K > 00177 inline 00178 typename K::Point_2 00179 centroid(const Triangle_2<K> &t) 00180 { 00181 return CGALi::centroid(t, K()); 00182 } 00183 00184 template < class K > 00185 inline 00186 typename K::Point_2 00187 centroid(const Point_2<K> &p, 00188 const Point_2<K> &q, 00189 const Point_2<K> &r, 00190 const Point_2<K> &s) 00191 { 00192 return CGALi::centroid(p, q, r, s, K()); 00193 } 00194 00195 template < class K > 00196 inline 00197 typename K::Point_2 00198 circumcenter(const Point_2<K> &p, 00199 const Point_2<K> &q) 00200 { 00201 return CGALi::circumcenter(p, q, K()); 00202 } 00203 00204 template < class K > 00205 inline 00206 typename K::Point_2 00207 circumcenter(const Point_2<K> &p, 00208 const Point_2<K> &q, 00209 const Point_2<K> &r) 00210 { 00211 return CGALi::circumcenter(p, q, r, K()); 00212 } 00213 00214 template < class K > 00215 inline 00216 typename K::Point_2 00217 circumcenter(const Triangle_2<K> &t) 00218 { 00219 return CGALi::circumcenter(t, K()); 00220 } 00221 00222 template < class K > 00223 inline 00224 typename K::Boolean 00225 collinear(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r) 00226 { 00227 return CGALi::collinear(p, q, r, K()); 00228 } 00229 00230 template < class K > 00231 inline 00232 typename K::Boolean 00233 collinear_are_ordered_along_line(const Point_2<K> &p, 00234 const Point_2<K> &q, 00235 const Point_2<K> &r) 00236 { 00237 return CGALi::collinear_are_ordered_along_line(p, q, r, K()); 00238 } 00239 00240 template < class K > 00241 inline 00242 typename K::Boolean 00243 collinear_are_strictly_ordered_along_line(const Point_2<K> &p, 00244 const Point_2<K> &q, 00245 const Point_2<K> &r) 00246 { 00247 return CGALi::collinear_are_strictly_ordered_along_line(p, q, r, K()); 00248 } 00249 00250 template < typename K > 00251 inline 00252 typename K::Comparison_result 00253 compare_angle_with_x_axis(const Direction_2<K>& d1, 00254 const Direction_2<K>& d2) 00255 { 00256 return CGALi::compare_angle_with_x_axis(d1, d2, K()); 00257 } 00258 00259 template <class K > 00260 inline 00261 typename K::Comparison_result 00262 compare_distance_to_point(const Point_2<K>& p, 00263 const Point_2<K>& q, 00264 const Point_2<K>& r) 00265 { 00266 return CGALi::compare_distance_to_point(p, q, r, K()); 00267 } 00268 00269 template <class K > 00270 inline 00271 typename K::Comparison_result 00272 compare_squared_distance(const Point_2<K>& p, 00273 const Point_2<K>& q, 00274 const typename K::FT& d2) 00275 { 00276 return CGALi::compare_squared_distance(p, q, d2, K()); 00277 } 00278 00279 template <class K> 00280 inline 00281 typename K::Comparison_result 00282 compare_signed_distance_to_line(const Point_2<K>& p, 00283 const Point_2<K>& q, 00284 const Point_2<K>& r, 00285 const Point_2<K>& s) 00286 { 00287 return CGALi::compare_signed_distance_to_line(p, q, r, s, K()); 00288 } 00289 00290 template <class K> 00291 inline 00292 typename K::Comparison_result 00293 compare_signed_distance_to_line(const Line_2<K>& l, 00294 const Point_2<K>& p, 00295 const Point_2<K>& q) 00296 { 00297 return CGALi::compare_signed_distance_to_line(l, p, q, K()); 00298 } 00299 00300 /* FIXME : Undocumented, obsolete... 00301 template < class K > 00302 inline 00303 typename K::Comparison_result 00304 compare_lexicographically_xy(const Point_2<K> &p, 00305 const Point_2<K> &q) 00306 { 00307 return K().compare_xy_2_object()(p, q); 00308 } 00309 */ 00310 00311 template < class K > 00312 inline 00313 typename K::Comparison_result 00314 compare_slopes(const Line_2<K> &l1, const Line_2<K> &l2) 00315 { 00316 return CGALi::compare_slopes(l1, l2, K()); 00317 } 00318 00319 template < class K > 00320 inline 00321 typename K::Comparison_result 00322 compare_slopes(const Segment_2<K> &s1, const Segment_2<K> &s2) 00323 { 00324 return CGALi::compare_slopes(s1, s2, K()); 00325 } 00326 00327 template < class K > 00328 inline 00329 typename K::Comparison_result 00330 compare_x(const Point_2<K> &p, const Point_2<K> &q) 00331 { 00332 return CGALi::compare_x(p, q, K()); 00333 } 00334 00335 template < class K > 00336 inline 00337 typename K::Comparison_result 00338 compare_x(const Point_2<K>& p, 00339 const Line_2<K>& l1, 00340 const Line_2<K>& l2) 00341 { 00342 return CGALi::compare_x(p, l1, l2, K()); 00343 } 00344 00345 template < class K > 00346 inline 00347 typename K::Comparison_result 00348 compare_x(const Line_2<K> &l, 00349 const Line_2<K> &h1, 00350 const Line_2<K> &h2) 00351 { 00352 return CGALi::compare_x(l, h1, h2, K()); 00353 } 00354 00355 template < class K > 00356 inline 00357 typename K::Comparison_result 00358 compare_x(const Line_2<K> &l1, 00359 const Line_2<K> &h1, 00360 const Line_2<K> &l2, 00361 const Line_2<K> &h2) 00362 { 00363 return CGALi::compare_x(l1, h1, l2, h2, K()); 00364 } 00365 00366 template < class K > 00367 inline 00368 typename K::Comparison_result 00369 compare_x_at_y(const Point_2<K>& p, const Line_2<K>& h) 00370 { 00371 return CGALi::compare_x_at_y(p, h, K()); 00372 } 00373 00374 /* Undocumented 00375 template < class K > 00376 inline 00377 typename K::Comparison_result 00378 compare_x_at_y(const Point_2<K>& p, const Segment_2<K>& s) 00379 { 00380 return CGALi::compare_x_at_y(p, s, K()); 00381 } 00382 */ 00383 00384 template < class K > 00385 inline 00386 typename K::Comparison_result 00387 compare_x_at_y(const Point_2<K> &p, 00388 const Line_2<K> &h1, 00389 const Line_2<K> &h2) 00390 { 00391 return CGALi::compare_x_at_y(p, h1, h2, K()); 00392 } 00393 00394 template < class K > 00395 inline 00396 typename K::Comparison_result 00397 compare_x_at_y(const Line_2<K> &l1, 00398 const Line_2<K> &l2, 00399 const Line_2<K> &h) 00400 { 00401 return CGALi::compare_x_at_y(l1, l2, h, K()); 00402 } 00403 00404 template < class K > 00405 inline 00406 typename K::Comparison_result 00407 compare_x_at_y(const Line_2<K> &l1, 00408 const Line_2<K> &l2, 00409 const Line_2<K> &h1, 00410 const Line_2<K> &h2) 00411 { 00412 return CGALi::compare_x_at_y(l1, l2, h1, h2, K()); 00413 } 00414 00415 template < class K > 00416 inline 00417 typename K::Comparison_result 00418 compare_xy(const Point_2<K> &p, const Point_2<K> &q) 00419 { 00420 return CGALi::compare_xy(p, q, K()); 00421 } 00422 00423 template < class K > 00424 inline 00425 typename K::Comparison_result 00426 compare_y(const Point_2<K> &p, const Point_2<K> &q) 00427 { 00428 return CGALi::compare_y(p, q, K()); 00429 } 00430 00431 template < class K > 00432 inline 00433 typename K::Comparison_result 00434 compare_y(const Point_2<K> &p, 00435 const Line_2<K> &l1, 00436 const Line_2<K> &l2) 00437 { 00438 return CGALi::compare_y(p, l1, l2, K()); 00439 } 00440 00441 template < class K > 00442 inline 00443 typename K::Comparison_result 00444 compare_y(const Line_2<K> &l1, 00445 const Line_2<K> &l2, 00446 const Line_2<K> &h1, 00447 const Line_2<K> &h2) 00448 { 00449 return CGALi::compare_y(l1, l2, h1, h2, K()); 00450 } 00451 00452 template < class K > 00453 inline 00454 typename K::Comparison_result 00455 compare_y(const Line_2<K> &l, 00456 const Line_2<K> &h1, 00457 const Line_2<K> &h2) 00458 { 00459 return CGALi::compare_y(l, h1, h2, K()); 00460 } 00461 00462 template < class K > 00463 inline 00464 typename K::Comparison_result 00465 compare_y_at_x(const Point_2<K> &p, const Segment_2<K> &s) 00466 { 00467 return CGALi::compare_y_at_x(p, s, K()); 00468 } 00469 00470 template < class K > 00471 inline 00472 typename K::Comparison_result 00473 compare_y_at_x(const Point_2<K> &p, 00474 const Segment_2<K> &s1, 00475 const Segment_2<K> &s2) 00476 { 00477 return CGALi::compare_y_at_x(p, s1, s2, K()); 00478 } 00479 00480 template < class K > 00481 inline 00482 typename K::Comparison_result 00483 compare_y_at_x(const Point_2<K> &p, const Line_2<K> &h) 00484 { 00485 return CGALi::compare_y_at_x(p, h, K()); 00486 } 00487 00488 template < class K > 00489 inline 00490 typename K::Comparison_result 00491 compare_y_at_x(const Point_2<K> &p, 00492 const Line_2<K> &h1, 00493 const Line_2<K> &h2) 00494 { 00495 return CGALi::compare_y_at_x(p, h1, h2, K()); 00496 } 00497 00498 template < class K > 00499 inline 00500 typename K::Comparison_result 00501 compare_y_at_x(const Line_2<K> &l1, 00502 const Line_2<K> &l2, 00503 const Line_2<K> &h) 00504 { 00505 return CGALi::compare_y_at_x(l1, l2, h, K()); 00506 } 00507 00508 template < class K > 00509 inline 00510 typename K::Comparison_result 00511 compare_y_at_x(const Line_2<K> &l1, 00512 const Line_2<K> &l2, 00513 const Line_2<K> &h1, 00514 const Line_2<K> &h2) 00515 { 00516 return CGALi::compare_y_at_x(l1, l2, h1, h2, K()); 00517 } 00518 00519 template < class K > 00520 inline 00521 typename K::Comparison_result 00522 compare_yx(const Point_2<K> &p, const Point_2<K> &q) 00523 { 00524 return CGALi::compare_yx(p, q, K()); 00525 } 00526 00527 template < class K > 00528 inline 00529 typename K::FT 00530 determinant(const Vector_2<K> &v0, const Vector_2<K> &v1) 00531 { 00532 return CGALi::determinant(v0, v1, K()); 00533 } 00534 00535 template <class K> 00536 inline 00537 typename K::Boolean 00538 has_larger_distance_to_point(const Point_2<K>& p, 00539 const Point_2<K>& q, 00540 const Point_2<K>& r) 00541 { 00542 return CGALi::has_larger_distance_to_point(p, q, r, K()); 00543 } 00544 00545 template <class K> 00546 inline 00547 typename K::Boolean 00548 has_smaller_distance_to_point(const Point_2<K>& p, 00549 const Point_2<K>& q, 00550 const Point_2<K>& r) 00551 { 00552 return CGALi::has_smaller_distance_to_point(p, q, r, K()); 00553 } 00554 00555 template <class K> 00556 inline 00557 typename K::Boolean 00558 has_smaller_signed_distance_to_line(const Line_2<K>& l, 00559 const Point_2<K>& p, 00560 const Point_2<K>& q) 00561 { 00562 return CGALi::has_smaller_signed_distance_to_line(l, p, q, K()); 00563 } 00564 00565 template <class K> 00566 inline 00567 typename K::Boolean 00568 has_larger_signed_distance_to_line(const Line_2<K>& l, 00569 const Point_2<K>& p, 00570 const Point_2<K>& q) 00571 { 00572 return CGALi::has_larger_signed_distance_to_line(l, p, q, K()); 00573 } 00574 00575 template <class K> 00576 inline 00577 typename K::Boolean 00578 has_larger_signed_distance_to_line(const Point_2<K>& p, 00579 const Point_2<K>& q, 00580 const Point_2<K>& r, 00581 const Point_2<K>& s) 00582 { 00583 return CGALi::has_larger_signed_distance_to_line(p, q, r, s, K()); 00584 } 00585 00586 template <class K> 00587 inline 00588 typename K::Boolean 00589 has_smaller_signed_distance_to_line(const Point_2<K>& p, 00590 const Point_2<K>& q, 00591 const Point_2<K>& r, 00592 const Point_2<K>& s) 00593 { 00594 return CGALi::has_smaller_signed_distance_to_line(p, q, r, s, K()); 00595 } 00596 00597 template < class K > 00598 inline 00599 typename K::Boolean 00600 left_turn(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r) 00601 { 00602 return CGALi::left_turn(p, q, r, K()); 00603 } 00604 00605 template < class K > 00606 inline 00607 typename K::Boolean 00608 less_x(const Point_2<K> &p, const Point_2<K> &q) 00609 { 00610 return CGALi::less_x(p, q, K()); 00611 } 00612 00613 template < class K > 00614 inline 00615 typename K::Boolean 00616 less_y(const Point_2<K> &p, const Point_2<K> &q) 00617 { 00618 return CGALi::less_y(p, q, K()); 00619 } 00620 00621 template < class K > 00622 inline 00623 typename K::Boolean 00624 lexicographically_xy_larger(const Point_2<K> &p, const Point_2<K> &q) 00625 { 00626 return CGALi::lexicographically_xy_larger(p, q, K()); 00627 } 00628 00629 template < class K > 00630 inline 00631 typename K::Boolean 00632 lexicographically_xy_larger_or_equal(const Point_2<K> &p, const Point_2<K> &q) 00633 { 00634 return CGALi::lexicographically_xy_larger_or_equal(p, q, K()); 00635 } 00636 00637 template < class K > 00638 inline 00639 typename K::Boolean 00640 lexicographically_xy_smaller(const Point_2<K> &p, const Point_2<K> &q) 00641 { 00642 return CGALi::lexicographically_xy_smaller(p, q, K()); 00643 } 00644 00645 template < class K > 00646 inline 00647 typename K::Boolean 00648 lexicographically_xy_smaller_or_equal(const Point_2<K> &p, 00649 const Point_2<K> &q) 00650 { 00651 return CGALi::lexicographically_xy_smaller_or_equal(p, q, K()); 00652 } 00653 00654 template < class K > 00655 inline 00656 typename K::Boolean 00657 lexicographically_yx_smaller(const Point_2<K> &p, const Point_2<K> &q) 00658 { 00659 return CGALi::lexicographically_yx_smaller(p, q, K()); 00660 } 00661 00662 template < class K > 00663 inline 00664 typename K::Boolean 00665 lexicographically_yx_smaller_or_equal(const Point_2<K> &p, const Point_2<K> &q) 00666 { 00667 return CGALi::lexicographically_yx_smaller_or_equal(p, q, K()); 00668 } 00669 00670 // FIXME : Undocumented 00671 template < class K > 00672 inline 00673 typename K::Boolean 00674 lexicographically_yx_larger(const Point_2<K> &p, const Point_2<K> &q) 00675 { 00676 return CGALi::lexicographically_yx_larger(p, q, K()); 00677 } 00678 00679 // FIXME : Undocumented 00680 template < class K > 00681 inline 00682 typename K::Boolean 00683 lexicographically_yx_larger_or_equal(const Point_2<K> &p, const Point_2<K> &q) 00684 { 00685 return CGALi::lexicographically_yx_larger_or_equal(p, q, K()); 00686 } 00687 00688 template < class K > 00689 inline 00690 typename K::Point_2 00691 midpoint(const Point_2<K> &p, const Point_2<K> &q) 00692 { 00693 return CGALi::midpoint(p, q, K()); 00694 } 00695 00696 template < class K > 00697 inline 00698 typename K::Point_2 00699 max_vertex(const Iso_rectangle_2<K> &ir) 00700 { 00701 return CGALi::max_vertex(ir, K()); 00702 } 00703 00704 template < class K > 00705 inline 00706 typename K::Point_2 00707 min_vertex(const Iso_rectangle_2<K> &ir) 00708 { 00709 return CGALi::min_vertex(ir, K()); 00710 } 00711 00712 // FIXME TODO : What do we do with the operators ? 00713 // They have no counter part with the kernel argument... 00714 template < class K > 00715 inline 00716 typename K::Boolean 00717 operator<(const Direction_2<K>& d1, const Direction_2<K>& d2) 00718 { return compare_angle_with_x_axis(d1, d2) == SMALLER; } 00719 00720 template < class K > 00721 inline 00722 typename K::Boolean 00723 operator>(const Direction_2<K>& d1, const Direction_2<K>& d2) 00724 { return compare_angle_with_x_axis(d1, d2) == LARGER; } 00725 00726 template < class K > 00727 inline 00728 typename K::Boolean 00729 operator>=(const Direction_2<K>& d1, const Direction_2<K>& d2) 00730 { return compare_angle_with_x_axis(d1, d2) != SMALLER; } 00731 00732 template < class K > 00733 inline 00734 typename K::Boolean 00735 operator<=(const Direction_2<K>& d1, const Direction_2<K>& d2) 00736 { return compare_angle_with_x_axis(d1, d2) != LARGER; } 00737 00738 template < class K > 00739 inline 00740 typename K::Boolean 00741 operator==(const Point_2<K>& p, const Point_2<K>& q) 00742 { return K().equal_2_object()(p, q); } 00743 00744 template < class K > 00745 inline 00746 typename K::Boolean 00747 operator!=(const Point_2<K>& p, const Point_2<K>& q) 00748 { return ! (p == q); } 00749 00750 template < class K > 00751 inline 00752 typename K::Boolean 00753 operator<(const Point_2<K>& p, const Point_2<K>& q) 00754 { return K().less_xy_2_object()(p, q); } 00755 00756 template < class K > 00757 inline 00758 typename K::Boolean 00759 operator>(const Point_2<K>& p, const Point_2<K>& q) 00760 { return K().less_xy_2_object()(q, p); } 00761 00762 template < class K > 00763 inline 00764 typename K::Boolean 00765 operator<=(const Point_2<K>& p, const Point_2<K>& q) 00766 { return ! K().less_xy_2_object()(q, p); } 00767 00768 template < class K > 00769 inline 00770 typename K::Boolean 00771 operator>=(const Point_2<K>& p, const Point_2<K>& q) 00772 { return ! K().less_xy_2_object()(p, q); } 00773 00774 template < class K > 00775 inline 00776 typename K::Boolean 00777 operator==(const Vector_2<K>& v, const Vector_2<K>& w) 00778 { return K().equal_2_object()(v, w); } 00779 00780 template < class K > 00781 inline 00782 typename K::Boolean 00783 operator!=(const Vector_2<K>& v, const Vector_2<K>& w) 00784 { return ! (v == w); } 00785 00786 template < class K > 00787 inline 00788 typename K::Vector_2 00789 operator*(const typename K::FT &c, const Vector_2<K> &w) 00790 { 00791 return K().construct_scaled_vector_2_object()(w, c); 00792 } 00793 00794 template < class K > 00795 inline 00796 typename K::Vector_2 00797 operator*(const Vector_2<K> &w, const typename K::FT &c) 00798 { 00799 return K().construct_scaled_vector_2_object()(w, c); 00800 } 00801 00802 template < class K > 00803 inline 00804 typename K::Vector_2 00805 operator*(const typename First_if_different<typename K::RT, 00806 typename K::FT>::Type &c, 00807 const Vector_2<K> &w) 00808 { 00809 return K().construct_scaled_vector_2_object()(w, c); 00810 } 00811 00812 template < class K > 00813 inline 00814 typename K::Vector_2 00815 operator*(const Vector_2<K> &w, 00816 const typename First_if_different<typename K::RT, 00817 typename K::FT>::Type &c) 00818 { 00819 return K().construct_scaled_vector_2_object()(w, c); 00820 } 00821 00822 template < class K > 00823 inline 00824 typename K::FT 00825 operator*(const Vector_2<K> &v, const Vector_2<K> &w) 00826 { 00827 return K().compute_scalar_product_2_object()(v, w); 00828 } 00829 00830 template < class K > 00831 inline 00832 typename K::Point_2 00833 operator+(const Point_2<K> &p, const Vector_2<K> &v) 00834 { 00835 return K().construct_translated_point_2_object()(p, v); 00836 } 00837 00838 template < class K > 00839 inline 00840 typename K::Point_2 00841 operator+(const Origin &o, const Vector_2<K> &v) 00842 { 00843 return K().construct_translated_point_2_object()(o, v); 00844 } 00845 00846 template < class K > 00847 inline 00848 typename K::Point_2 00849 operator-(const Point_2<K> &p, const Vector_2<K> &v) 00850 { 00851 return K().construct_translated_point_2_object() 00852 (p, K().construct_opposite_vector_2_object()(v)); 00853 } 00854 00855 template < class K > 00856 inline 00857 typename K::Point_2 00858 operator-(const Origin &o, const Vector_2<K> &v) 00859 { 00860 return K().construct_translated_point_2_object() 00861 (o, K().construct_opposite_vector_2_object()(v)); 00862 } 00863 00864 template < class K > 00865 inline 00866 typename K::Vector_2 00867 operator-(const Point_2<K> &p, const Point_2<K> &q) 00868 { 00869 return K().construct_vector_2_object()(q, p); 00870 } 00871 00872 template < class K > 00873 inline 00874 typename K::Vector_2 00875 operator-(const Point_2<K> &p, const Origin &o) 00876 { 00877 return K().construct_vector_2_object()(o, p); 00878 } 00879 00880 template < class K > 00881 inline 00882 typename K::Vector_2 00883 operator-(const Origin &o, const Point_2<K> &q) 00884 { 00885 return K().construct_vector_2_object()(q, o); 00886 } 00887 00888 template <typename K> 00889 inline 00890 typename K::Orientation 00891 orientation(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r) 00892 { 00893 return CGALi::orientation(p, q, r, K()); 00894 } 00895 00896 template <typename K> 00897 inline 00898 typename K::Orientation 00899 orientation(const Vector_2<K> &u, const Vector_2<K> &v) 00900 { 00901 return CGALi::orientation(u, v, K()); 00902 } 00903 00904 // parallel() functions are in global_functions.h 00905 00906 template <class K> 00907 inline 00908 typename K::Line_2 00909 radical_line(const Circle_2<K> &s1, 00910 const Circle_2<K> &s2) 00911 { 00912 return K().construct_radical_line_2_object()(s1,s2); 00913 } 00914 00915 template <typename K> 00916 inline 00917 typename K::Boolean 00918 right_turn(const Point_2<K> &p, const Point_2<K> &q, const Point_2<K> &r) 00919 { 00920 return CGALi::right_turn(p, q, r, K()); 00921 } 00922 00923 template <class K> 00924 inline 00925 typename K::Bounded_side 00926 side_of_bounded_circle(const Point_2<K> &p, 00927 const Point_2<K> &q, 00928 const Point_2<K> &r, 00929 const Point_2<K> &t) 00930 { 00931 return CGALi::side_of_bounded_circle(p, q, r, t, K()); 00932 } 00933 00934 template <class K> 00935 inline 00936 typename K::Bounded_side 00937 side_of_bounded_circle(const Point_2<K> &p, 00938 const Point_2<K> &q, 00939 const Point_2<K> &r) 00940 { 00941 return CGALi::side_of_bounded_circle(p, q, r, K()); 00942 } 00943 00944 template <class K> 00945 inline 00946 typename K::Oriented_side 00947 side_of_oriented_circle(const Point_2<K> &p, 00948 const Point_2<K> &q, 00949 const Point_2<K> &r, 00950 const Point_2<K> &t) 00951 { 00952 return CGALi::side_of_oriented_circle(p, q, r, t, K()); 00953 } 00954 00955 template < class K > 00956 inline 00957 typename K::FT 00958 squared_radius(const Point_2<K> &p) 00959 { 00960 return CGALi::squared_radius(p, K()); 00961 } 00962 00963 template < class K > 00964 inline 00965 typename K::FT 00966 squared_radius(const Point_2<K> &p, const Point_2<K> &q) 00967 { 00968 return CGALi::squared_radius(p, q, K()); 00969 } 00970 00971 template < class K > 00972 CGAL_KERNEL_INLINE 00973 typename K::FT 00974 squared_radius(const Point_2<K>& p, const Point_2<K>& q, const Point_2<K>& r) 00975 { 00976 return CGALi::squared_radius(p, q, r, K()); 00977 } 00978 00979 template < class K > 00980 inline 00981 typename K::Boolean 00982 x_equal(const Point_2<K> &p, const Point_2<K> &q) 00983 { 00984 return CGALi::x_equal(p, q, K()); 00985 } 00986 00987 template < class K > 00988 inline 00989 typename K::Boolean 00990 y_equal(const Point_2<K> &p, const Point_2<K> &q) 00991 { 00992 return CGALi::y_equal(p, q, K()); 00993 } 00994 00995 CGAL_END_NAMESPACE 00996 00997 #endif // CGAL_KERNEL_GLOBAL_FUNCTIONS_2_H