mirror of https://github.com/CGAL/cgal
Circular_arc_3 (beginning of it) + Fixing Warning
This commit is contained in:
parent
a2d52782cc
commit
d44480dd0d
|
|
@ -380,6 +380,100 @@ void _test_line_arc_construct(SK sk) {
|
|||
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
void _test_circular_arc_construct(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 Construct_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);
|
||||
assert(circle_arc.supporting_plane().a() == a);
|
||||
assert(circle_arc.supporting_plane().b() == b);
|
||||
assert(circle_arc.supporting_plane().c() == c);
|
||||
assert(circle_arc.supporting_plane().d() == d);
|
||||
assert(circle_arc.center().x() == x);
|
||||
assert(circle_arc.center().y() == y);
|
||||
assert(circle_arc.center().z() == z);
|
||||
assert(circle_arc.squared_radius() == sqr);
|
||||
assert(theEqual_3(circle_arc.source(),circle_arc.target()));
|
||||
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));
|
||||
}
|
||||
|
||||
// No need to test the constructors based on intersection
|
||||
// _test_intersect_construct will test it
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
void _test_intersection_construct(SK sk) {
|
||||
typedef typename SK::RT RT;
|
||||
|
|
@ -1426,6 +1520,10 @@ void _test_bounding_box_construct(SK sk)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// At the moment this bbox is the same as the Circle_3 one
|
||||
// the bbox of the circular arc is the bbox of its supporting circle
|
||||
std::cout << "Testing the bbox of Circular_arc_3..." << std::endl;
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
|
|
@ -1507,6 +1605,7 @@ void _test_spherical_kernel_construct(SK sk)
|
|||
_test_line_construct(sk);
|
||||
_test_circle_construct(sk);
|
||||
_test_line_arc_construct(sk);
|
||||
_test_circular_arc_construct(sk);
|
||||
_test_intersection_construct(sk);
|
||||
_test_split_construct(sk);
|
||||
_test_bounding_box_construct(sk);
|
||||
|
|
|
|||
Loading…
Reference in New Issue