mirror of https://github.com/CGAL/cgal
circle_on_ref_sphere.h : correct a bug in coeff
This commit is contained in:
parent
9e444fa800
commit
e061e6fa1d
|
|
@ -25,7 +25,7 @@ namespace CGAL {
|
|||
public:
|
||||
|
||||
Circle_on_reference_sphere_3(const FT& _r,const Point_3& _c,const Sphere_3& ref):Circle_3(Sphere_3(_r,_c),ref){
|
||||
_nature=SK::classify_one_circle(*this);
|
||||
_nature=CGAL::classify_one_circle<SK>(*this);
|
||||
#warning TRY WITH FLAG ONLY_SK_ALGEBRA
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +33,13 @@ namespace CGAL {
|
|||
|
||||
const Circle_type& type_of_circle_on_reference_sphere() const { return _nature;}
|
||||
const FT& supporting_sphere_radius() const { return this->supporting_sphere().radius();}
|
||||
const FT& supporting_sphere_squared_radius() const { return this->supporting_sphere().squared_radius();}
|
||||
const Point_3& supporting_sphere_center() const { return this->supporting_sphere().center();}
|
||||
//BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD
|
||||
//~ const FT& supporting_sphere_squared_radius() const { return this->supporting_sphere().squared_radius();}
|
||||
FT supporting_sphere_squared_radius() const { return this->supporting_sphere().squared_radius();}
|
||||
|
||||
//BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD
|
||||
//~ const Point_3& supporting_sphere_center() const { return this->supporting_sphere().center();}
|
||||
Point_3 supporting_sphere_center() const { return this->supporting_sphere().center();}
|
||||
const Sphere_3& reference_sphere() const{return this->base.reference_sphere();}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,42 @@ namespace CGAL{
|
|||
|
||||
template<class FT>
|
||||
FT circle_center_coefficent(const FT& x,const FT& y,const FT& z,const FT& r2,const FT& R2){
|
||||
return ((FT)(0.5) + (R2 - r2)/(FT)(2* x*x +y*y +z*z)) ;
|
||||
return ((FT)(0.5) + (R2 - r2)/(FT)(2* (x*x +y*y +z*z))) ;
|
||||
}
|
||||
|
||||
template<class SK, class circle_on_sphere>
|
||||
CGAL::Circle_type classify_one_circle(const circle_on_sphere& C){
|
||||
if (C.supporting_sphere().center().z()==0){
|
||||
typename SK::Point_3 Pt=C.center();
|
||||
if (Pt.z()==0 && Pt.y()==0 && Pt.x()==0)
|
||||
return CGAL::BIPOLAR;
|
||||
}
|
||||
std::vector<CGAL::Object> cont;
|
||||
typename SK::Plane_3 Pl=SK().construct_plane_3_object()(typename SK::Algebraic_kernel::Polynomial_1_3(0,1,0,0));
|
||||
typename SK::Intersect_3()(C.reference_sphere(),C.supporting_sphere(),Pl,std::back_inserter(cont));
|
||||
|
||||
switch (cont.size()){
|
||||
case 0:
|
||||
return CGAL::NORMAL;
|
||||
case 2:{
|
||||
std::pair<typename SK::Circular_arc_point_3,unsigned> p1,p2;
|
||||
CGAL::assign(p1,cont[0]);CGAL::assign(p2,cont[1]);
|
||||
CGAL::Sign s1=CGAL::sign(p1.first.x());
|
||||
CGAL::Sign s2=CGAL::sign(p2.first.x());
|
||||
if (s1==CGAL::opposite(s2))
|
||||
return CGAL::THREADED;
|
||||
else
|
||||
if (s1!=s2) return CGAL::POLAR;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (CGAL::abs(C.extremal_point_z())==C.reference_sphere().radius()) return CGAL::POLAR;
|
||||
}
|
||||
return CGAL::NORMAL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace SphericalFunctors {
|
|||
|
||||
//ACCESS FUNCTIONS
|
||||
template <class SK>
|
||||
class Compute_circle_center_coefficient_3: Has_qrt{
|
||||
class Compute_circle_center_coefficient_3/*: Has_qrt*/{
|
||||
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
|
||||
|
||||
public:
|
||||
|
|
@ -34,7 +34,7 @@ namespace SphericalFunctors {
|
|||
};
|
||||
|
||||
template <class SK>
|
||||
class Compute_extremal_point_z: Has_qrt{
|
||||
class Compute_extremal_point_z/*: Has_qrt*/{
|
||||
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
|
||||
|
||||
public:
|
||||
|
|
@ -77,28 +77,32 @@ namespace SphericalFunctors {
|
|||
{ return (a.rep().supporting_sphere_radius()); }
|
||||
};
|
||||
|
||||
//BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD
|
||||
template <class SK>
|
||||
class Compute_supporting_sphere_squared_radius_3: Has_qrt{
|
||||
class Compute_supporting_sphere_squared_radius_3/*: Has_qrt*/{
|
||||
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
|
||||
|
||||
public:
|
||||
|
||||
typedef typename SK::FT result_type;
|
||||
typedef const result_type & qualified_result_type;
|
||||
//~ typedef const result_type & qualified_result_type;
|
||||
typedef result_type qualified_result_type;
|
||||
typedef Arity_tag<1> Arity;
|
||||
|
||||
qualified_result_type operator() (const Circle_on_reference_sphere_3 & a) const
|
||||
{ return (a.rep().supporting_sphere_squared_radius()); }
|
||||
};
|
||||
|
||||
//BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD BAD
|
||||
template <class SK>
|
||||
class Compute_supporting_sphere_center_3: Has_qrt{
|
||||
class Compute_supporting_sphere_center_3/*: Has_qrt*/{
|
||||
typedef typename SK::Circle_on_reference_sphere_3 Circle_on_reference_sphere_3;
|
||||
|
||||
public:
|
||||
|
||||
typedef typename SK::Point_3 result_type;
|
||||
typedef const result_type & qualified_result_type;
|
||||
//~ typedef const result_type & qualified_result_type;
|
||||
typedef result_type qualified_result_type;
|
||||
typedef Arity_tag<1> Arity;
|
||||
|
||||
qualified_result_type operator() (const Circle_on_reference_sphere_3 & a) const
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ template < class SK > \
|
|||
};
|
||||
|
||||
template <class SK>
|
||||
class Construct_supporting_sphere_3//: Has_qrt
|
||||
class Construct_supporting_sphere_3: Has_qrt
|
||||
{
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Circle_3 Circle_3;
|
||||
|
|
|
|||
Loading…
Reference in New Issue