From 24de52a1cf0df50ee9d9f3ad5fd3b5937c59dc44 Mon Sep 17 00:00:00 2001 From: Pedro Machado Manhaes de Castro Date: Thu, 2 Oct 2008 15:39:30 +0000 Subject: [PATCH] <, >, <=, >= operations for Circular_arc_point_3 --- .../include/CGAL/Circular_arc_point_3.h | 38 +++++++++++++++++++ .../include/CGAL/_test_sphere_predicates.h | 33 ++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h index 83f647d0e7e..58a9e27f3b5 100644 --- a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h @@ -255,6 +255,44 @@ public: return ! (p == q); } + template < typename SK > + inline + bool + operator<(const Circular_arc_point_3 &p, + const Circular_arc_point_3 &q) + { + return SK().compare_xyz_3_object()(p, q) == CGAL::SMALLER; + } + + template < typename SK > + inline + bool + operator>(const Circular_arc_point_3 &p, + const Circular_arc_point_3 &q) + { + return SK().compare_xyz_3_object()(p, q) == CGAL::LARGER; + } + + template < typename SK > + inline + bool + operator<=(const Circular_arc_point_3 &p, + const Circular_arc_point_3 &q) + { + CGAL::Comparison_result c = SK().compare_xyz_3_object()(p, q); + return (c == CGAL::SMALLER) || (c == CGAL::EQUAL); + } + + template < typename SK > + inline + bool + operator>=(const Circular_arc_point_3 &p, + const Circular_arc_point_3 &q) + { + CGAL::Comparison_result c = SK().compare_xyz_3_object()(p, q); + return (c == CGAL::LARGER) || (c == CGAL::EQUAL); + } + } #endif diff --git a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h index 753285d13ea..4da159b3490 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h +++ b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h @@ -670,6 +670,38 @@ void _test_bounded_side(SK sk) { std::cout << "Testing has_on_unbounded_side(Circle, Circular_arc_point)..." << std::endl; } +template +void _test_lexico_operations(SK sk) { + typedef typename SK::RT RT; + typedef typename SK::FT FT; + typedef typename SK::Root_of_2 Root_of_2; + typedef typename SK::Circular_arc_point_3 Circular_arc_point_3; + typedef typename SK::Point_3 Point_3; + typedef typename SK::Sphere_3 Sphere_3; + typedef typename SK::Algebraic_kernel AK; + typedef typename SK::Get_equation Get_equation; + typedef typename SK::Construct_sphere_3 Construct_sphere_3; + typedef typename SK::Construct_circular_arc_point_3 Construct_circular_arc_point_3; + typedef typename SK::Bounded_side_3 Bounded_side_3; + typedef typename AK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3; + typedef typename AK::Polynomial_1_3 Polynomial_1_3; + typedef typename AK::Polynomials_for_line_3 Polynomials_for_line_3; + typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_3; + + Construct_circular_arc_point_3 theConstruct_circular_arc_point_3 = + sk.construct_circular_arc_point_3_object(); + + Circular_arc_point_3 p[3]; + p[0] = Point_3(1,0,0); + p[1] = Point_3(1,0,0); + p[2] = Point_3(0,1,0); + std::cout << "Testing lexico_operations(Circular_arc_point, Circular_arc_point)..." << std::endl; + assert(p[0] > p[2]); + assert(p[0] >= p[1]); + assert(p[0] <= p[1]); + assert(p[2] < p[0]); +} + template void _test_spherical_kernel_predicates(SK sk) { @@ -680,5 +712,6 @@ void _test_spherical_kernel_predicates(SK sk) _test_has_on_predicate(sk); _test_do_overlap_predicate(sk); _test_bounded_side(sk); + _test_lexico_operations(sk); std::cout << "All tests on predicates are OK." << std::endl; }