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 e173ce2f82d..385bb37470d 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 @@ -198,7 +198,92 @@ void _test_line_arc_equal(SK sk) { } } } +} +template +void _test_circular_arc_equal(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::Circular_arc_3 Circular_arc_3; + typedef typename SK::Point_3 Point_3; + typedef typename SK::Plane_3 Plane_3; + typedef typename SK::Circle_3 Circle_3; + typedef typename SK::Sphere_3 Sphere_3; + typedef typename SK::Algebraic_kernel AK; + typedef typename SK::Get_equation Get_equation; + typedef typename SK::Equal_3 Equal_3; + typedef typename SK::Construct_circle_3 Construct_circle_3; + typedef typename SK::Construct_sphere_3 Construct_sphere_3; + typedef typename SK::Construct_circular_arc_3 Construct_circular_arc_3; + typedef typename SK::Polynomials_for_circle_3 Polynomials_for_circle_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; + + Equal_3 theEqual_3 = sk.equal_3_object(); + Get_equation theGet_equation = sk.get_equation_object(); + Construct_circle_3 theConstruct_circle_3 = sk.construct_circle_3_object(); + Construct_sphere_3 theConstruct_sphere_3 = sk.construct_sphere_3_object(); + Construct_circular_arc_3 theConstruct_circular_arc_3 = sk.construct_circular_arc_3_object(); + + CGAL::Random generatorOfgenerator; + int random_seed = generatorOfgenerator.get_int(0, 123456); + CGAL::Random theRandom(random_seed); + int random_max = 127; + int random_min = -127; + + std::cout << "Testing Equal_3 for Circular_arc_3..." << std::endl; + for(int i=0; i<100; i++) { + int a,b,c,d,u,v,r; + FT x,y,z; + do { + a = theRandom.get_int(random_min,random_max); + b = theRandom.get_int(random_min,random_max); + c = theRandom.get_int(random_min,random_max); + d = theRandom.get_int(random_min,random_max); + } while((a == 0) && (b == 0) && (c == 0)); + u = theRandom.get_int(random_min,random_max); + v = theRandom.get_int(random_min,random_max); + do { + r = theRandom.get_int(random_min,random_max); + } while(r <= 0); + if(a != 0) { + x = FT(-(b*u + c*v + d),a); + y = FT(u); + z = FT(v); + } else if(b != 0) { + x = FT(u); + y = FT(-(a*u + c*v + d),b); + z = FT(v); + } else { + x = FT(u); + y = FT(v); + z = FT(-(a*u + b*v + d),c); + } + const Plane_3 plane = Plane_3(a,b,c,d); + const Plane_3 plane2 = Plane_3(2*a,2*b,2*c,2*d); + const FT sqr = FT(r); + const Point_3 p = Point_3(x,y,z); + const Polynomials_for_circle_3 pfc = + std::make_pair(Polynomial_for_spheres_2_3(x,y,z,r), + Polynomial_1_3(a,b,c,d)); + Circle_3 circle3 = theConstruct_circle_3(pfc); + Circle_3 circle = theConstruct_circle_3(p,sqr,plane); + Circular_arc_3 circle_arc3 = theConstruct_circular_arc_3(circle3); + Circular_arc_3 circle_arc = theConstruct_circular_arc_3(circle); + Circle_3 circle2 = theConstruct_circle_3(p,sqr,plane2); + Circular_arc_3 circle_arc2 = theConstruct_circular_arc_3(circle2); + assert(theEqual_3(circle_arc,circle_arc2)); + assert(theEqual_3(circle_arc,circle_arc3)); + Circular_arc_3 cother = circle_arc2; + assert(theEqual_3(circle_arc,cother)); + assert(cother.rep().is_full()); + // When the !if_full(), we use the compare of circular_arc_point, already tested + } } template @@ -487,6 +572,7 @@ void _test_spherical_kernel_predicates(SK sk) _test_circular_arc_point_equal(sk); _test_circle_equal(sk); _test_line_arc_equal(sk); + _test_circular_arc_equal(sk); _test_has_on_predicate(sk); _test_do_overlap_predicate(sk); std::cout << "All tests on predicates are OK." << std::endl;