Add circular_arc_on_reference_sphere_3, but must remove Sphere_with_radius_3 from SK:

This commit is contained in:
Sébastien Loriot 2007-10-16 15:00:59 +00:00
parent 800e21e0eb
commit b4afba2e66
13 changed files with 212 additions and 38 deletions

View File

@ -29,6 +29,9 @@ public:
return *this;
}
Circle_on_reference_sphere_3()
:RCircle_on_reference_sphere_3(){}
Circle_on_reference_sphere_3(const RCircle_on_reference_sphere_3& p)
:RCircle_on_reference_sphere_3(p){}

View File

@ -1,12 +1,15 @@
#ifndef CGAL_CIRCULAR_ARC_ON_REFERENCE_SPHERE_3_H
#define CGAL_CIRCULAR_ARC_ON_REFERENCE_SPHERE_3_H
//~ #include <CGAL/Circular_arc_3.h>
//~ #include <CGAL/utility.h>
//~ #include <CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h>
namespace CGAL {
template <class SK>
class Circular_arc_on_reference_sphere_3
//~ : public SK::Kernel_base::Circular_arc_on_reference_sphere_3, public CGAL::Circular_arc_3<SK>
: public SK::Kernel_base::Circular_arc_on_reference_sphere_3, public SK::Circular_arc_3
: public SK::Kernel_base::Circular_arc_on_reference_sphere_3, public CGAL::Circular_arc_3<SK>
{
typedef typename SK::RT RT;
@ -14,10 +17,10 @@ namespace CGAL {
typedef typename SK::Line_3 Line_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::Circle_on_reference_sphere_3 Circle_3;
typedef typename SK::Sphere_with_radius_3 Sphere_3;
typedef typename SK::Segment_3 Segment_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Circular_arc_point_on_reference_sphere_3 Circular_arc_point_3;
typedef typename SK::Kernel_base::Circular_arc_on_reference_sphere_3 RCircular_arc_on_reference_sphere_3;
typedef typename CGAL::Circular_arc_3<SK> Circular_arc_3;
@ -40,52 +43,51 @@ namespace CGAL {
{}
Circular_arc_on_reference_sphere_3()
: Circular_arc_3()
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()())
{}
Circular_arc_on_reference_sphere_3(const Circle_3& c,
const Circular_arc_point_3& s,
const Circular_arc_point_3& t)
: Circular_arc_3(c,s,t){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c,s,t)){}
Circular_arc_on_reference_sphere_3(const Circle_3& c,
const Point_3& s,
const Circular_arc_point_3& t)
:Circular_arc_3(c,s,t){}
:RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c,s,t)){}
Circular_arc_on_reference_sphere_3(const Circle_3& c,
const Circular_arc_point_3& s,
const Point_3& t)
: Circular_arc_3(c,s,t){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c,s,t)){}
Circular_arc_on_reference_sphere_3(const Circle_3& c,
const Point_3& s,
const Point_3& t)
: Circular_arc_3(c,s,t){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c,s,t)){}
Circular_arc_on_reference_sphere_3(const Circle_3& c)
: Circular_arc_3(c){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c)){}
Circular_arc_on_reference_sphere_3(const Circle_3 &c,
const Sphere_3 &s1, bool less_xyz_s1,
const Sphere_3 &s2, bool less_xyz_s2)
: Circular_arc_3(c,s1,less_xyz_s1,s2,less_xyz_s2){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c,s1,less_xyz_s1,s2,less_xyz_s2)){}
Circular_arc_on_reference_sphere_3(const Sphere_3 &s1, bool less_xyz_s1,
const Sphere_3 &s2, bool less_xyz_s2,
const Circle_3 &c)
: Circular_arc_3(s1,less_xyz_s1,s2,less_xyz_s2,c){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(s1,less_xyz_s1,s2,less_xyz_s2,c)){}
Circular_arc_on_reference_sphere_3(const Circle_3 &c,
const Plane_3 &p1, bool less_xyz_p1,
const Plane_3 &p2, bool less_xyz_p2)
: Circular_arc_3(c,p1,less_xyz_p1,p2,less_xyz_p2){}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(c,p1,less_xyz_p1,p2,less_xyz_p2)){}
Circular_arc_on_reference_sphere_3(const Plane_3 &p1, bool less_xyz_p1,
const Plane_3 &p2, bool less_xyz_p2,
const Circle_3 &c)
: Circular_arc_3(p1,less_xyz_p1,p2,less_xyz_p2,c)
{}
: RCircular_arc_on_reference_sphere_3(typename R::Construct_circular_arc_on_reference_sphere_3()(p1,less_xyz_p1,p2,less_xyz_p2,c)){}
typename Qualified_result_of
<typename R::Compute_reference_sphere_3,Circular_arc_on_reference_sphere_3>::type

View File

@ -56,6 +56,9 @@ namespace CGAL {
Base base;
public:
typedef Sphere_3 Diametral_sphere;
typedef Plane_3 Supporting_plane;
Circle_representation_3() {}
Circle_representation_3(const Sphere_3& S1,const Sphere_3& S2):base(S1,S2){}
@ -101,7 +104,8 @@ namespace CGAL {
}
Sphere_3 diametral_sphere() const {
return Sphere_3(center(),squared_radius());
//~ return Sphere_3(center(),squared_radius());
return Sphere_3(CGAL::Sphere_3<SK>(center(),squared_radius()));
}
};
@ -122,6 +126,8 @@ namespace CGAL {
typedef typename SK::template Handle<Rep>::type Base;
Base base;
public:
typedef const Sphere_3& Diametral_sphere;
typedef const Plane_3& Supporting_plane;
Circle_representation_3() {}
@ -235,11 +241,13 @@ namespace CGAL {
Circle_3(const Sphere_3 &s1, const Sphere_3 &s2):base(s1,s2){}
const Plane_3& supporting_plane() const { return base.supporting_plane(); }
//~ const Plane_3& supporting_plane() const { return base.supporting_plane(); }
typename Container::Supporting_plane supporting_plane() const { return base.supporting_plane(); }
const Sphere_3& supporting_sphere() const { return base.supporting_sphere(); }
Point_3 center() const { return base.center(); }
FT squared_radius() const { return base.squared_radius(); }
const Sphere_3& diametral_sphere() const { return base.diametral_sphere(); }
//~ const Sphere_3& diametral_sphere() const { return base.diametral_sphere(); }
typename Container::Diametral_sphere diametral_sphere() const { return base.diametral_sphere(); }
FT area_divided_by_pi() const {
return squared_radius();

View File

@ -25,6 +25,8 @@ namespace CGAL {
public:
Circle_on_reference_sphere_3():Circle_3(){}
Circle_on_reference_sphere_3(const FT& _r,const Point_3& _c,const Sphere_3& ref):Circle_3(Sphere_3(_r,_c),ref){
_nature=CGAL::classify_one_circle<SK>(*this);
#warning TRY WITH FLAG ONLY_SK_ALGEBRA

View File

@ -31,7 +31,6 @@
#include <CGAL/utility.h>
#include <CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h>
#include <boost/utility/enable_if.hpp>
namespace CGAL {
@ -52,7 +51,7 @@ namespace CGAL {
private:
const Sphere_3& get_ref_sphere(const typename SK::Circle_on_reference_sphere_3& C){return C.reference_sphere();}
Sphere_3 get_ref_sphere(const typename SK::Circle_3& C){return Sphere_3();}
Sphere_3 get_ref_sphere(const typename SK::Circle_3& C){CGAL_assertion(false);}
typedef Triple<Circle_3, Circular_arc_point_3,
Circular_arc_point_3> Rep;
@ -72,7 +71,6 @@ namespace CGAL {
public:
const Sphere_3& reference_sphere(){
#warning put a compiling warning so that no Circular_arc_3 instantiates this function
return get_ref_sphere(get(base).first);
};

View File

@ -19,7 +19,8 @@ namespace CGAL {
typedef typename SK::Point_3 Point_3;
Sphere_with_radius_3():Sphere_3(){};
Sphere_with_radius_3(const FT& _r,const Point_3& _c):Sphere_3(_c,_r*_r),hrad(_r){};
const FT& radius() const {return CGAL::get(hrad);}
Sphere_with_radius_3(const Sphere_3& S):Sphere_3(S),hrad(-1){}
const FT& radius() const {CGAL_precondition(CGAL::get(hrad)!=-1); return CGAL::get(hrad);}
};
} // namespace CGALi

View File

@ -112,7 +112,7 @@ namespace SphericalFunctors {
template <class SK>
class Compute_reference_sphere_3: Has_qrt{
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
typedef typename SK::Circular_arc_on_reference_sphere_3 Circular_arc_on_reference_sphere_3;
public:
typedef typename SK::Sphere_with_radius_3 result_type;
@ -217,6 +217,87 @@ namespace SphericalFunctors {
//CONSTRUCTIONS
template < class SK >
class Construct_circular_arc_on_reference_sphere_3
{
typedef typename SK::Line_3 Line_3;
typedef typename SK::Point_3 Point_3;
typedef typename SK::Segment_3 Segment_3;
typedef typename SK::Sphere_3 Sphere_3;
typedef typename SK::Plane_3 Plane_3;
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Circular_arc_point_on_reference_sphere_3 Circular_arc_point_on_reference_sphere_3;
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
typedef typename SK::Sphere_with_radius_3 Sphere_with_radius_3;
typedef typename SK::Circular_arc_on_reference_sphere_3 Circular_arc_on_reference_sphere_3;
typedef typename SK::Kernel_base::Circular_arc_on_reference_sphere_3 RCircular_arc_on_reference_sphere_3;
typedef typename Circular_arc_on_reference_sphere_3::Rep Rep;
public:
typedef Circular_arc_on_reference_sphere_3 result_type;
typedef Arity_tag<3> Arity; // It is not true that each constructor has
// 3 operands, maybe we should remove this
result_type
operator()(void) const
{ return Rep(); }
result_type
operator()(const Circle_on_reference_sphere_3 &c) const
{ return Rep(c); }
result_type
operator()(const Circle_on_reference_sphere_3 &l,
const Circular_arc_point_on_reference_sphere_3 &s,
const Circular_arc_point_on_reference_sphere_3 &t) const
{ return Rep(l,s,t); }
result_type
operator()(const Circle_on_reference_sphere_3 &l,
const Point_3 &s,
const Circular_arc_point_on_reference_sphere_3 &t) const
{ return Rep(l,s,t); }
result_type
operator()(const Circle_on_reference_sphere_3 &l,
const Circular_arc_point_on_reference_sphere_3 &s,
const Point_3 &t) const
{ return Rep(l,s,t); }
result_type
operator()(const Circle_on_reference_sphere_3 &l,
const Point_3 &s,
const Point_3 &t) const
{ return Rep(l,s,t); }
result_type
operator()(const Circle_on_reference_sphere_3 &c,
const Sphere_with_radius_3 &s1, bool less_xyz_s1,
const Sphere_with_radius_3 &s2, bool less_xyz_s2) const
{ return Rep(c,s1,less_xyz_s1,s2,less_xyz_s2); }
result_type
operator()(const Sphere_with_radius_3 &s1, bool less_xyz_s1,
const Sphere_with_radius_3 &s2, bool less_xyz_s2,
const Circle_on_reference_sphere_3 &c) const
{ return Rep(c,s1,less_xyz_s1,s2,less_xyz_s2); }
result_type
operator()(const Circle_on_reference_sphere_3 &c,
const Plane_3 &p1, bool less_xyz_p1,
const Plane_3 &p2, bool less_xyz_p2) const
{ return Rep(c,p1,less_xyz_p1,p2,less_xyz_p2); }
result_type
operator()(const Plane_3 &p1, bool less_xyz_p1,
const Plane_3 &p2, bool less_xyz_p2,
const Circle_on_reference_sphere_3 &c) const
{ return Rep(c,p1,less_xyz_p1,p2,less_xyz_p2); }
};
template < class SK >
class Construct_circle_on_reference_sphere_3
{
@ -228,7 +309,10 @@ namespace SphericalFunctors {
typedef Circle_on_reference_sphere_3 result_type;
typedef Arity_tag<1> Arity;
result_type
operator()()
{ return Rep();}
result_type
operator()(const typename SK::FT& _r,const typename SK::Point_3& _c,const typename SK::Sphere_with_radius_3& S)
{ return Rep(_r,_c,S);}
@ -257,6 +341,10 @@ namespace SphericalFunctors {
result_type
operator()(const typename SK::FT& _r,const typename SK::Point_3& _c)
{ return Rep(_r,_c);}
result_type
operator()(const CGAL::Sphere_3<SK>& S)
{ return Rep(S);}
};

View File

@ -588,17 +588,17 @@ template < class SK > \
{
typedef typename SK::Line_3 Line_3;
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Point_3 Point_3;
typedef typename SK::Segment_3 Segment_3;
typedef typename SK::Sphere_3 Sphere_3;
typedef typename SK::Plane_3 Plane_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Circular_arc_3 Circular_arc_3;
typedef typename SK::Kernel_base::Circular_arc_3 RCircular_arc_3;
typedef typename Circular_arc_3::Rep Rep;
public:
typedef Circular_arc_3 result_type;
typedef Arity_tag<3> Arity; // It is not true that each constructor has
@ -659,7 +659,7 @@ template < class SK > \
const Plane_3 &p2, bool less_xyz_p2,
const Circle_3 &c) const
{ return Rep(c,p1,less_xyz_p1,p2,less_xyz_p2); }
};
template <class SK>
@ -786,6 +786,7 @@ template < class SK > \
typedef typename SK::Circular_arc_point_on_reference_sphere_3 Circular_arc_point_on_reference_sphere_3;
typedef typename SK::Circular_arc_3 Circular_arc_3;
typedef typename SK::Circle_3 Circle_3;
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
public:
@ -800,14 +801,22 @@ template < class SK > \
operator()(const Sphere_3 &a, const Point_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Sphere_with_radius_3 &a, const Point_3 &p) const
{ return has_on<SK>(static_cast<const Sphere_3&>(a), p); }
result_type
operator()(const Point_3 &p, const Sphere_3 &a) const
{ return false; }
result_type
operator()(const Point_3 &p, const Sphere_with_radius_3 &a) const
{ return false; }
result_type
operator()(const Sphere_3 &a, const Circular_arc_point_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Sphere_with_radius_3 &a, const Circular_arc_point_on_reference_sphere_3 &p) const
{ return (*this)(static_cast<const Sphere_3&>(a),static_cast<const Circular_arc_point_3&>(p)); }
@ -815,6 +824,11 @@ template < class SK > \
result_type
operator()(const Circular_arc_point_3 &p, const Sphere_3 &a) const
{ return false; }
result_type
operator()(const Circular_arc_point_3 &p, const Sphere_with_radius_3 &a) const
{ return false; }
result_type
operator()(const Plane_3 &a, const Point_3 &p) const
@ -851,6 +865,10 @@ template < class SK > \
result_type
operator()(const Circle_3 &a, const Point_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Circle_on_reference_sphere_3 &a, const Point_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Point_3 &p, const Circle_3 &a) const
@ -859,6 +877,10 @@ template < class SK > \
result_type
operator()(const Circle_3 &a, const Circular_arc_point_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Circle_on_reference_sphere_3& a, const Circular_arc_point_on_reference_sphere_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Circular_arc_point_3 &p, const Circle_3 &a) const
@ -868,6 +890,10 @@ template < class SK > \
operator()(const Sphere_3 &a, const Circle_3 &p) const
{ return has_on<SK>(a, p); }
result_type
operator()(const Sphere_with_radius_3 &a, const Circle_3 &p) const
{ return has_on<SK>(static_cast<const Sphere_3&>(a), p); }
result_type
operator()(const Circle_3 &p, const Sphere_3 &a) const
{ return false; }

View File

@ -53,6 +53,7 @@
CGAL_Spherical_Kernel_cons(Construct_theta_rep, construct_theta_rep_object)
CGAL_Spherical_Kernel_cons(Construct_circular_arc_point_on_reference_sphere_3, construct_circular_arc_point_on_reference_sphere_3_object)
CGAL_Spherical_Kernel_cons(Construct_circle_on_reference_sphere_3,construct_circle_on_reference_sphere_3_object)
CGAL_Spherical_Kernel_cons(Construct_circular_arc_on_reference_sphere_3,construct_circular_arc_on_reference_sphere_3)
CGAL_Spherical_Kernel_cons(Get_equation, get_equation_object)
CGAL_Spherical_Kernel_cons(Construct_circular_arc_point_3, construct_circular_arc_point_3_object)

View File

@ -40,6 +40,16 @@ namespace CGAL {
return a.has_on_boundary(p);
}
template <class SK>
inline
bool
has_on(const typename SK::Sphere_with_radius_3 &a,
const typename SK::Point_3 &p)
{
//~ return a.rep().has_on_boundary(p);
return a.has_on_boundary(p);
}
template <class SK>
inline
bool
@ -51,6 +61,14 @@ 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::Sphere_with_radius_3 &a,
const typename SK::Circular_arc_point_on_reference_sphere_3 &p){
return has_on<SK>(static_cast<const typename SK::Sphere_3&>(a),static_cast<const typename SK::Circular_arc_point_3&>(p));
}
/*
template <class SK>
inline
@ -116,6 +134,27 @@ namespace CGAL {
has_on<SK>(a.supporting_plane(),p);
}
//duplicated code
template <class SK>
inline
bool
has_on(const typename SK::Circle_on_reference_sphere_3 &a,
const typename SK::Point_3 &p)
{
return has_on<SK>(a.diametral_sphere(),p) &&
has_on<SK>(a.supporting_plane(),p);
}
template <class SK>
inline
bool
has_on(const typename SK::Circle_on_reference_sphere_3 &a,
const typename SK::Circular_arc_point_on_reference_sphere_3 &p)
{
return has_on<SK>(a.diametral_sphere(),p) &&
has_on<SK>(a.supporting_plane(),p);
}
template <class SK>
inline
bool

View File

@ -73,7 +73,7 @@ namespace CGAL {
typedef CGALi::Sphere_with_radius_3<SphericalKernel> Sphere_with_radius_3;
typedef CGALi::Circular_arc_3<SphericalKernel> Circular_arc_3;
typedef CGALi::Circle_on_reference_sphere_3<SphericalKernel> Circle_on_reference_sphere_3;
typedef CGALi::Circular_arc_3<SphericalKernel,Circle_3,Circular_arc_point_on_reference_sphere_3> Circular_arc_on_reference_sphere_3;
typedef CGALi::Circular_arc_3<SphericalKernel,Circle_on_reference_sphere_3,Circular_arc_point_on_reference_sphere_3> Circular_arc_on_reference_sphere_3;
// The mecanism that allows to specify reference-counting or not.
template < typename T >

View File

@ -34,6 +34,10 @@ namespace CGAL {
Sphere_with_radius_3(const FT& _r,const Point_3& _c)
: RSphere_with_radius_3(typename R::Construct_sphere_with_radius_3()(_r,_c))
{}
Sphere_with_radius_3(const CGAL::Sphere_3<SK>& S)
: RSphere_with_radius_3(typename R::Construct_sphere_with_radius_3()(S))
{}
typename Qualified_result_of
<typename R::Compute_radius_sphere_with_radius_3, Sphere_with_radius_3>::type

View File

@ -35,23 +35,23 @@
#include <CGAL/Circular_kernel_3/Circular_arc_point_on_reference_sphere_3.h>
#include <CGAL/Circular_arc_point_on_reference_sphere_3.h>
#include <CGAL/Circular_arc_on_reference_sphere_3.h>
#include <CGAL/Circular_kernel_3/Circle_3.h>
#include <CGAL/Circle_3.h>
#include <CGAL/Circular_kernel_3/Theta_rep.h>
#include <CGAL/Theta_rep.h>
#include <CGAL/Circular_kernel_3/Sphere_with_radius_3.h>
#include <CGAL/Sphere_with_radius_3.h>
#include <CGAL/Circular_kernel_3/Circle_3.h>
#include <CGAL/Circle_3.h>
#include <CGAL/Circular_kernel_3/Line_arc_3.h>
#include <CGAL/Line_arc_3.h>
#include <CGAL/Circular_kernel_3/Circular_arc_3.h>
#include <CGAL/Circular_arc_3.h>
#include <CGAL/Circular_arc_on_reference_sphere_3.h>
#include <CGAL/Circular_kernel_3/Circle_on_reference_sphere_3.h>
#include <CGAL/Circle_on_reference_sphere_3.h>
@ -75,10 +75,12 @@ namespace CGAL {
typedef CGALi::Line_arc_3<SphericalKernel> Line_arc_3;
typedef CGALi::Circular_arc_3<SphericalKernel> Circular_arc_3;
typedef CGALi::Circular_arc_point_on_reference_sphere_3<SphericalKernel> Circular_arc_point_on_reference_sphere_3;
typedef CGALi::Circular_arc_3<SphericalKernel,Circle_3,Circular_arc_point_on_reference_sphere_3> Circular_arc_on_reference_sphere_3;
typedef CGALi::Circle_on_reference_sphere_3<SphericalKernel> Circle_on_reference_sphere_3;
//~ typedef CGALi::Circular_arc_3<SphericalKernel,Circle_on_reference_sphere_3,Circular_arc_point_on_reference_sphere_3> Circular_arc_on_reference_sphere_3;
typedef CGALi::Circular_arc_3<SphericalKernel,CGAL::Circle_on_reference_sphere_3<SphericalKernel>,CGAL::Circular_arc_point_on_reference_sphere_3<SphericalKernel> > Circular_arc_on_reference_sphere_3;
typedef CGALi::Theta_rep<SphericalKernel> Theta_rep;
typedef CGALi::Sphere_with_radius_3<SphericalKernel> Sphere_with_radius_3;
typedef CGALi::Circle_on_reference_sphere_3<SphericalKernel> Circle_on_reference_sphere_3;
// The mecanism that allows to specify reference-counting or not.
template < typename T >