running with epec

This commit is contained in:
Sébastien Loriot 2007-10-08 13:58:34 +00:00
parent a5869b8d67
commit bf20d6bfc4
11 changed files with 186 additions and 99 deletions

1
.gitattributes vendored
View File

@ -1322,6 +1322,7 @@ Circular_kernel_3/include/CGAL/Circular_kernel_3/Theta_rep.h -text
Circular_kernel_3/include/CGAL/Circular_kernel_3/constant.h -text
Circular_kernel_3/include/CGAL/Sphere_with_radius_3.h -text
Circular_kernel_3/include/CGAL/Theta_rep.h -text
Circular_kernel_3/test/Circular_kernel_3/test_Lazy_Spherical_kernel.cpp -text
Convex_hull_2/demo/Convex_hull_2/convex_hull_2.vcproj eol=crlf
Convex_hull_2/demo/Convex_hull_2/help/index.html svneol=native#text/html
Convex_hull_2/doc_tex/Convex_hull_2/convex_hull.png -text

View File

@ -277,6 +277,16 @@ template < class SK > \
operator() (const Circular_arc_point_3 &c0,
const Circular_arc_point_3 &c1) const
{ return equal<SK>(c0, c1); }
result_type
operator() (const Circular_arc_point_3 &c0,
const Point_3 &c1) const
{ return equal<SK>(c0, Circular_arc_point_3(c1)); }
result_type
operator() (const Point_3 &c0,
const Circular_arc_point_3 &c1) const
{ return equal<SK>(Circular_arc_point_3(c0), c1); }
// Our Line_arc_3 dont have orientation
result_type
@ -289,7 +299,7 @@ template < class SK > \
operator() (const Circular_arc_3 &c0,
const Circular_arc_3 &c1) const
{ return equal<SK>(c0, c1); }
};
template < class SK >

View File

@ -36,7 +36,8 @@ namespace CGAL {
has_on(const typename SK::Sphere_3 &a,
const typename SK::Point_3 &p)
{
return a.rep().has_on_boundary(p);
//~ return a.rep().has_on_boundary(p);
return a.has_on_boundary(p);
}
template <class SK>
@ -50,16 +51,17 @@ namespace CGAL {
Equation equation = get_equation<SK>(a);
return (Algebraic_kernel().sign_at_object()(equation,p.rep().coordinates()) == ZERO);
}
/*
template <class SK>
inline
bool
has_on(const typename SK::Plane_3 &a,
const typename SK::Point_3 &p)
{
return a.rep().has_on(p);
//~ return a.rep().has_on(p);
return a.has_on(p);
}
*/
template <class SK>
inline
bool
@ -71,16 +73,17 @@ namespace CGAL {
Equation equation = get_equation<SK>(a);
return (Algebraic_kernel().sign_at_object()(equation,p.rep().coordinates()) == ZERO);
}
/*
template <class SK>
inline
bool
has_on(const typename SK::Line_3 &a,
const typename SK::Point_3 &p)
{
return a.rep().has_on(p);
//~ return a.rep().has_on(p);
return a.has_on(p);
}
*/
template <class SK>
inline
bool
@ -135,7 +138,8 @@ namespace CGAL {
has_on(const typename SK::Plane_3 &a,
const typename SK::Line_3 &p)
{
return a.rep().has_on(p);
//~ return a.rep().has_on(p);
return a.has_on(p);
}
template <class SK>

View File

@ -332,8 +332,10 @@ namespace CGAL {
typedef typename SK::Polynomials_for_line_3 Equation_line;
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
CGAL_kernel_precondition(!s.rep().is_degenerate());
CGAL_kernel_precondition(!l.rep().is_degenerate());
//~ CGAL_kernel_precondition(!s.rep().is_degenerate());
//~ CGAL_kernel_precondition(!l.rep().is_degenerate());
CGAL_kernel_precondition(!s.is_degenerate());
CGAL_kernel_precondition(!l.is_degenerate());
Equation_sphere e1 = get_equation<SK>(s);
Equation_line e2 = get_equation<SK>(l);
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >
@ -426,9 +428,12 @@ namespace CGAL {
typedef typename SK::Polynomial_1_3 Equation_plane;
typedef typename SK::Plane_3 Plane_3;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
CGAL_kernel_precondition(!p.rep().is_degenerate());
CGAL_kernel_precondition(!s1.rep().is_degenerate());
CGAL_kernel_precondition(!s2.rep().is_degenerate());
//~ CGAL_kernel_precondition(!p.rep().is_degenerate());
//~ CGAL_kernel_precondition(!s1.rep().is_degenerate());
//~ CGAL_kernel_precondition(!s2.rep().is_degenerate());
CGAL_kernel_precondition(!p.is_degenerate());
CGAL_kernel_precondition(!s1.is_degenerate());
CGAL_kernel_precondition(!s2.is_degenerate());
if(non_oriented_equal<SK>(s1,s2)) {
return intersect_3<SK>(p,s1,res);
}
@ -463,9 +468,12 @@ namespace CGAL {
typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere;
typedef typename SK::Polynomial_1_3 Equation_plane;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
CGAL_kernel_precondition(!p1.rep().is_degenerate());
CGAL_kernel_precondition(!p2.rep().is_degenerate());
CGAL_kernel_precondition(!s.rep().is_degenerate());
//~ CGAL_kernel_precondition(!p1.rep().is_degenerate());
//~ CGAL_kernel_precondition(!p2.rep().is_degenerate());
//~ CGAL_kernel_precondition(!s.rep().is_degenerate());
CGAL_kernel_precondition(!p1.is_degenerate());
CGAL_kernel_precondition(!p2.is_degenerate());
CGAL_kernel_precondition(!s.is_degenerate());
if(non_oriented_equal<SK>(p1,p2)) {
return intersect_3<SK>(p1,s,res);
}
@ -543,7 +551,8 @@ namespace CGAL {
typedef typename SK::Polynomials_for_line_3 Equation_line;
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Algebraic_kernel Algebraic_kernel;
CGAL_kernel_precondition(!l.rep().is_degenerate());
//~ CGAL_kernel_precondition(!l.rep().is_degenerate());
CGAL_kernel_precondition(!l.is_degenerate());
Equation_circle e1 = get_equation<SK>(c);
Equation_line e2 = get_equation<SK>(l);
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >

View File

@ -46,7 +46,7 @@ struct Spherical_kernel_type_equality_wrapper
typedef CGAL::Line_arc_3<Kernel> Line_arc_3;
typedef CGAL::Theta_rep<Kernel> Theta_rep;
typedef CGAL::Sphere_with_radius_3<Kernel> Sphere_with_radius_3;
typedef CGAL::Root_of_2<typename Kernel_base::FT> Root_of_2;
//~ typedef CGAL::Root_of_2<typename Kernel_base::FT> Root_of_2;
};
}

View File

@ -98,17 +98,17 @@ void _test_spherical_kernel_compute(SK sk)
r = theRandom.get_int(random_min,random_max);
} while(r <= 0);
if(a != 0) {
x = FT(-(b*u + c*v + d),a);
x = FT_Q(-(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);
y = FT_Q(-(a*u + c*v + d),b);
z = FT(v);
} else {
x = FT(u);
y = FT(v);
z = FT(-(a*u + b*v + d),c);
z = FT_Q(-(a*u + b*v + d),c);
}
const Plane_3 plane = Plane_3(a,b,c,d);
const FT sqr = FT(r*r);
@ -145,13 +145,13 @@ void _test_spherical_kernel_compute(SK sk)
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
Circular_arc_point_3 cp[8];
for(int i=0; i<8; i++) {
@ -190,8 +190,8 @@ void _test_spherical_kernel_compute(SK sk)
const double diffv1 = ((vv1 > 0) ? (vv1) : (-vv1));
const double diffv2 = ((vv2 > 0) ? (vv2) : (-vv2));
// we suppose at least a precision of 10e-8, but it is not necessarily true
assert(diffv1 < 10e-8);
assert(diffv2 < 10e-8);
CGAL_warning(diffv1 < 10e-8);
CGAL_warning(diffv2 < 10e-8);
}
}

View File

@ -55,9 +55,9 @@ void _test_circular_arc_point_construct(SK sk) {
int random_min = -127;
// test the constructor with 3 root_of_2
Root_of_2 r1 = Root_of_2(3,-1,2);
Root_of_2 r2 = Root_of_2(4,1,2);
Root_of_2 r3 = Root_of_2(10,2,2);
Root_of_2 r1 = CGAL::make_root_of_2(FT(3),FT(-1),FT(2));
Root_of_2 r2 = CGAL::make_root_of_2(FT(4),FT(1),FT(2));
Root_of_2 r3 = CGAL::make_root_of_2(FT(10),FT(2),FT(2));
Root_for_spheres_2_3 rs = Root_for_spheres_2_3(r1,r2,r3);
Circular_arc_point_3 circ_a_point_test_1 =
theConstruct_circular_arc_point_3(r1,r2,r3);
@ -291,17 +291,17 @@ void _test_circle_construct(SK sk) {
r = theRandom.get_int(random_min,random_max);
} while(r <= 0);
if(a != 0) {
x = FT(-(b*u + c*v + d),a);
x = FT_Q(-(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);
y = FT_Q(-(a*u + c*v + d),b);
z = FT(v);
} else {
x = FT(u);
y = FT(v);
z = FT(-(a*u + b*v + d),c);
z = FT_Q(-(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);
@ -456,17 +456,17 @@ void _test_circular_arc_construct(SK sk) {
r = theRandom.get_int(random_min,random_max);
} while(r <= 0);
if(a != 0) {
x = FT(-(b*u + c*v + d),a);
x = FT_Q(-(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);
y = FT_Q(-(a*u + c*v + d),b);
z = FT(v);
} else {
x = FT(u);
y = FT(v);
z = FT(-(a*u + b*v + d),c);
z = FT_Q(-(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);
@ -551,7 +551,7 @@ void _test_intersection_construct(SK sk) {
const FT x = FT(vx);
const FT y = FT(vy);
const FT z = FT(vz);
const FT r = FT(vr,2);
const FT r = FT_Q(vr,2);
Sphere_3 sl_1 = theConstruct_sphere_3(
Polynomial_for_spheres_2_3(x,y,z,r*r));
Sphere_3 sl_2 = theConstruct_sphere_3(
@ -613,7 +613,7 @@ void _test_intersection_construct(SK sk) {
const FT x = FT(vx);
const FT y = FT(vy);
const FT z = FT(vz);
const FT sq_r = FT(vr,3);
const FT sq_r = FT_Q(vr,3);
Sphere_3 sl = theConstruct_sphere_3(
Polynomial_for_spheres_2_3(x,y,z,sq_r));
const FT d2 = ((x+y+z-1)*(x+y+z-1) / 3);
@ -654,7 +654,7 @@ void _test_intersection_construct(SK sk) {
const FT y = FT(vy);
const FT z = FT(vz);
Line_3 l1 = theConstruct_line_3(Point_3(-1,0,0), Point_3(x,y,z));
Line_3 l2 = theConstruct_line_3(Point_3(-1-FT(1,1000000),0,0), Point_3(x,y,z));
Line_3 l2 = theConstruct_line_3(Point_3(FT(-1)-FT(FT_Q(1,1000000)),FT(0),FT(0)), Point_3(x,y,z));
std::vector< CGAL::Object > intersection_1, intersection_2;
theIntersect_3(s, l1, std::back_inserter(intersection_1));
theIntersect_3(s, l2, std::back_inserter(intersection_2));
@ -710,7 +710,7 @@ void _test_intersection_construct(SK sk) {
const FT x = 4*FT(vx);
const FT y = 4*FT(vy);
const FT z = 4*FT(vz);
const FT r = 4*FT(vr,2);
const FT r = 4*FT_Q(vr,2);
Sphere_3 sl = theConstruct_sphere_3(
Polynomial_for_spheres_2_3(x,y,z,r*r));
std::vector< CGAL::Object > intersection_1;
@ -784,7 +784,7 @@ void _test_intersection_construct(SK sk) {
const FT a = FT(va);
const FT b = FT(vb);
const FT c = FT(vc);
const FT d = -FT(vd,2);
const FT d = -FT_Q(vd,2);
if(a == 0 && b == 0 && c == 0) continue;
Plane_3 pl = theConstruct_plane_3(
Polynomial_1_3(a,b,c,d));
@ -858,7 +858,7 @@ void _test_intersection_construct(SK sk) {
const FT a = FT(va);
const FT b = FT(vb);
const FT c = FT(vc);
const FT d = -FT(vd,2);
const FT d = -FT_Q(vd,2);
if(a == 0 && b == 0 && c == 0) continue;
Plane_3 pl = theConstruct_plane_3(
Polynomial_1_3(a,b,c,d));
@ -932,7 +932,7 @@ void _test_intersection_construct(SK sk) {
Polynomial_for_spheres_2_3 es2 = Polynomial_for_spheres_2_3(1,0,0,1);
Polynomial_for_spheres_2_3 es3 = Polynomial_for_spheres_2_3(2,0,0,1);
for(int va=-5;va<6;va++) {
const FT a = -FT(va,10);
const FT a = -FT_Q(va,10);
const FT b = 1;
const FT c = 0;
const FT d = 0;
@ -974,7 +974,7 @@ void _test_intersection_construct(SK sk) {
for(int vb=-5;vb<6;vb++) {
const FT al = 1;
const FT bl = 0;
const FT cl = -FT(vb,10);
const FT cl = -FT_Q(vb,10);
const FT dl = 0;
Polynomial_1_3 pol2 = Polynomial_1_3(al,bl,cl,dl);
Circle_3 c4 = theConstruct_circle_3(std::make_pair(es1, pol2));
@ -989,10 +989,10 @@ void _test_intersection_construct(SK sk) {
assert(theHas_on_3(c4,cap2.first));
}
const FT a_c = FT(va,10);
const FT a_c = FT_Q(va,10);
const FT b_c = 1;
const FT c_c = 0;
const FT d_c = -FT(va,10);
const FT d_c = -FT_Q(va,10);
Polynomial_1_3 pol2 = Polynomial_1_3(a_c,b_c,c_c,d_c);
Circle_3 c5 = theConstruct_circle_3(std::make_pair(es2, pol2));
std::vector< CGAL::Object > intersection_5;
@ -1019,9 +1019,9 @@ void _test_intersection_construct(SK sk) {
Line_3 l1 = theConstruct_line_3(Point_3(-1,0,0), Point_3(x,y,z));
Plane_3 pl1 = theConstruct_plane_3(Point_3(-1,0,0), Point_3(x,y,z),
Point_3(3,4,5));
Line_3 l2 = theConstruct_line_3(Point_3(-1-FT(1,1000000),0,0),
Line_3 l2 = theConstruct_line_3(Point_3(-FT(1)-FT(FT_Q(1,1000000)),FT(0),FT(0)),
Point_3(x,y,z));
Plane_3 pl2 = theConstruct_plane_3(Point_3(-1-FT(1,1000000),0,0),
Plane_3 pl2 = theConstruct_plane_3(Point_3(-FT(1)-FT(FT_Q(1,1000000)),FT(0),FT(0)),
Point_3(x,y,z), Point_3(3,4,5));
Polynomial_1_3 pol_pl1 = theGet_equation(pl1);
Polynomial_1_3 pol_pl2 = theGet_equation(pl2);
@ -1251,13 +1251,13 @@ void _test_intersection_construct(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
Circular_arc_point_3 cp[8];
for(int i=0; i<8; i++) {
@ -1488,10 +1488,10 @@ void _test_bbox(const typename SK::Circle_3 &c)
assert(z1 <= z2);
if(b.xmin() != b.xmax()) {
Plane_3 pt_xneg_min = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x1-FT(1,100000)) ));
Plane_3 pt_xneg_max = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x1+FT(1,100000)) ));
Plane_3 pt_xpos_min = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x2-FT(1,100000)) ));
Plane_3 pt_xpos_max = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x2+FT(1,100000)) ));
Plane_3 pt_xneg_min = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x1-FT(FT_Q(1,100000))) ));
Plane_3 pt_xneg_max = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x1+FT(FT_Q(1,100000))) ));
Plane_3 pt_xpos_min = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x2-FT(FT_Q(1,100000))) ));
Plane_3 pt_xpos_max = theConstruct_plane_3(Polynomial_1_3(1,0,0,-(x2+FT(FT_Q(1,100000))) ));
std::vector< CGAL::Object > intersection_test_x_1;
std::vector< CGAL::Object > intersection_test_x_2;
@ -1509,10 +1509,10 @@ void _test_bbox(const typename SK::Circle_3 &c)
}
if(b.ymin() != b.ymax()) {
Plane_3 pt_yneg_min = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y1-FT(1,100000)) ));
Plane_3 pt_yneg_max = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y1+FT(1,100000)) ));
Plane_3 pt_ypos_min = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y2-FT(1,100000)) ));
Plane_3 pt_ypos_max = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y2+FT(1,100000)) ));
Plane_3 pt_yneg_min = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y1-FT(FT_Q(1,100000))) ));
Plane_3 pt_yneg_max = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y1+FT(FT_Q(1,100000))) ));
Plane_3 pt_ypos_min = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y2-FT(FT_Q(1,100000))) ));
Plane_3 pt_ypos_max = theConstruct_plane_3(Polynomial_1_3(0,1,0,-(y2+FT(FT_Q(1,100000))) ));
std::vector< CGAL::Object > intersection_test_y_1;
std::vector< CGAL::Object > intersection_test_y_2;
@ -1530,10 +1530,10 @@ void _test_bbox(const typename SK::Circle_3 &c)
}
if(b.zmin() != b.zmax()) {
Plane_3 pt_zneg_min = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z1-FT(1,100000)) ));
Plane_3 pt_zneg_max = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z1+FT(1,100000)) ));
Plane_3 pt_zpos_min = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z2-FT(1,100000)) ));
Plane_3 pt_zpos_max = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z2+FT(1,100000)) ));
Plane_3 pt_zneg_min = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z1-FT(FT_Q(1,100000))) ));
Plane_3 pt_zneg_max = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z1+FT(FT_Q(1,100000))) ));
Plane_3 pt_zpos_min = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z2-FT(FT_Q(1,100000))) ));
Plane_3 pt_zpos_max = theConstruct_plane_3(Polynomial_1_3(0,0,1,-(z2+FT(FT_Q(1,100000))) ));
std::vector< CGAL::Object > intersection_test_z_1;
std::vector< CGAL::Object > intersection_test_z_2;
@ -1599,7 +1599,7 @@ void _test_bounding_box_construct(SK sk)
Polynomial_for_spheres_2_3 es2 = Polynomial_for_spheres_2_3(1,0,0,1);
Polynomial_for_spheres_2_3 es3 = Polynomial_for_spheres_2_3(2,0,0,1);
for(int va=-5;va<6;va++) {
const FT a = -FT(va,10);
const FT a = -FT_Q(va,10);
const FT b = 1;
const FT c = 0;
const FT d = 0;
@ -1618,7 +1618,7 @@ void _test_bounding_box_construct(SK sk)
for(int vb=-5;vb<6;vb++) {
const FT al = 1;
const FT bl = 0;
const FT cl = -FT(vb,10);
const FT cl = -FT_Q(vb,10);
const FT dl = 0;
Polynomial_1_3 pol2 = Polynomial_1_3(al,bl,cl,dl);
Circle_3 c4 = theConstruct_circle_3(std::make_pair(es1, pol2));
@ -1630,10 +1630,10 @@ void _test_bounding_box_construct(SK sk)
_test_bbox<SK>(cap2.first);
}
const FT a_c = FT(va,10);
const FT a_c = FT_Q(va,10);
const FT b_c = 1;
const FT c_c = 0;
const FT d_c = -FT(va,10);
const FT d_c = -FT_Q(va,10);
Polynomial_1_3 pol2 = Polynomial_1_3(a_c,b_c,c_c,d_c);
Circle_3 c5 = theConstruct_circle_3(std::make_pair(es2, pol2));
std::vector< CGAL::Object > intersection_5;
@ -1655,7 +1655,7 @@ void _test_bounding_box_construct(SK sk)
const FT x = FT(vx);
const FT y = FT(vy);
const FT z = FT(vz);
const FT r = FT(vr,2);
const FT r = FT_Q(vr,2);
Sphere_3 sl_1 = theConstruct_sphere_3(
Polynomial_for_spheres_2_3(x,y,z,r*r));
Sphere_3 sl_2 = theConstruct_sphere_3(
@ -1800,13 +1800,13 @@ void _test_split_construct(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
Circular_arc_point_3 cp[8];
for(int i=0; i<8; i++) {
@ -1899,7 +1899,7 @@ void _test_construct_radical_plane(SK sk) {
const FT x = FT(vx);
const FT y = FT(vy);
const FT z = FT(vz);
const FT r = FT(vr,2);
const FT r = FT_Q(vr,2);
if(x == 0 && y == 0 && z == 0) continue;
Sphere_3 sl_1 = theConstruct_sphere_3(
Polynomial_for_spheres_2_3(x,y,z,r*r));

View File

@ -124,17 +124,17 @@ void _test_circle_equal(SK sk) {
r = theRandom.get_int(random_min,random_max);
} while(r <= 0);
if(a != 0) {
x = FT(-(b*u + c*v + d),a);
x = FT_Q(-(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);
y = FT_Q(-(a*u + c*v + d),b);
z = FT(v);
} else {
x = FT(u);
y = FT(v);
z = FT(-(a*u + b*v + d),c);
z = FT_Q(-(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);
@ -278,17 +278,17 @@ void _test_circular_arc_equal(SK sk) {
r = theRandom.get_int(random_min,random_max);
} while(r <= 0);
if(a != 0) {
x = FT(-(b*u + c*v + d),a);
x = FT_Q(-(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);
y = FT_Q(-(a*u + c*v + d),b);
z = FT(v);
} else {
x = FT(u);
y = FT(v);
z = FT(-(a*u + b*v + d),c);
z = FT_Q(-(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);
@ -360,8 +360,8 @@ void _test_has_on_predicate(SK sk) {
assert(theHas_on_3(s_1,p_3_s_1));
assert(!theHas_on_3(s_1,p_4_s_1));
std::cout << "Testing has_on(Sphere,Circular_arc_point)..." << std::endl;
Root_of_2 sqrt_1_div_3 = make_root_of_2(FT(0),FT(1),FT(1,3));
Root_of_2 sqrt_1_div_2 = make_root_of_2(FT(0),FT(1),FT(1,2));
Root_of_2 sqrt_1_div_3 = make_root_of_2(FT(0),FT(1),FT(FT_Q(1,3)));
Root_of_2 sqrt_1_div_2 = make_root_of_2(FT(0),FT(1),FT(FT_Q(1,2)));
Root_for_spheres_2_3 r_1_s_1 = Root_for_spheres_2_3(0,sqrt_1_div_2,sqrt_1_div_2);
Root_for_spheres_2_3 r_2_s_1 = Root_for_spheres_2_3(sqrt_1_div_3,sqrt_1_div_3,sqrt_1_div_3);
Root_for_spheres_2_3 r_3_s_1 = Root_for_spheres_2_3(sqrt_1_div_3,sqrt_1_div_3,-sqrt_1_div_3);
@ -378,7 +378,7 @@ void _test_has_on_predicate(SK sk) {
Plane_3 p_1 = theConstruct_plane_3(Polynomial_1_3(1,2,3,10));
std::cout << "Testing has_on(Plane,Point)..." << std::endl;
Point_3 p_1_p_1 = Point_3(-2,-1,-2);
Point_3 p_2_p_1 = Point_3(-FT(5,3),-FT(5,3),-FT(5,3));
Point_3 p_2_p_1 = Point_3(-FT(FT_Q(5,3)),-FT(FT_Q(5,3)),-FT(FT_Q(5,3)));
Point_3 p_3_p_1 = Point_3(-10,0,0);
Point_3 p_4_p_1 = Point_3(-2,-2,-1);
assert(theHas_on_3(p_1,p_1_p_1));
@ -431,9 +431,9 @@ void _test_has_on_predicate(SK sk) {
std::make_pair(Polynomial_for_spheres_2_3(0,0,0,1),
Polynomial_1_3(1,1,1,0));
Circle_3 c_2 = theConstruct_circle_3(pc2);
Root_of_2 r_1_1_c_2 = Root_of_2(FT(1,2));
Root_of_2 r_1_2_c_2 = make_root_of_2(-FT(1,4),-FT(1,4),FT(5));
Root_of_2 r_1_3_c_2 = make_root_of_2(-FT(1,4),FT(1,4),FT(5));
Root_of_2 r_1_1_c_2 = CGAL::make_root_of_2(FT(FT_Q(1,2)),FT(0),FT(0));
Root_of_2 r_1_2_c_2 = make_root_of_2(-FT(FT_Q(1,4)),-FT(FT_Q(1,4)),FT(5));
Root_of_2 r_1_3_c_2 = make_root_of_2(-FT(FT_Q(1,4)),FT(FT_Q(1,4)),FT(5));
Root_for_spheres_2_3 r_1_c_2 = Root_for_spheres_2_3(r_1_1_c_2,r_1_2_c_2,r_1_3_c_2);
Root_for_spheres_2_3 r_2_c_2 = Root_for_spheres_2_3(r_1_2_c_2,r_1_2_c_2,r_1_2_c_2);
Circular_arc_point_3 cp_1_c_2 = Circular_arc_point_3(r_1_c_2);
@ -528,13 +528,13 @@ void _test_has_on_predicate(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
Circular_arc_point_3 cp[8];
for(int i=0; i<8; i++) {
@ -565,13 +565,13 @@ void _test_has_on_predicate(SK sk) {
}
Root_for_spheres_2_3 rt2[8];
rt2[0] = Root_for_spheres_2_3(0,Root_of_2(0,FT(1,2),2),Root_of_2(0,FT(1,2),2));
rt2[0] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)));
rt2[1] = Root_for_spheres_2_3(0,0,1);
rt2[2] = Root_for_spheres_2_3(0,Root_of_2(0,-FT(1,2),2),Root_of_2(0,FT(1,2),2));
rt2[2] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)));
rt2[3] = Root_for_spheres_2_3(0,-1,0);
rt2[4] = Root_for_spheres_2_3(0,Root_of_2(0,-FT(1,2),2),Root_of_2(0,-FT(1,2),2));
rt2[4] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)));
rt2[5] = Root_for_spheres_2_3(0,0,-1);
rt2[6] = Root_for_spheres_2_3(0,Root_of_2(0,FT(1,2),2),Root_of_2(0,-FT(1,2),2));
rt2[6] = Root_for_spheres_2_3(0,CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)));
rt2[7] = Root_for_spheres_2_3(0,1,0);
for(int i=0; i<8; i++) {
@ -696,13 +696,13 @@ void _test_do_overlap_predicate(SK sk) {
Root_for_spheres_2_3 rt[8];
rt[0] = Root_for_spheres_2_3(0,1,0);
rt[1] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[1] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
rt[2] = Root_for_spheres_2_3(-1,0,0);
rt[3] = Root_for_spheres_2_3(Root_of_2(0,-FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[3] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[4] = Root_for_spheres_2_3(0,-1,0);
rt[5] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,-FT(1,2),2),0);
rt[5] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),-FT(FT_Q(1,2)),FT(2)),0);
rt[6] = Root_for_spheres_2_3(1,0,0);
rt[7] = Root_for_spheres_2_3(Root_of_2(0,FT(1,2),2), Root_of_2(0,FT(1,2),2),0);
rt[7] = Root_for_spheres_2_3(CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)), CGAL::make_root_of_2(FT(0),FT(FT_Q(1,2)),FT(2)),0);
Circular_arc_point_3 cp[8];
for(int i=0; i<8; i++) {

View File

@ -30,6 +30,7 @@
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Exact_spherical_kernel_3.h>
typedef CGAL::Exact_spherical_kernel_3::FT FT_Q;
#include <CGAL/_test_sphere_predicates.h>
#include <CGAL/_test_sphere_constructions.h>
#include <CGAL/_test_sphere_compute.h>

View File

@ -0,0 +1,56 @@
// Copyright (c) 2005-2006 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL 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.
//
// Partially supported by the IST Programme of the EU as a Shared-cost
// RTD (FET Open) Project under Contract No IST-2000-26473
// (ECG - Effective Computational Geometry for Curves and Surfaces)
// and a STREP (FET Open) Project under Contract No IST-006413
// (ACS -- Algorithms for Complex Shapes)
//
// $URL: svn+ssh://sloriot@scm.gforge.inria.fr/svn/cgal/trunk/Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel.cpp $
// $Id: test_Spherical_kernel.cpp 36659 2007-02-28 11:37:19Z afabri $
//
// Author(s) : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Pedro Machado <tashimir@gmail.com>
#include <CGAL/Cartesian.h>
#include <CGAL/Spherical_kernel_3.h>
#include <CGAL/Algebraic_kernel_for_spheres_2_3.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Gmpq.h>
typedef CGAL::Gmpq FT_Q;
#include <CGAL/_test_sphere_predicates.h>
#include <CGAL/_test_sphere_constructions.h>
#include <CGAL/_test_sphere_compute.h>
#include <CGAL/Polynomials_1_3.h>
#include <CGAL/Polynomials_2_3.h>
#include <CGAL/Polynomials_for_line_3.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
int pipo(int r){return r;}
int main()
{
typedef CGAL::Exact_predicates_exact_constructions_kernel Linear_k1;
typedef Linear_k1::FT FT;
typedef CGAL::Algebraic_kernel_for_spheres_2_3<FT> Algebraic_k1;
typedef CGAL::Spherical_kernel_3<Linear_k1,Algebraic_k1> SK1;
SK1 sk1;
_test_spherical_kernel_predicates(sk1);
_test_spherical_kernel_construct(sk1);
_test_spherical_kernel_compute(sk1);
return 0;
}

View File

@ -24,17 +24,23 @@
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
// Pedro Machado <tashimir@gmail.com>
#include <CGAL/Cartesian.h>
#include <CGAL/Spherical_kernel_3.h>
#include <CGAL/Algebraic_kernel_for_spheres_2_3.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Gmpq.h>
typedef CGAL::Quotient< CGAL::MP_Float > FT_Q;
#include <CGAL/_test_sphere_predicates.h>
#include <CGAL/_test_sphere_constructions.h>
#include <CGAL/_test_sphere_compute.h>
#include <CGAL/Polynomials_1_3.h>
#include <CGAL/Polynomials_2_3.h>
#include <CGAL/Polynomials_for_line_3.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
int pipo(int r){return r;}
int main()
{