mirror of https://github.com/CGAL/cgal
Circular_kernel_3 = Curved_kernel_3, but with the correct name
This commit is contained in:
parent
c51efe2626
commit
7efc513915
|
|
@ -0,0 +1,133 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_CIRCLE_3_H
|
||||
#define CGAL_CIRCLE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
template <class SK>
|
||||
class Circle_3
|
||||
: public SK::Kernel_base::Circle_3
|
||||
{
|
||||
|
||||
typedef typename SK::RT RT;
|
||||
typedef typename SK::FT FT;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Vector_3 Vector_3;
|
||||
typedef typename SK::Direction_3 Direction_3;
|
||||
typedef typename SK::Kernel_base::Circle_3 RCircle_3;
|
||||
|
||||
|
||||
public:
|
||||
typedef RCircle_3 Rep;
|
||||
typedef SK R;
|
||||
|
||||
const Rep& rep() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Circle_3()
|
||||
: RCircle_3(typename R::Construct_circle_3()())
|
||||
{}
|
||||
|
||||
Circle_3(const Point_3& c, const FT& sr, const Plane_3& p)
|
||||
: RCircle_3(typename R::Construct_circle_3()(c,sr,p))
|
||||
{}
|
||||
|
||||
Circle_3(const Point_3& c, const FT& sr, const Direction_3& d)
|
||||
: RCircle_3(typename R::Construct_circle_3()(c,sr,d))
|
||||
{}
|
||||
|
||||
Circle_3(const Point_3& c, const FT& sr, const Vector_3& v)
|
||||
: RCircle_3(typename R::Construct_circle_3()(c,sr,v))
|
||||
{}
|
||||
|
||||
Circle_3(const Sphere_3& s1, const Sphere_3& s2)
|
||||
: RCircle_3(typename R::Construct_circle_3()(s1,s2))
|
||||
{}
|
||||
|
||||
Circle_3(const Sphere_3& s, const Plane_3& p)
|
||||
: RCircle_3(typename R::Construct_circle_3()(s,p))
|
||||
{}
|
||||
|
||||
Circle_3(const Plane_3& p, const Sphere_3& s)
|
||||
: RCircle_3(typename R::Construct_circle_3()(p,s))
|
||||
{}
|
||||
|
||||
Circle_3(const RCircle_3& r)
|
||||
: RCircle_3(r)
|
||||
{}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_diametral_sphere_3, Circle_3>::type
|
||||
//const Sphere_3 &
|
||||
diametral_sphere() const
|
||||
{
|
||||
return typename R::Construct_diametral_sphere_3()(*this);
|
||||
}
|
||||
|
||||
Point_3 center() const
|
||||
{
|
||||
return typename R::Construct_diametral_sphere_3()(*this).center();
|
||||
}
|
||||
|
||||
FT squared_radius() const
|
||||
{
|
||||
return typename R::Construct_diametral_sphere_3()(*this).squared_radius();
|
||||
}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_supporting_plane_3, Circle_3>::type
|
||||
//const Plane_3 &
|
||||
supporting_plane() const
|
||||
{
|
||||
return typename R::Construct_supporting_plane_3()(*this);
|
||||
}
|
||||
|
||||
Bbox_3 bbox() const
|
||||
{ return typename R::Construct_bbox_3()(*this); }
|
||||
|
||||
};
|
||||
|
||||
template < typename SK >
|
||||
inline
|
||||
bool
|
||||
operator==(const Circle_3<SK> &p,
|
||||
const Circle_3<SK> &q)
|
||||
{
|
||||
return SK().equal_3_object()(p, q);
|
||||
}
|
||||
|
||||
template < typename SK >
|
||||
inline
|
||||
bool
|
||||
operator!=(const Circle_3<SK> &p,
|
||||
const Circle_3<SK> &q)
|
||||
{
|
||||
return ! (p == q);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
|
||||
#ifndef CGAL_CIRCULAR_ARC_POINT_3_H
|
||||
#define CGAL_CIRCULAR_ARC_POINT_3_H
|
||||
namespace CGAL {
|
||||
|
||||
template < typename SphericalKernel >
|
||||
class Circular_arc_point_3
|
||||
: public SphericalKernel::Kernel_base::Circular_arc_point_3
|
||||
{
|
||||
typedef typename SphericalKernel::Kernel_base::Circular_arc_point_3
|
||||
RCircular_arc_point_3;
|
||||
|
||||
typedef typename SphericalKernel::Root_of_2 Root_of_2;
|
||||
typedef typename SphericalKernel::Point_3 Point_3;
|
||||
typedef typename SphericalKernel::Plane_3 Plane_3;
|
||||
typedef typename SphericalKernel::Line_3 Line_3;
|
||||
typedef typename SphericalKernel::Circle_3 Circle_3;
|
||||
typedef typename SphericalKernel::Sphere_3 Sphere_3;
|
||||
|
||||
public:
|
||||
typedef typename SphericalKernel::Root_for_spheres_2_3
|
||||
Root_for_spheres_2_3;
|
||||
typedef SphericalKernel R;
|
||||
typedef RCircular_arc_point_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Circular_arc_point_3()
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()())
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Root_of_2 & x,
|
||||
const Root_of_2 & y,
|
||||
const Root_of_2 & z)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(x,y,z))
|
||||
{}
|
||||
|
||||
|
||||
Circular_arc_point_3(const Root_for_spheres_2_3 & np)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(np))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const RCircular_arc_point_3 & p)
|
||||
: RCircular_arc_point_3(p)
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Point_3 & p)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(p))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s1,
|
||||
const Sphere_3 & s2,
|
||||
const Sphere_3 & s3,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s1,s2,s3,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Plane_3 & p,
|
||||
const Sphere_3 & s1,
|
||||
const Sphere_3 & s2,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(p,s1,s2,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s1,
|
||||
const Plane_3 & p,
|
||||
const Sphere_3 & s2,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s1,p,s2,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s1,
|
||||
const Sphere_3 & s2,
|
||||
const Plane_3 & p,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s1,s2,p,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Plane_3 & p1,
|
||||
const Plane_3 & p2,
|
||||
const Sphere_3 & s,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(p1,p2,s,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Plane_3 & p1,
|
||||
const Sphere_3 & s,
|
||||
const Plane_3 & p2,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(p1,s,p2,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s,
|
||||
const Plane_3 & p1,
|
||||
const Plane_3 & p2,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s,p1,p2,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Line_3 & l,
|
||||
const Sphere_3 & s,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(l,s,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s,
|
||||
const Line_3 & l,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s,l,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Circle_3 & c,
|
||||
const Sphere_3 & s,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(c,s,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s,
|
||||
const Circle_3 & c,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s,c,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Circle_3 & c,
|
||||
const Plane_3 & p,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(c,p,less_xyz))
|
||||
{}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 & s,
|
||||
const Plane_3 & p,
|
||||
const bool less_xyz = true)
|
||||
: RCircular_arc_point_3(
|
||||
typename R::Construct_circular_arc_point_3()(s,p,less_xyz))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_circular_x_3,Circular_arc_point_3>::type
|
||||
//const Root_of_2 &
|
||||
x() const
|
||||
{ return typename R::Compute_circular_x_3()(*this);}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_circular_y_3,Circular_arc_point_3>::type
|
||||
//const Root_of_2 &
|
||||
y() const
|
||||
{ return typename R::Compute_circular_y_3()(*this);}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_circular_z_3,Circular_arc_point_3>::type
|
||||
//const Root_of_2 &
|
||||
z() const
|
||||
{ return typename R::Compute_circular_z_3()(*this);}
|
||||
|
||||
Bbox_3 bbox() const
|
||||
{ return typename R::Construct_bbox_3()(*this); }
|
||||
|
||||
};
|
||||
|
||||
template < class SK >
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os, const Circular_arc_point_3<SK> &p)
|
||||
{
|
||||
//I can make it because I know the output format of Root_for_circle
|
||||
return os << p.x() << " " << p.y() << " " << p.z() << " " ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_CIRCLE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_CIRCLE_3_H
|
||||
|
||||
#include <CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGALi{
|
||||
template <class SK> class Circle_3 {
|
||||
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Vector_3 Vector_3;
|
||||
typedef typename SK::Direction_3 Direction_3;
|
||||
typedef typename SK::FT FT;
|
||||
|
||||
private:
|
||||
typedef std::pair<Sphere_3, Plane_3> Rep;
|
||||
typedef typename SK::template Handle<Rep>::type Base;
|
||||
|
||||
Base base;
|
||||
|
||||
public:
|
||||
Circle_3() {}
|
||||
|
||||
Circle_3(const Point_3& center, const FT& squared_r, const Direction_3& d)
|
||||
{
|
||||
// It is not allowed non-positive radius
|
||||
// Should we keep this pre-condition?
|
||||
CGAL_kernel_assertion(squared_r > 0);
|
||||
base = Rep(Sphere_3(center,squared_r),
|
||||
plane_from_point_direction(center, d));
|
||||
}
|
||||
|
||||
Circle_3(const Point_3& center, const FT& squared_r, const Vector_3& normal)
|
||||
{
|
||||
// It is not allowed non-positive radius
|
||||
// Should we keep this pre-condition?
|
||||
CGAL_kernel_assertion(squared_r > 0);
|
||||
base = Rep(Sphere_3(center,squared_r),
|
||||
plane_from_point_direction(center, normal.direction()));
|
||||
}
|
||||
|
||||
Circle_3(const Point_3& center, const FT& squared_r, const Plane_3& p)
|
||||
{
|
||||
// the plane contains the center
|
||||
CGAL_kernel_assertion((p.a() * center.x() +
|
||||
p.b() * center.y() +
|
||||
p.c() * center.z() +
|
||||
p.d()) == ZERO);
|
||||
// It is not allowed non-positive radius
|
||||
// Should we keep this pre-condition?
|
||||
CGAL_kernel_assertion(squared_r > 0);
|
||||
base = Rep(Sphere_3(center,squared_r), p);
|
||||
}
|
||||
|
||||
Circle_3(const Sphere_3 &s1,
|
||||
const Sphere_3 &s2) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(s1, s2, std::back_inserter(sols));
|
||||
// s1,s2 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
typename SK::Circle_3 circle;
|
||||
// the intersection must be a circle (no point allowed)
|
||||
CGAL_kernel_precondition(assign(circle,sols[0]));
|
||||
assign(circle,sols[0]);
|
||||
*this = circle.rep();
|
||||
}
|
||||
|
||||
Circle_3(const Plane_3 &p,
|
||||
const Sphere_3 &s) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(p, s, std::back_inserter(sols));
|
||||
// s1,s2 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
typename SK::Circle_3 circle;
|
||||
// the intersection must be a circle (no point allowed)
|
||||
CGAL_kernel_precondition(assign(circle,sols[0]));
|
||||
assign(circle,sols[0]);
|
||||
*this = circle.rep();
|
||||
}
|
||||
|
||||
const Plane_3& supporting_plane() const {
|
||||
return get(base).second;
|
||||
}
|
||||
|
||||
Point_3 center() const {
|
||||
return get(base).first.center();
|
||||
}
|
||||
|
||||
FT squared_radius() const {
|
||||
return get(base).first.squared_radius();
|
||||
}
|
||||
|
||||
const Sphere_3& diametral_sphere() const {
|
||||
return get(base).first;
|
||||
}
|
||||
|
||||
// this bbox function
|
||||
// can be optimize by doing different cases
|
||||
// for each variable = 0 (cases with is_zero)
|
||||
const CGAL::Bbox_3 bbox() const {
|
||||
typedef CGAL::Interval_nt<false> Interval;
|
||||
CGAL::Interval_nt<false>::Protector ip;
|
||||
const Plane_3 &plane = supporting_plane();
|
||||
const Point_3 &p = center();
|
||||
const FT &sq_r = squared_radius();
|
||||
const Interval a = CGAL::to_interval(plane.a());
|
||||
const Interval b = CGAL::to_interval(plane.b());
|
||||
const Interval c = CGAL::to_interval(plane.c());
|
||||
const Interval x = CGAL::to_interval(p.x());
|
||||
const Interval y = CGAL::to_interval(p.y());
|
||||
const Interval z = CGAL::to_interval(p.z());
|
||||
const Interval r2 = CGAL::to_interval(sq_r);
|
||||
const Interval r = CGAL::sqrt(r2); // maybe we can work with r2
|
||||
// in order to save this operation
|
||||
// but if the coefficients are to high
|
||||
// the multiplication would lead to inf results
|
||||
const Interval a2 = CGAL::square(a);
|
||||
const Interval b2 = CGAL::square(b);
|
||||
const Interval c2 = CGAL::square(c);
|
||||
const Interval sqr_sum = a2 + b2 + c2;
|
||||
const Interval mx = r * CGAL::sqrt((sqr_sum - a2)/sqr_sum);
|
||||
const Interval my = r * CGAL::sqrt((sqr_sum - b2)/sqr_sum);
|
||||
const Interval mz = r * CGAL::sqrt((sqr_sum - c2)/sqr_sum);
|
||||
return CGAL::Bbox_3((x-mx).inf(),(y-my).inf(), (z-mz).inf(),
|
||||
(x+mx).sup(),(y+my).sup(), (z+mz).sup());
|
||||
}
|
||||
|
||||
bool operator==(const Circle_3 &) const;
|
||||
bool operator!=(const Circle_3 &) const;
|
||||
|
||||
};
|
||||
|
||||
template < class SK >
|
||||
CGAL_KERNEL_INLINE
|
||||
bool
|
||||
Circle_3<SK>::operator==(const Circle_3<SK> &t) const
|
||||
{
|
||||
if (CGAL::identical(base, t.base))
|
||||
return true;
|
||||
return CGAL::SphericalFunctors::non_oriented_equal<SK>(*this, t);
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
CGAL_KERNEL_INLINE
|
||||
bool
|
||||
Circle_3<SK>::operator!=(const Circle_3<SK> &t) const
|
||||
{
|
||||
return !(*this == t);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_CIRCULAR_ARC_POINT_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_CIRCULAR_ARC_POINT_3_H
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
//#include <CGAL/global_functions_on_roots_and_polynomials_2_2.h>
|
||||
// fixme, devrait
|
||||
// appeler fonction de global_functions_on_circular_arcs
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGALi {
|
||||
|
||||
template <class SK >
|
||||
class Circular_arc_point_3
|
||||
{
|
||||
typedef typename SK::FT FT;
|
||||
typedef typename SK::Root_of_2 Root_of_2;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
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 SK::Line_3 Line_3;
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Circle_3 Circle_3;
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
|
||||
typedef Root_for_spheres_2_3 Rep;
|
||||
typedef typename SK::template Handle<Rep>::type Base;
|
||||
|
||||
Base base;
|
||||
|
||||
public:
|
||||
|
||||
Circular_arc_point_3() {}
|
||||
|
||||
Circular_arc_point_3(const Root_of_2 & x,
|
||||
const Root_of_2 & y,
|
||||
const Root_of_2 & z)
|
||||
: base(x,y,z){}
|
||||
|
||||
Circular_arc_point_3(const Root_for_spheres_2_3 & np)
|
||||
: base(np){}
|
||||
|
||||
Circular_arc_point_3(const Point_3 & p)
|
||||
: base(p.x(),p.y(),p.z()){}
|
||||
|
||||
Circular_arc_point_3(const Sphere_3 &s1,
|
||||
const Sphere_3 &s2,
|
||||
const Sphere_3 &s3,
|
||||
const bool less_xyz = true) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(s1, s2, s3, std::back_inserter(sols));
|
||||
// s1,s2,s3 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
if(sols.size() == 1) {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersection must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
assign(pair,sols[0]);
|
||||
*this = pair.first.rep();
|
||||
} else {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersections must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
CGAL_kernel_precondition(assign(pair,sols[1]));
|
||||
assign(pair,sols[less_xyz?0:1]);
|
||||
*this = pair.first.rep();
|
||||
}
|
||||
}
|
||||
|
||||
Circular_arc_point_3(const Plane_3 &p,
|
||||
const Sphere_3 &s1,
|
||||
const Sphere_3 &s2,
|
||||
const bool less_xyz = true) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(p, s1, s2, std::back_inserter(sols));
|
||||
// s1,s2,s3 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
if(sols.size() == 1) {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersection must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
assign(pair,sols[0]);
|
||||
*this = pair.first.rep();
|
||||
} else {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersections must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
CGAL_kernel_precondition(assign(pair,sols[1]));
|
||||
assign(pair,sols[less_xyz?0:1]);
|
||||
*this = pair.first.rep();
|
||||
}
|
||||
}
|
||||
|
||||
Circular_arc_point_3(const Plane_3 &p1,
|
||||
const Plane_3 &p2,
|
||||
const Sphere_3 &s,
|
||||
const bool less_xyz = true) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(p1, p2, s, std::back_inserter(sols));
|
||||
// s1,s2,s3 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
if(sols.size() == 1) {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersection must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
assign(pair,sols[0]);
|
||||
*this = pair.first.rep();
|
||||
} else {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersections must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
CGAL_kernel_precondition(assign(pair,sols[1]));
|
||||
assign(pair,sols[less_xyz?0:1]);
|
||||
*this = pair.first.rep();
|
||||
}
|
||||
}
|
||||
|
||||
Circular_arc_point_3(const Line_3 &l,
|
||||
const Sphere_3 &s,
|
||||
const bool less_xyz = true) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(l, s, std::back_inserter(sols));
|
||||
// s1,s2,s3 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
if(sols.size() == 1) {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersection must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
assign(pair,sols[0]);
|
||||
*this = pair.first.rep();
|
||||
} else {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersections must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
CGAL_kernel_precondition(assign(pair,sols[1]));
|
||||
assign(pair,sols[less_xyz?0:1]);
|
||||
*this = pair.first.rep();
|
||||
}
|
||||
}
|
||||
|
||||
Circular_arc_point_3(const Circle_3 &c,
|
||||
const Plane_3 &p,
|
||||
const bool less_xyz = true) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(c, p, std::back_inserter(sols));
|
||||
// s1,s2,s3 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
if(sols.size() == 1) {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersection must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
assign(pair,sols[0]);
|
||||
*this = pair.first.rep();
|
||||
} else {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersections must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
CGAL_kernel_precondition(assign(pair,sols[1]));
|
||||
assign(pair,sols[less_xyz?0:1]);
|
||||
*this = pair.first.rep();
|
||||
}
|
||||
}
|
||||
|
||||
Circular_arc_point_3(const Circle_3 &c,
|
||||
const Sphere_3 &s,
|
||||
const bool less_xyz = true) {
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(c, s, std::back_inserter(sols));
|
||||
// s1,s2,s3 must intersect
|
||||
CGAL_kernel_precondition(sols.size() != 0);
|
||||
if(sols.size() == 1) {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersection must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
assign(pair,sols[0]);
|
||||
*this = pair.first.rep();
|
||||
} else {
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair;
|
||||
// the intersections must be a point
|
||||
CGAL_kernel_precondition(assign(pair,sols[0]));
|
||||
CGAL_kernel_precondition(assign(pair,sols[1]));
|
||||
assign(pair,sols[less_xyz?0:1]);
|
||||
*this = pair.first.rep();
|
||||
}
|
||||
}
|
||||
|
||||
const Root_of_2 & x() const { return get(base).x(); }
|
||||
const Root_of_2 & y() const { return get(base).y(); }
|
||||
const Root_of_2 & z() const { return get(base).z(); }
|
||||
|
||||
const Root_for_spheres_2_3 & coordinates() const { return get(base); }
|
||||
|
||||
const CGAL::Bbox_3 bbox() const {
|
||||
return get(base).bbox();
|
||||
}
|
||||
|
||||
bool operator==(const Circular_arc_point_3 &) const;
|
||||
bool operator!=(const Circular_arc_point_3 &) const;
|
||||
|
||||
};
|
||||
|
||||
template < class SK >
|
||||
CGAL_KERNEL_INLINE
|
||||
bool
|
||||
Circular_arc_point_3<SK>::operator==(const Circular_arc_point_3<SK> &t) const
|
||||
{
|
||||
if (CGAL::identical(base, t.base))
|
||||
return true;
|
||||
return x() == t.x() &&
|
||||
y() == t.y() &&
|
||||
z() == t.z();
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
CGAL_KERNEL_INLINE
|
||||
bool
|
||||
Circular_arc_point_3<SK>::operator!=(const Circular_arc_point_3<SK> &t) const
|
||||
{
|
||||
return !(*this == t);
|
||||
}
|
||||
|
||||
template < typename SK >
|
||||
std::ostream &
|
||||
print(std::ostream & os, const Circular_arc_point_3<SK> &p)
|
||||
{
|
||||
return os << "CirclArcEndPoint_3(" << p.x() << ", " << p.y() << ')' << std::endl;
|
||||
}
|
||||
|
||||
} // namespace CGALi
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SPHERICAL_KERNEL_CIRCULAR_ARC_POINT_3_H
|
||||
|
|
@ -0,0 +1,220 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_LINE_ARC_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_LINE_ARC_3_H
|
||||
|
||||
#include<CGAL/utility.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGALi{
|
||||
template <class SK> class Line_arc_3 {
|
||||
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Segment_3 Segment_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Line_3 Line_3;
|
||||
typedef typename SK::FT FT;
|
||||
|
||||
private:
|
||||
typedef Triple<Line_3, Circular_arc_point_3,
|
||||
Circular_arc_point_3> Rep;
|
||||
typedef typename SK::template Handle<Rep>::type Base;
|
||||
|
||||
Base base;
|
||||
mutable unsigned char begin_less_xyz_than_end_flag;
|
||||
|
||||
bool begin_less_xyz_than_end() const {
|
||||
if(begin_less_xyz_than_end_flag == 0) {
|
||||
if(SK().compare_xyz_3_object()(source(), target()) < 0)
|
||||
begin_less_xyz_than_end_flag = 2;
|
||||
else begin_less_xyz_than_end_flag = 1;
|
||||
} return begin_less_xyz_than_end_flag == 2;
|
||||
}
|
||||
|
||||
public:
|
||||
Line_arc_3()
|
||||
: begin_less_xyz_than_end_flag(0)
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Circular_arc_point_3 &s,
|
||||
const Circular_arc_point_3 &t)
|
||||
: begin_less_xyz_than_end_flag(0)
|
||||
{
|
||||
// l must pass through s and t, and s != t
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,s));
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,t));
|
||||
CGAL_kernel_precondition(s != t);
|
||||
base = Rep(l,s,t);
|
||||
}
|
||||
|
||||
Line_arc_3(const Segment_3 &s)
|
||||
: begin_less_xyz_than_end_flag(0)
|
||||
{
|
||||
base = Rep(s.supporting_line(),
|
||||
s.source(),
|
||||
s.target());
|
||||
}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Point_3 &s,
|
||||
const Point_3 &t)
|
||||
: begin_less_xyz_than_end_flag(0)
|
||||
{
|
||||
// l must pass through s and t, and s != t
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,s));
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,t));
|
||||
CGAL_kernel_precondition(Circular_arc_point_3(s) !=
|
||||
Circular_arc_point_3(t));
|
||||
base = Rep(l,s,t);
|
||||
}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Point_3 &s,
|
||||
const Circular_arc_point_3 &t)
|
||||
: begin_less_xyz_than_end_flag(0)
|
||||
{
|
||||
// l must pass through s and t, and s != t
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,s));
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,t));
|
||||
CGAL_kernel_precondition(Circular_arc_point_3(s) != t);
|
||||
base = Rep(l,s,t);
|
||||
}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Circular_arc_point_3 &s,
|
||||
const Point_3 &t)
|
||||
: begin_less_xyz_than_end_flag(0)
|
||||
{
|
||||
// l must pass through s and t, and s != t
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,s));
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l,t));
|
||||
CGAL_kernel_precondition(s != Circular_arc_point_3(t));
|
||||
base = Rep(l,s,t);
|
||||
}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Sphere_3 &s,
|
||||
bool less_xyz_first = true)
|
||||
{
|
||||
std::vector<Object> sols;
|
||||
SK().intersect_3_object()(l, s, std::back_inserter(sols));
|
||||
// l must intersect s in 2 points
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair1, pair2;
|
||||
CGAL_kernel_precondition(sols.size() == 2);
|
||||
assign(pair1,sols[0]);
|
||||
assign(pair2,sols[1]);
|
||||
if(less_xyz_first) {
|
||||
*this = Line_arc_3(l, pair1.first, pair2.first);
|
||||
} else {
|
||||
*this = Line_arc_3(l, pair2.first, pair1.first);
|
||||
}
|
||||
}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Sphere_3 &s1, bool less_xyz_s1,
|
||||
const Sphere_3 &s2, bool less_xyz_s2)
|
||||
{
|
||||
std::vector<Object> sols1, sols2;
|
||||
SK().intersect_3_object()(l, s1, std::back_inserter(sols1));
|
||||
SK().intersect_3_object()(l, s2, std::back_inserter(sols2));
|
||||
std::pair<typename SK::Circular_arc_point_3, unsigned> pair1, pair2;
|
||||
// l must intersect s1 and s2
|
||||
CGAL_kernel_precondition(sols1.size() > 0);
|
||||
CGAL_kernel_precondition(sols2.size() > 0);
|
||||
assign(pair1,sols1[(sols1.size()==1)?(0):(less_xyz_s1?0:1)]);
|
||||
assign(pair2,sols2[(sols2.size()==1)?(0):(less_xyz_s2?0:1)]);
|
||||
// the source and target must be different
|
||||
CGAL_kernel_precondition(pair1.first != pair2.first);
|
||||
*this = Line_arc_3(l, pair1.first, pair2.first);
|
||||
}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Plane_3 &p1,
|
||||
const Plane_3 &p2)
|
||||
{
|
||||
// l must not be on p1 or p2
|
||||
CGAL_kernel_precondition(!SK().has_on_3_object()(p1,l));
|
||||
CGAL_kernel_precondition(!SK().has_on_3_object()(p2,l));
|
||||
typename SK::Point_3 point1, point2;
|
||||
// l must intersect p1 and p2
|
||||
assert(assign(point1,SK().intersect_3_object()(l, p1)));
|
||||
assert(assign(point2,SK().intersect_3_object()(l, p2)));
|
||||
assign(point1,SK().intersect_3_object()(l, p1));
|
||||
assign(point2,SK().intersect_3_object()(l, p2));
|
||||
// the source and target must be different
|
||||
CGAL_kernel_precondition(point1 != point2);
|
||||
*this = Line_arc_3(l, point1, point2);
|
||||
}
|
||||
|
||||
const Line_3& supporting_line() const
|
||||
{
|
||||
return get(base).first;
|
||||
}
|
||||
|
||||
const Circular_arc_point_3& source() const
|
||||
{
|
||||
return get(base).second;
|
||||
}
|
||||
|
||||
const Circular_arc_point_3& target() const
|
||||
{
|
||||
return get(base).third;
|
||||
}
|
||||
|
||||
const Circular_arc_point_3& lower_xyz_extremity() const
|
||||
{
|
||||
return begin_less_xyz_than_end() ? source() : target();
|
||||
}
|
||||
|
||||
const Circular_arc_point_3& higher_xyz_extremity() const
|
||||
{
|
||||
return begin_less_xyz_than_end() ? target() : source();
|
||||
}
|
||||
|
||||
const CGAL::Bbox_3 bbox() const {
|
||||
return source().bbox() + target().bbox();
|
||||
}
|
||||
|
||||
bool operator==(const Line_arc_3 &) const;
|
||||
bool operator!=(const Line_arc_3 &) const;
|
||||
|
||||
};
|
||||
|
||||
template < class SK >
|
||||
CGAL_KERNEL_INLINE
|
||||
bool
|
||||
Line_arc_3<SK>::operator==(const Line_arc_3<SK> &t) const
|
||||
{
|
||||
if (CGAL::identical(base, t.base))
|
||||
return true;
|
||||
return CGAL::SphericalFunctors::non_oriented_equal<SK>(*this, t);
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
CGAL_KERNEL_INLINE
|
||||
bool
|
||||
Line_arc_3<SK>::operator!=(const Line_arc_3<SK> &t) const
|
||||
{
|
||||
return !(*this == t);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,76 @@
|
|||
// Copyright (c) 2003-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.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_FUNCTIONS_ON_CIRCLE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_FUNCTIONS_ON_CIRCLE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// At the moment we dont need those functions
|
||||
// But in the future maybe (some make_x_monotone? etc..)
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
x_extremal_point(const Circle_3<SK> & c, bool i)
|
||||
{
|
||||
return SphericalFunctors::x_extremal_point<SK>(c,i);
|
||||
}
|
||||
|
||||
template <class SK, class OutputIterator>
|
||||
OutputIterator
|
||||
x_extremal_points(const Circle_3<SK> & c, OutputIterator res)
|
||||
{
|
||||
return SphericalFunctors::x_extremal_point<SK>(c,res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
y_extremal_point(const Circle_3<SK> & c, bool i)
|
||||
{
|
||||
return SphericalFunctors::y_extremal_point<SK>(c,i);
|
||||
}
|
||||
|
||||
template <class SK, class OutputIterator>
|
||||
OutputIterator
|
||||
y_extremal_points(const Circle_3<SK> & c, OutputIterator res)
|
||||
{
|
||||
return SphericalFunctors::y_extremal_point<SK>(c,res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
z_extremal_point(const Circle_3<SK> & c, bool i)
|
||||
{
|
||||
return SphericalFunctors::z_extremal_point<SK>(c,i);
|
||||
}
|
||||
|
||||
template <class SK, class OutputIterator>
|
||||
OutputIterator
|
||||
z_extremal_points(const Circle_3<SK> & c, OutputIterator res)
|
||||
{
|
||||
return SphericalFunctors::z_extremal_point<SK>(c,res);
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SPHERICAL_KERNEL_FUNCTIONS_ON_CIRCLE_3_H
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
// Copyright (c) 2003-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.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Monique Teillaud, Sylvain Pion
|
||||
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_FUNCTIONS_ON_SPHERE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_FUNCTIONS_ON_SPHERE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// At the moment we dont need those functions
|
||||
// But in the future maybe (some make_x_monotone? etc..)
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
x_extremal_point(const Sphere_3<SK> & c, bool i)
|
||||
{
|
||||
return SphericalFunctors::x_extremal_point<SK>(c,i);
|
||||
}
|
||||
|
||||
template <class SK, class OutputIterator>
|
||||
OutputIterator
|
||||
x_extremal_points(const Sphere_3<SK> & c, OutputIterator res)
|
||||
{
|
||||
return SphericalFunctors::x_extremal_point<SK>(c,res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
y_extremal_point(const Sphere_3<SK> & c, bool i)
|
||||
{
|
||||
return SphericalFunctors::y_extremal_point<SK>(c,i);
|
||||
}
|
||||
|
||||
template <class SK, class OutputIterator>
|
||||
OutputIterator
|
||||
y_extremal_points(const Sphere_3<SK> & c, OutputIterator res)
|
||||
{
|
||||
return SphericalFunctors::y_extremal_point<SK>(c,res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
z_extremal_point(const Sphere_3<SK> & c, bool i)
|
||||
{
|
||||
return SphericalFunctors::z_extremal_point<SK>(c,i);
|
||||
}
|
||||
|
||||
template <class SK, class OutputIterator>
|
||||
OutputIterator
|
||||
z_extremal_points(const Sphere_3<SK> & c, OutputIterator res)
|
||||
{
|
||||
return SphericalFunctors::z_extremal_point<SK>(c,res);
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CURVED_KERNEL_FUNCTIONS_ON_SPHERE_3_H
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_GET_EQUATION_OBJECT_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_GET_EQUATION_OBJECT_3_H
|
||||
|
||||
#include <CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h>
|
||||
#include <CGAL/Circular_kernel_3/internal_functions_on_line_3.h>
|
||||
#include <CGAL/Circular_kernel_3/internal_functions_on_plane_3.h>
|
||||
#include <CGAL/Circular_kernel_3/internal_functions_on_circle_3.h>
|
||||
// to be removed when CGAL::Kernel has a Get_equation
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template < class SK >
|
||||
class Get_equation //: public LinearFunctors::Get_equation<SK>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef void result_type; // should we keep this?
|
||||
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 result_type_for_sphere;
|
||||
typedef typename SK::Polynomial_1_3 result_type_for_plane;
|
||||
typedef typename SK::Polynomials_for_line_3 result_type_for_line;
|
||||
typedef typename SK::Polynomials_for_circle_3 result_type_for_circle;
|
||||
//using LinearFunctors::Get_equation<SK>::operator();
|
||||
|
||||
|
||||
result_type_for_sphere
|
||||
operator() ( const typename SK::Sphere_3 & s )
|
||||
{
|
||||
return get_equation<SK>(s);
|
||||
}
|
||||
|
||||
result_type_for_plane
|
||||
operator() ( const typename SK::Plane_3 & p )
|
||||
{
|
||||
return get_equation<SK>(p);
|
||||
}
|
||||
|
||||
result_type_for_line
|
||||
operator() ( const typename SK::Line_3 & l )
|
||||
{
|
||||
return get_equation<SK>(l);
|
||||
}
|
||||
|
||||
result_type_for_circle
|
||||
operator() ( const typename SK::Circle_3 & c )
|
||||
{
|
||||
return get_equation<SK>(c);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace SphericalFunctors
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SPHERICAL_KERNEL_GET_EQUATION_OBJECT_3_H
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (c) 2000-2004 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL 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.
|
||||
//
|
||||
// $Source: /CVSROOT/CGAL/Packages/Circular_kernel/include/CGAL/Circular_kernel/interface_macros.h,v $
|
||||
// $Revision$ $Date$
|
||||
// $Name: $
|
||||
//
|
||||
// Author(s) : Herve Bronnimann, Sylvain Pion, Susan Hert
|
||||
|
||||
// This file is intentionally not protected against re-inclusion.
|
||||
// It's aimed at being included from within a kernel traits class, this
|
||||
// way we share more code.
|
||||
|
||||
// It is the responsability of the including file to correctly set the 2
|
||||
// macros CGAL_Kernel_pred and CGAL_Kernel_cons.
|
||||
// And they are #undefed at the end of this file.
|
||||
|
||||
CGAL_Spherical_Kernel_cons(Get_equation, get_equation_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_circular_arc_point_3, construct_circular_arc_point_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_sphere_3, construct_sphere_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_plane_3, construct_plane_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_line_3, construct_line_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_line_arc_3, construct_line_arc_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_circle_3, construct_circle_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_diametral_sphere_3, construct_diametral_sphere_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_supporting_plane_3, construct_supporting_plane_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Compute_circular_x_3, compute_circular_x_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Compute_circular_y_3, compute_circular_y_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Compute_circular_z_3, compute_circular_z_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_circular_min_vertex_3, construct_circular_min_vertex_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_circular_max_vertex_3, construct_circular_max_vertex_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_circular_source_vertex_3, construct_circular_source_vertex_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_circular_target_vertex_3, construct_circular_target_vertex_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_supporting_line_3, construct_supporting_line_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Intersect_3, intersect_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Construct_bbox_3, construct_bbox_3_object)
|
||||
CGAL_Spherical_Kernel_cons(Split_3, split_3_object)
|
||||
|
||||
CGAL_Spherical_Kernel_pred(Compare_x_3, compare_x_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Compare_y_3, compare_y_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Compare_z_3, compare_z_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Compare_xy_3, compare_xy_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Compare_xyz_3, compare_xyz_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Equal_3, equal_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Has_on_3, has_on_3_object)
|
||||
CGAL_Spherical_Kernel_pred(Do_overlap_3, do_overlap_3_object)
|
||||
|
||||
#undef CGAL_Spherical_Kernel_pred
|
||||
#undef CGAL_Spherical_Kernel_cons
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_COMPARE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_COMPARE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
// we can optimize those functions by comparing
|
||||
// the references before doing the comparison
|
||||
// as in CK
|
||||
template < class SK >
|
||||
inline
|
||||
Comparison_result
|
||||
compare_x(const typename SK::Circular_arc_point_3 &p0,
|
||||
const typename SK::Circular_arc_point_3 &p1)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().compare_x_object()(p0.coordinates(), p1.coordinates());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
Comparison_result
|
||||
compare_y(const typename SK::Circular_arc_point_3 &p0,
|
||||
const typename SK::Circular_arc_point_3 &p1)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().compare_y_object()(p0.coordinates(), p1.coordinates());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
Comparison_result
|
||||
compare_z(const typename SK::Circular_arc_point_3 &p0,
|
||||
const typename SK::Circular_arc_point_3 &p1)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().compare_z_object()(p0.coordinates(), p1.coordinates());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
Comparison_result
|
||||
compare_xy(const typename SK::Circular_arc_point_3 &p0,
|
||||
const typename SK::Circular_arc_point_3 &p1)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().compare_xy_object()(p0.coordinates(), p1.coordinates());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
Comparison_result
|
||||
compare_xyz(const typename SK::Circular_arc_point_3 &p0,
|
||||
const typename SK::Circular_arc_point_3 &p1)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().compare_xyz_object()(p0.coordinates(), p1.coordinates());
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_COMPARE_3_H
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_HAS_ON_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_HAS_ON_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Sphere_3 &a,
|
||||
const typename SK::Point_3 &p)
|
||||
{
|
||||
return a.rep().has_on_boundary(p);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Sphere_3 &a,
|
||||
const typename SK::Circular_arc_point_3 &p)
|
||||
{
|
||||
typedef typename SK::AK AK;
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 Equation;
|
||||
Equation equation = get_equation<SK>(a);
|
||||
return (AK().sign_at_object()(equation,p.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);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Plane_3 &a,
|
||||
const typename SK::Circular_arc_point_3 &p)
|
||||
{
|
||||
typedef typename SK::AK AK;
|
||||
typedef typename SK::Polynomial_1_3 Equation;
|
||||
Equation equation = get_equation<SK>(a);
|
||||
return (AK().sign_at_object()(equation,p.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);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Line_3 &a,
|
||||
const typename SK::Circular_arc_point_3 &p)
|
||||
{
|
||||
typedef typename SK::AK AK;
|
||||
typedef typename SK::Polynomials_for_line_3 Equation;
|
||||
Equation equation = get_equation<SK>(a);
|
||||
return p.coordinates().is_on_line(equation);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Circle_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_3 &a,
|
||||
const typename SK::Circular_arc_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::Sphere_3 &a,
|
||||
const typename SK::Circle_3 &p)
|
||||
{
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::FT FT;
|
||||
Point_3 proj = p.supporting_plane().projection(a.center());
|
||||
if(!(proj == p.center())) return false;
|
||||
const FT d2 = CGAL::square(a.center().x() - p.center().x()) +
|
||||
CGAL::square(a.center().y() - p.center().y()) +
|
||||
CGAL::square(a.center().z() - p.center().z());
|
||||
return ((a.squared_radius() - d2) == p.squared_radius());
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Plane_3 &a,
|
||||
const typename SK::Line_3 &p)
|
||||
{
|
||||
return a.rep().has_on(p);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Plane_3 &a,
|
||||
const typename SK::Circle_3 &p)
|
||||
{
|
||||
return non_oriented_equal<SK>(a,p.supporting_plane());
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Line_arc_3 &l,
|
||||
const typename SK::Circular_arc_point_3 &p,
|
||||
const bool has_on_supporting_line = false)
|
||||
{
|
||||
if(!has_on_supporting_line) {
|
||||
if(!has_on<SK>(l.supporting_line(), p)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return SK().compare_xyz_3_object()(l.lower_xyz_extremity(),p) <= ZERO &&
|
||||
SK().compare_xyz_3_object()(p,l.higher_xyz_extremity()) <= ZERO;
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Line_arc_3 &l,
|
||||
const typename SK::Point_3 &p,
|
||||
const bool has_on_supporting_line = false)
|
||||
{
|
||||
if(!has_on_supporting_line) {
|
||||
if(!has_on<SK>(l.supporting_line(), p)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return SK().compare_xyz_3_object()(l.lower_xyz_extremity(),p) <= ZERO &&
|
||||
SK().compare_xyz_3_object()(p,l.higher_xyz_extremity()) <= ZERO;
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Plane_3 &p,
|
||||
const typename SK::Line_arc_3 &l)
|
||||
{
|
||||
return SK().has_on_3_object()(p, l.supporting_line());
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
has_on(const typename SK::Line_3 &l,
|
||||
const typename SK::Line_arc_3 &la)
|
||||
{
|
||||
return non_oriented_equal<SK>(l, la.supporting_line());
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_HAS_ON_3_H
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_ON_CIRCLE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_ON_CIRCLE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template < class SK >
|
||||
typename SK::Circle_3
|
||||
construct_circle_3(const typename SK::Polynomials_for_circle_3 &eq)
|
||||
{
|
||||
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::FT FT;
|
||||
Sphere_3 s = construct_sphere_3<SK>(eq.first);
|
||||
Plane_3 p = construct_plane_3<SK>(eq.second);
|
||||
const FT d2 = CGAL::square(p.a()*s.center().x() +
|
||||
p.b()*s.center().y() +
|
||||
p.c()*s.center().z() + p.d()) /
|
||||
(CGAL::square(p.a()) + CGAL::square(p.b()) + CGAL::square(p.c()));
|
||||
// We do not accept circles with radius 0 (should we?)
|
||||
CGAL_kernel_precondition(d2 < s.squared_radius());
|
||||
// d2 < s.squared_radius()
|
||||
Point_3 center = p.projection(s.center());
|
||||
return Circle_3(center,s.squared_radius() - d2,p);
|
||||
}
|
||||
|
||||
template< class SK>
|
||||
bool
|
||||
equal( const typename SK::Circle_3 &p1,
|
||||
const typename SK::Circle_3 &p2)
|
||||
{
|
||||
return p1.rep() == p2.rep();
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
x_extremal_point(const typename SK::Circle_3 & c, bool i)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().x_critical_points_object()(typename SK::Get_equation()(c),i);
|
||||
}
|
||||
|
||||
template <class SK,class OutputIterator>
|
||||
OutputIterator
|
||||
x_extremal_points(const typename SK::Circle_3 & c, OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().x_critical_points_object()(typename SK::Get_equation()(c),res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
y_extremal_point(const typename SK::Circle_3 & c, bool i)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().y_critical_points_object()(typename SK::Get_equation()(c),i);
|
||||
}
|
||||
|
||||
template <class SK,class OutputIterator>
|
||||
OutputIterator
|
||||
y_extremal_points(const typename SK::Circle_3 & c, OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().y_critical_points_object()(typename SK::Get_equation()(c),res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
z_extremal_point(const typename SK::Circle_3 & c, bool i)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().z_critical_points_object()(typename SK::Get_equation()(c),i);
|
||||
}
|
||||
|
||||
template <class SK,class OutputIterator>
|
||||
OutputIterator
|
||||
z_extremal_points(const typename SK::Circle_3 & c, OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().z_critical_points_object()(typename SK::Get_equation()(c),res);
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_ON_CIRCLE_3_H
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_ON_CIRCULAR_ARC_POINT_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_ON_CIRCULAR_ARC_POINT_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template< class SK>
|
||||
bool
|
||||
equal( const typename SK::Circular_arc_point_3 &p1,
|
||||
const typename SK::Circular_arc_point_3 &p2)
|
||||
{
|
||||
return p1.rep() == p2.rep();
|
||||
}
|
||||
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_ON_CIRCULAR_ARC_POINT_3_H
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_ON_LINE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_ON_LINE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template < class SK >
|
||||
typename SK::Line_3
|
||||
construct_line_3(const typename SK::Polynomials_for_line_3 &eq)
|
||||
{
|
||||
typedef typename SK::Line_3 Line_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Vector_3 Vector_3;
|
||||
return Line_3(Point_3(eq.b1(),eq.b2(),eq.b3()),
|
||||
Vector_3(eq.a1(),eq.a2(),eq.a3()));
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_ON_LINE_3_H
|
||||
|
|
@ -0,0 +1,286 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_ON_LINE_ARC_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_ON_LINE_ARC_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template< class SK>
|
||||
bool
|
||||
equal( const typename SK::Line_arc_3 &l1,
|
||||
const typename SK::Line_arc_3 &l2)
|
||||
{
|
||||
return l1.rep() == l2.rep();
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
inline
|
||||
bool
|
||||
do_overlap(const typename SK::Line_arc_3 &l1,
|
||||
const typename SK::Line_arc_3 &l2)
|
||||
{
|
||||
if (!non_oriented_equal<SK>(l1.supporting_line(),
|
||||
l2.supporting_line()))
|
||||
return false;
|
||||
|
||||
return SK().compare_xyz_3_object()(l1.higher_xyz_extremity(),
|
||||
l2.lower_xyz_extremity()) >= 0
|
||||
&& SK().compare_xyz_3_object()(l1.lower_xyz_extremity(),
|
||||
l2.higher_xyz_extremity()) <= 0;
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
void
|
||||
split(const typename SK::Line_arc_3 &l,
|
||||
const typename SK::Circular_arc_point_3 &p,
|
||||
typename SK::Line_arc_3 &l1,
|
||||
typename SK::Line_arc_3 &l2)
|
||||
{
|
||||
typedef typename SK::Line_arc_3 Line_arc_3;
|
||||
CGAL_kernel_precondition(SK().has_on_3_object()(l, p));
|
||||
// It doesn't make sense to split an arc on an extremity
|
||||
CGAL_kernel_precondition(l.source() != p);
|
||||
CGAL_kernel_precondition(l.target() != p);
|
||||
if(SK().compare_xyz_3_object()(l.source(),p) == SMALLER) {
|
||||
l1 = Line_arc_3(l.supporting_line(),l.source(),p);
|
||||
l2 = Line_arc_3(l.supporting_line(),p,l.target());
|
||||
} else {
|
||||
l1 = Line_arc_3(l.supporting_line(),p,l.target());
|
||||
l2 = Line_arc_3(l.supporting_line(),l.source(),p);
|
||||
}
|
||||
}
|
||||
|
||||
// It is the vectorial product of 2 3D vectors
|
||||
// Maybe there is already this function somewhere,
|
||||
// but i didn't find
|
||||
template < class SK >
|
||||
typename SK::Vector_3
|
||||
vp(const typename SK::Vector_3 & v1,
|
||||
const typename SK::Vector_3 & v2) {
|
||||
return typename SK::Vector_3((v1.y()*v2.z()-v1.z()*v2.y()),
|
||||
(v1.z()*v2.x()-v1.x()*v2.z()),
|
||||
(v1.x()*v2.y()-v1.y()*v2.x()));
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
typename SK::Object_3
|
||||
intersect_3(const typename SK::Line_3 & l1,
|
||||
const typename SK::Line_3 & l2,
|
||||
const bool not_equal_lines = false)
|
||||
{
|
||||
typedef typename SK::Vector_3 Vector_3;
|
||||
typedef typename SK::Line_3 Line_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Object_3 Object_3;
|
||||
typedef typename SK::FT FT;
|
||||
if(!not_equal_lines) {
|
||||
if(non_oriented_equal<SK>(l1,l2))
|
||||
return make_object(l1);
|
||||
}
|
||||
if(SK().are_parallel_3_object()(l1,l2)) return Object();
|
||||
const Point_3 &p1 = l1.point();
|
||||
const Point_3 &p3 = l2.point();
|
||||
const Vector_3 &v1 = l1.to_vector();
|
||||
const Vector_3 &v2 = l2.to_vector();
|
||||
const Point_3 p2 = p1 + v1;
|
||||
const Point_3 p4 = p2 + v2;
|
||||
if(!SK().coplanar_3_object()(p1,p2,p3,p4)) return Object();
|
||||
const Vector_3 v3 = p3 - p1;
|
||||
const Vector_3 v3v2 = vp<SK>(v3,v2);
|
||||
const Vector_3 v1v2 = vp<SK>(v1,v2);
|
||||
const FT t = ((v3v2.x()*v1v2.x()) + (v3v2.y()*v1v2.y()) + (v3v2.z()*v1v2.z())) /
|
||||
(v1v2.squared_length());
|
||||
return make_object(p1 + (v1 * t));
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Line_arc_3 & l1,
|
||||
const typename SK::Line_arc_3 & l2,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Line_3 Line_3;
|
||||
typedef typename SK::Line_arc_3 Line_arc_3;
|
||||
|
||||
if(non_oriented_equal<SK>(l1.supporting_line(),
|
||||
l2.supporting_line())) {
|
||||
|
||||
if(SK().compare_xyz_3_object()(l1.lower_xyz_extremity(),
|
||||
l2.lower_xyz_extremity()) < 0) {
|
||||
int comparison =
|
||||
SK().compare_xyz_3_object()(l2.lower_xyz_extremity(),
|
||||
l1.higher_xyz_extremity());
|
||||
if(comparison < 0) {
|
||||
if(SK().compare_xyz_3_object()(l1.higher_xyz_extremity(),
|
||||
l2.higher_xyz_extremity()) <= 0) {
|
||||
*res++ = make_object
|
||||
(Line_arc_3(l1.supporting_line(),
|
||||
l2.lower_xyz_extremity(),
|
||||
l1.higher_xyz_extremity()));
|
||||
} else {
|
||||
*res++ = make_object(l2);
|
||||
}
|
||||
} else if (comparison == 0) {
|
||||
*res++ = make_object(std::make_pair(l2.lower_xyz_extremity(),1u));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
int comparison =
|
||||
SK().compare_xyz_3_object()(l1.lower_xyz_extremity(),
|
||||
l2.higher_xyz_extremity());
|
||||
if(comparison < 0){
|
||||
if(SK().compare_xyz_3_object()(l1.higher_xyz_extremity(),
|
||||
l2.higher_xyz_extremity()) <= 0) {
|
||||
*res++ = make_object(l1);
|
||||
} else {
|
||||
*res++ = make_object
|
||||
(Line_arc_3(l1.supporting_line(),
|
||||
l1.lower_xyz_extremity(),
|
||||
l2.higher_xyz_extremity() ));
|
||||
}
|
||||
}
|
||||
else if (comparison == 0){
|
||||
*res++ = make_object(std::make_pair(l1.lower_xyz_extremity(),1u));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Point_3 inters_p;
|
||||
if(assign(inters_p,intersect_3<SK>(l1.supporting_line(),
|
||||
l2.supporting_line(), true))) {
|
||||
Circular_arc_point_3 p = inters_p;
|
||||
if(!SK().has_on_3_object()(l1,p,true)) return res;
|
||||
if(!SK().has_on_3_object()(l2,p,true)) return res;
|
||||
*res++ = make_object(std::make_pair(p,1u));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Line_3 & l,
|
||||
const typename SK::Line_arc_3 & la,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Line_3 Line_3;
|
||||
typedef typename SK::Line_arc_3 Line_arc_3;
|
||||
|
||||
if(non_oriented_equal<SK>(l, la.supporting_line())) {
|
||||
*res++ = make_object(la);
|
||||
}
|
||||
|
||||
Point_3 inters_p;
|
||||
if(assign(inters_p,intersect_3<SK>(l, la.supporting_line(), true))) {
|
||||
Circular_arc_point_3 p = inters_p;
|
||||
if(!SK().has_on_3_object()(la,p,true)) return res;
|
||||
*res++ = make_object(std::make_pair(p,1u));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Circle_3 & c,
|
||||
const typename SK::Line_arc_3 & l,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef std::vector<CGAL::Object> solutions_container;
|
||||
typedef std::pair<Circular_arc_point_3, unsigned> Solution;
|
||||
solutions_container solutions;
|
||||
SK().intersect_3_object()(l.supporting_line(), c,
|
||||
std::back_inserter(solutions) );
|
||||
if(solutions.size() == 0) return res;
|
||||
if(solutions.size() == 1) {
|
||||
Solution sol;
|
||||
assign(sol, solutions[0]);
|
||||
if(SK().has_on_3_object()(l,sol.first,true))
|
||||
*res++ = solutions[0];
|
||||
} else {
|
||||
Solution sol1, sol2;
|
||||
assign(sol1, solutions[0]);
|
||||
assign(sol2, solutions[1]);
|
||||
if(SK().has_on_3_object()(l,sol1.first,true))
|
||||
*res++ = solutions[0];
|
||||
if(SK().has_on_3_object()(l,sol2.first,true))
|
||||
*res++ = solutions[1];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Sphere_3 & s,
|
||||
const typename SK::Line_arc_3 & l,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef std::vector<CGAL::Object> solutions_container;
|
||||
typedef std::pair<Circular_arc_point_3, unsigned> Solution;
|
||||
solutions_container solutions;
|
||||
SK().intersect_3_object()(l.supporting_line(), s,
|
||||
std::back_inserter(solutions) );
|
||||
if(solutions.size() == 0) return res;
|
||||
if(solutions.size() == 1) {
|
||||
Solution sol;
|
||||
assign(sol, solutions[0]);
|
||||
if(SK().has_on_3_object()(l,sol.first,true))
|
||||
*res++ = solutions[0];
|
||||
} else {
|
||||
Solution sol1, sol2;
|
||||
assign(sol1, solutions[0]);
|
||||
assign(sol2, solutions[1]);
|
||||
if(SK().has_on_3_object()(l,sol1.first,true))
|
||||
*res++ = solutions[0];
|
||||
if(SK().has_on_3_object()(l,sol2.first,true))
|
||||
*res++ = solutions[1];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Plane_3 & p,
|
||||
const typename SK::Line_arc_3 & l,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
if(SK().has_on_3_object()(p,l.supporting_line())) {
|
||||
*res++ = make_object(l);
|
||||
}
|
||||
Point_3 sol;
|
||||
if(!assign(sol,SK().intersect_3_object()(p,l.supporting_line())))
|
||||
return res;
|
||||
if(!SK().has_on_3_object()(l,sol)) return res;
|
||||
Circular_arc_point_3 point = sol;
|
||||
*res++ = make_object(std::make_pair(point,1u));
|
||||
return res;
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_ON_LINE_ARC_3_H
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_ON_PLANE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_ON_PLANE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template < class SK >
|
||||
typename SK::Plane_3
|
||||
construct_plane_3(const typename SK::Polynomial_1_3 &eq)
|
||||
{
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
return Plane_3(eq.a(),eq.b(),eq.c(),eq.d());
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_ON_PLANE_3_H
|
||||
|
|
@ -0,0 +1,535 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_PREDICATES_ON_SPHERE_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_PREDICATES_ON_SPHERE_3_H
|
||||
|
||||
namespace CGAL {
|
||||
namespace SphericalFunctors {
|
||||
|
||||
template < class SK >
|
||||
typename SK::Algebraic_kernel::Polynomials_for_line_3
|
||||
get_equation( const typename SK::Line_3 & l)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().construct_polynomials_for_line_3_object()
|
||||
(l.to_vector().x(), l.point().x(),
|
||||
l.to_vector().y(), l.point().y(),
|
||||
l.to_vector().z(), l.point().z());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
typename SK::Polynomial_1_3
|
||||
get_equation( const typename SK::Plane_3 & s )
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().construct_polynomial_1_3_object()
|
||||
( s.a(), s.b(), s.c(), s.d() );
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
typename SK::Polynomial_for_spheres_2_3
|
||||
get_equation( const typename SK::Sphere_3 & s )
|
||||
{
|
||||
typedef typename SK::RT RT;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
Point_3 center = s.center();
|
||||
return AK().construct_polynomial_for_spheres_2_3_object()
|
||||
( center.x(), center.y(), center.z(), s.squared_radius() );
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
typename SK::Polynomials_for_circle_3
|
||||
get_equation( const typename SK::Circle_3 & c )
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return std::make_pair ( AK().construct_polynomial_for_spheres_2_3_object()
|
||||
(c.center().x(), c.center().y(),
|
||||
c.center().z(), c.squared_radius()),
|
||||
AK().construct_polynomial_1_3_object()
|
||||
(c.supporting_plane().a(),
|
||||
c.supporting_plane().b(),
|
||||
c.supporting_plane().c(),
|
||||
c.supporting_plane().d()));
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
typename SK::Sphere_3
|
||||
construct_sphere_3(const typename SK::Polynomial_for_spheres_2_3 &eq)
|
||||
{
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
return Sphere_3(Point_3(eq.a(),eq.b(),eq.c()),eq.r_sq());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
bool
|
||||
non_oriented_equal(const typename SK::Sphere_3 & s1,
|
||||
const typename SK::Sphere_3 & s2) {
|
||||
// Should we compare anyway even if they are degenerated?
|
||||
CGAL_kernel_assertion(!(s1.is_degenerate() || s2.is_degenerate()));
|
||||
return s1.center() == s2.center() &&
|
||||
s1.squared_radius() == s2.squared_radius();
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
bool
|
||||
non_oriented_equal(const typename SK::Plane_3 & p1,
|
||||
const typename SK::Plane_3 & p2) {
|
||||
// Should we compare anyway even if they are degenerated?
|
||||
CGAL_kernel_assertion(!(p1.is_degenerate() || p2.is_degenerate()));
|
||||
if(is_zero(p1.a())) {
|
||||
if(!is_zero(p2.a())) return false;
|
||||
if(is_zero(p1.b())) {
|
||||
if(!is_zero(p2.b())) return false;
|
||||
return p1.c() * p2.d() == p1.d() * p2.c();
|
||||
}
|
||||
return (p2.c() * p1.b() == p1.c() * p2.b()) &&
|
||||
(p2.d() * p1.b() == p1.d() * p2.b());
|
||||
}
|
||||
return (p2.b() * p1.a() == p1.b() * p2.a()) &&
|
||||
(p2.c() * p1.a() == p1.c() * p2.a()) &&
|
||||
(p2.d() * p1.a() == p1.d() * p2.a());
|
||||
}
|
||||
|
||||
template < class SK >
|
||||
inline
|
||||
bool
|
||||
non_oriented_equal(const typename SK::Circle_3 & c1,
|
||||
const typename SK::Circle_3 & c2) {
|
||||
// We see degeneracies on the other non_oriented_equal functions
|
||||
if(!non_oriented_equal<SK>(c1.diametral_sphere(),
|
||||
c2.diametral_sphere())) return false;
|
||||
if(!non_oriented_equal<SK>(c1.supporting_plane(),
|
||||
c2.supporting_plane())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
template< class SK>
|
||||
bool
|
||||
non_oriented_equal( const typename SK::Line_3 &l1,
|
||||
const typename SK::Line_3 &l2)
|
||||
{
|
||||
typedef typename SK::Vector_3 Vector_3;
|
||||
if(!SK().has_on_3_object()(l1, l2.point())) return false;
|
||||
|
||||
const Vector_3& v1 = l1.to_vector();
|
||||
const Vector_3& v2 = l2.to_vector();
|
||||
|
||||
if(v1.x() * v2.y() != v1.y() * v2.x()) return false;
|
||||
if(v1.x() * v2.z() != v1.z() * v2.x()) return false;
|
||||
if(v1.y() * v2.z() != v1.z() * v2.y()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template< class SK>
|
||||
bool
|
||||
non_oriented_equal( const typename SK::Line_arc_3 &l1,
|
||||
const typename SK::Line_arc_3 &l2)
|
||||
{
|
||||
if(!non_oriented_equal<SK>(l1.supporting_line(),
|
||||
l2.supporting_line())) return false;
|
||||
return (l1.lower_xyz_extremity() == l2.lower_xyz_extremity()) &&
|
||||
(l1.higher_xyz_extremity() == l2.higher_xyz_extremity());
|
||||
}
|
||||
|
||||
template < class SK>
|
||||
inline
|
||||
typename SK::Plane_3
|
||||
radical_plane(const typename SK::Sphere_3 & s1,
|
||||
const typename SK::Sphere_3 & s2)
|
||||
{
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::FT FT;
|
||||
const FT a = 2*(s2.center().x() - s1.center().x());
|
||||
const FT b = 2*(s2.center().y() - s1.center().y());
|
||||
const FT c = 2*(s2.center().z() - s1.center().z());
|
||||
const FT d = CGAL::square(s1.center().x()) +
|
||||
CGAL::square(s1.center().y()) +
|
||||
CGAL::square(s1.center().z()) - s1.squared_radius() -
|
||||
CGAL::square(s2.center().x()) -
|
||||
CGAL::square(s2.center().y()) -
|
||||
CGAL::square(s2.center().z()) + s2.squared_radius();
|
||||
return Plane_3(a, b, c, d);
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Plane_3 & p,
|
||||
const typename SK::Sphere_3 & s,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::AK AK;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 Polynomial_for_spheres_2_3;
|
||||
typedef typename SK::Polynomial_1_3 Polynomial_1_3;
|
||||
typedef typename SK::Circle_3 Circle_3;
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
typedef typename SK::FT FT;
|
||||
|
||||
const FT d2 = CGAL::square(p.a()*s.center().x() +
|
||||
p.b()*s.center().y() +
|
||||
p.c()*s.center().z() + p.d()) /
|
||||
(CGAL::square(p.a()) + CGAL::square(p.b()) + CGAL::square(p.c()));
|
||||
|
||||
// do not intersect
|
||||
if(d2 > s.squared_radius()) return res;
|
||||
// tangent
|
||||
if(d2 == s.squared_radius()) {
|
||||
Polynomial_for_spheres_2_3 e1 = get_equation<SK>(s);
|
||||
Polynomial_1_3 e2 = get_equation<SK>(p);
|
||||
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >
|
||||
solutions_container;
|
||||
solutions_container solutions;
|
||||
AK().solve_object()(e1, e1, e2, std::back_inserter(solutions));
|
||||
// only 1 solution
|
||||
typename solutions_container::iterator it = solutions.begin();
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
return res;
|
||||
}
|
||||
// d2 < s.squared_radius()
|
||||
Point_3 center = p.projection(s.center());
|
||||
*res++ = make_object(Circle_3(center,s.squared_radius() - d2,p));
|
||||
return res;
|
||||
}
|
||||
|
||||
namespace CGALi {
|
||||
template < class SK >
|
||||
inline
|
||||
bool
|
||||
do_intersect(const typename SK::Sphere_3 & s1,
|
||||
const typename SK::Sphere_3 & s2)
|
||||
{
|
||||
typedef typename SK::Root_of_2 Root_of_2;
|
||||
typedef typename SK::FT FT;
|
||||
const FT dx = s2.center().x() - s1.center().x();
|
||||
const FT dy = s2.center().y() - s1.center().y();
|
||||
const FT dz = s2.center().z() - s1.center().z();
|
||||
const FT d2 = CGAL::square(dx) +
|
||||
CGAL::square(dy) +
|
||||
CGAL::square(dz);
|
||||
const FT sq_r1r2 = s1.squared_radius()*s2.squared_radius();
|
||||
const FT sq_r1_p_sq_r2 = s1.squared_radius() + s2.squared_radius();
|
||||
Root_of_2 left_1 = make_root_of_2(d2,-2,sq_r1r2);
|
||||
if(left_1 > sq_r1_p_sq_r2) return false;
|
||||
Root_of_2 left_2 = make_root_of_2(d2,2,sq_r1r2);
|
||||
if(left_2 < sq_r1_p_sq_r2) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Sphere_3 & s1,
|
||||
const typename SK::Sphere_3 & s2,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
if(non_oriented_equal<SK>(s1,s2)) {
|
||||
*res++ = make_object(s1);
|
||||
return res;
|
||||
}
|
||||
if(!CGALi::do_intersect<SK>(s1,s2)) return res;
|
||||
Plane_3 p = radical_plane<SK>(s1,s2);
|
||||
return intersect_3<SK>(p,s1,res);
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Sphere_3 & s,
|
||||
const typename SK::Line_3 & l,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::AK AK;
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere;
|
||||
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;
|
||||
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 > >
|
||||
solutions_container;
|
||||
solutions_container solutions;
|
||||
AK().solve_object()(e1, e2, std::back_inserter(solutions));
|
||||
for ( typename solutions_container::iterator it = solutions.begin();
|
||||
it != solutions.end(); ++it ) {
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Sphere_3 & s1,
|
||||
const typename SK::Sphere_3 & s2,
|
||||
const typename SK::Sphere_3 & s3,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere;
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Circle_3 Circle_3;
|
||||
typedef typename SK::AK AK;
|
||||
typedef std::vector< Object > solutions_container;
|
||||
if(non_oriented_equal<SK>(s1,s2) && non_oriented_equal<SK>(s2,s3)) {
|
||||
*res++ = make_object(s1);
|
||||
return res;
|
||||
}
|
||||
if(non_oriented_equal<SK>(s1,s2)) {
|
||||
return intersect_3<SK>(s1,s3,res);
|
||||
}
|
||||
if((non_oriented_equal<SK>(s1,s3)) ||
|
||||
(non_oriented_equal<SK>(s2,s3))) {
|
||||
return intersect_3<SK>(s1,s2,res);
|
||||
}
|
||||
if(SK().collinear_3_object()(s1.center(),s2.center(),s3.center())) {
|
||||
solutions_container solutions;
|
||||
intersect_3<SK>(s1, s2, std::back_inserter(solutions));
|
||||
if(solutions.size() == 0) return res;
|
||||
std::pair<Circular_arc_point_3, unsigned> pair;
|
||||
if(assign(pair,solutions[0])) {
|
||||
if(SK().has_on_3_object()(s3,pair.first)) {
|
||||
*res++ = solutions[0];
|
||||
return res;
|
||||
} else return res;
|
||||
}
|
||||
// must be a circle
|
||||
Circle_3 c;
|
||||
assign(c,solutions[0]);
|
||||
if(SK().has_on_3_object()(s3,c)) {
|
||||
*res++ = solutions[0];
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Equation_sphere e1 = get_equation<SK>(s1);
|
||||
Equation_sphere e2 = get_equation<SK>(s2);
|
||||
Equation_sphere e3 = get_equation<SK>(s3);
|
||||
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >
|
||||
algebraic_solutions_container;
|
||||
algebraic_solutions_container solutions;
|
||||
AK().solve_object()(e1, e2, e3, std::back_inserter(solutions));
|
||||
for ( typename algebraic_solutions_container::iterator it =
|
||||
solutions.begin(); it != solutions.end(); ++it ) {
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Plane_3 & p,
|
||||
const typename SK::Sphere_3 & s1,
|
||||
const typename SK::Sphere_3 & s2,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere;
|
||||
typedef typename SK::Polynomial_1_3 Equation_plane;
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::AK AK;
|
||||
if(non_oriented_equal<SK>(s1,s2)) {
|
||||
return intersect_3<SK>(p,s1,res);
|
||||
}
|
||||
Plane_3 radical_p = radical_plane<SK>(s1,s2);
|
||||
if(non_oriented_equal<SK>(p,radical_p)) {
|
||||
return intersect_3<SK>(p,s1,res);
|
||||
}
|
||||
Equation_sphere e1 = get_equation<SK>(s1);
|
||||
Equation_sphere e2 = get_equation<SK>(s2);
|
||||
Equation_plane e3 = get_equation<SK>(p);
|
||||
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >
|
||||
algebraic_solutions_container;
|
||||
algebraic_solutions_container solutions;
|
||||
AK().solve_object()(e1, e2, e3, std::back_inserter(solutions));
|
||||
for ( typename algebraic_solutions_container::iterator it =
|
||||
solutions.begin(); it != solutions.end(); ++it ) {
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Plane_3 & p1,
|
||||
const typename SK::Plane_3 & p2,
|
||||
const typename SK::Sphere_3 & s,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Polynomial_for_spheres_2_3 Equation_sphere;
|
||||
typedef typename SK::Polynomial_1_3 Equation_plane;
|
||||
typedef typename SK::AK AK;
|
||||
if(non_oriented_equal<SK>(p1,p2)) {
|
||||
return intersect_3<SK>(p1,s,res);
|
||||
}
|
||||
Equation_plane e1 = get_equation<SK>(p1);
|
||||
Equation_plane e2 = get_equation<SK>(p2);
|
||||
Equation_sphere e3 = get_equation<SK>(s);
|
||||
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >
|
||||
algebraic_solutions_container;
|
||||
algebraic_solutions_container solutions;
|
||||
AK().solve_object()(e1, e2, e3, std::back_inserter(solutions));
|
||||
for ( typename algebraic_solutions_container::iterator it =
|
||||
solutions.begin(); it != solutions.end(); ++it ) {
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Circle_3 & c,
|
||||
const typename SK::Plane_3 & p,
|
||||
OutputIterator res)
|
||||
{
|
||||
return intersect_3<SK>(p,c.supporting_plane(),c.diametral_sphere(),res);
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Circle_3 & c,
|
||||
const typename SK::Sphere_3 & s,
|
||||
OutputIterator res)
|
||||
{
|
||||
return intersect_3<SK>(c.supporting_plane(),s,c.diametral_sphere(),res);
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Circle_3 & c1,
|
||||
const typename SK::Circle_3 & c2,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Polynomials_for_circle_3 Equation_circle;
|
||||
typedef typename SK::Circle_3 Circle_3;
|
||||
typedef typename SK::AK AK;
|
||||
if(non_oriented_equal<SK>(c1,c2)) {
|
||||
*res++ = make_object(c1);
|
||||
return res;
|
||||
}
|
||||
Equation_circle e1 = get_equation<SK>(c1);
|
||||
Equation_circle e2 = get_equation<SK>(c2);
|
||||
typedef std::vector< std::pair < Root_for_spheres_2_3, unsigned > >
|
||||
algebraic_solutions_container;
|
||||
algebraic_solutions_container solutions;
|
||||
AK().solve_object()(e1, e2, std::back_inserter(solutions));
|
||||
for ( typename algebraic_solutions_container::iterator it =
|
||||
solutions.begin(); it != solutions.end(); ++it ) {
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
template < class SK, class OutputIterator >
|
||||
OutputIterator
|
||||
intersect_3(const typename SK::Circle_3 & c,
|
||||
const typename SK::Line_3 & l,
|
||||
OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Root_for_spheres_2_3 Root_for_spheres_2_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Polynomials_for_circle_3 Equation_circle;
|
||||
typedef typename SK::Polynomials_for_line_3 Equation_line;
|
||||
typedef typename SK::Circle_3 Circle_3;
|
||||
typedef typename SK::AK AK;
|
||||
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 > >
|
||||
algebraic_solutions_container;
|
||||
algebraic_solutions_container solutions;
|
||||
AK().solve_object()(e1, e2, std::back_inserter(solutions));
|
||||
for ( typename algebraic_solutions_container::iterator it =
|
||||
solutions.begin(); it != solutions.end(); ++it ) {
|
||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(it->first),
|
||||
it->second ));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// At the moment we dont need those functions
|
||||
// But in the future maybe (some make_x_monotone? etc..)
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
x_extremal_point(const typename SK::Sphere_3 & c, bool i)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().x_critical_points_object()(typename SK::Get_equation()(c),i);
|
||||
}
|
||||
|
||||
template <class SK,class OutputIterator>
|
||||
OutputIterator
|
||||
x_extremal_points(const typename SK::Sphere_3 & c, OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().x_critical_points_object()(typename SK::Get_equation()(c),res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
y_extremal_point(const typename SK::Sphere_3 & c, bool i)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().y_critical_points_object()(typename SK::Get_equation()(c),i);
|
||||
}
|
||||
|
||||
template <class SK,class OutputIterator>
|
||||
OutputIterator
|
||||
y_extremal_points(const typename SK::Sphere_3 & c, OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().y_critical_points_object()(typename SK::Get_equation()(c),res);
|
||||
}
|
||||
|
||||
template <class SK>
|
||||
typename SK::Circular_arc_point_3
|
||||
z_extremal_point(const typename SK::Sphere_3 & c, bool i)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().z_critical_points_object()(typename SK::Get_equation()(c),i);
|
||||
}
|
||||
|
||||
template <class SK,class OutputIterator>
|
||||
OutputIterator
|
||||
z_extremal_points(const typename SK::Sphere_3 & c, OutputIterator res)
|
||||
{
|
||||
typedef typename SK::Algebraic_kernel AK;
|
||||
return AK().z_critical_points_object()(typename SK::Get_equation()(c),res);
|
||||
}
|
||||
|
||||
}//SphericalFunctors
|
||||
}//CGAL
|
||||
|
||||
|
||||
|
||||
#endif //CGAL_SPHERICAL_KERNEL_PREDICATES_ON_SPHERE_3_H
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_LINE_ARC_3_H
|
||||
#define CGAL_LINE_ARC_3_H
|
||||
|
||||
namespace CGAL {
|
||||
template <class SK>
|
||||
class Line_arc_3
|
||||
: public SK::Kernel_base::Line_arc_3
|
||||
{
|
||||
|
||||
typedef typename SK::RT RT;
|
||||
typedef typename SK::FT FT;
|
||||
typedef typename SK::Line_3 Line_3;
|
||||
typedef typename SK::Point_3 Point_3;
|
||||
typedef typename SK::Plane_3 Plane_3;
|
||||
typedef typename SK::Sphere_3 Sphere_3;
|
||||
typedef typename SK::Segment_3 Segment_3;
|
||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
||||
typedef typename SK::Kernel_base::Line_arc_3 RLine_arc_3;
|
||||
|
||||
|
||||
public:
|
||||
typedef RLine_arc_3 Rep;
|
||||
typedef SK R;
|
||||
|
||||
const Rep& rep() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rep& rep()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Line_arc_3()
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()())
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3& l,
|
||||
const Circular_arc_point_3& s,
|
||||
const Circular_arc_point_3& t)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,s,t))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3& l,
|
||||
const Point_3& s,
|
||||
const Circular_arc_point_3& t)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,s,t))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3& l,
|
||||
const Circular_arc_point_3& s,
|
||||
const Point_3& t)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,s,t))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3& l,
|
||||
const Point_3& s,
|
||||
const Point_3& t)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,s,t))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Segment_3 &s)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(s))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Sphere_3 &s,
|
||||
bool less_xyz_first = true)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,s,less_xyz_first))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Sphere_3 &s,
|
||||
const Line_3 &l,
|
||||
bool less_xyz_first = true)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(s,l,less_xyz_first))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Sphere_3 &s1, bool less_xyz_s1,
|
||||
const Sphere_3 &s2, bool less_xyz_s2)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,s1,less_xyz_s1,
|
||||
s2,less_xyz_s2))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Sphere_3 &s1, bool less_xyz_s1,
|
||||
const Sphere_3 &s2, bool less_xyz_s2,
|
||||
const Line_3 &l)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(s1,less_xyz_s1,
|
||||
s2,less_xyz_s2,l))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Line_3 &l,
|
||||
const Plane_3 &p1,
|
||||
const Plane_3 &p2)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(l,p1,p2))
|
||||
{}
|
||||
|
||||
Line_arc_3(const Plane_3 &p1,
|
||||
const Plane_3 &p2,
|
||||
const Line_3 &l)
|
||||
: RLine_arc_3(typename R::Construct_line_arc_3()(p1,p2,l))
|
||||
{}
|
||||
|
||||
Line_arc_3(const RLine_arc_3 &a)
|
||||
: RLine_arc_3(a)
|
||||
{}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_circular_source_vertex_3,Line_arc_3>::type
|
||||
source() const
|
||||
{
|
||||
return typename R::Construct_circular_source_vertex_3()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_circular_target_vertex_3,Line_arc_3>::type
|
||||
target() const
|
||||
{
|
||||
return typename R::Construct_circular_target_vertex_3()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_circular_min_vertex_3,Line_arc_3>::type
|
||||
lower_xyz_extremity() const
|
||||
{
|
||||
return typename R::Construct_circular_min_vertex_3()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_circular_max_vertex_3,Line_arc_3>::type
|
||||
higher_xyz_extremity() const
|
||||
{
|
||||
return typename R::Construct_circular_max_vertex_3()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of
|
||||
<typename R::Construct_supporting_line_3,Line_arc_3>::type
|
||||
supporting_line() const
|
||||
{
|
||||
return typename R::Construct_supporting_line_3()(*this);
|
||||
}
|
||||
|
||||
Bbox_3 bbox() const
|
||||
{ return typename R::Construct_bbox_3()(*this); }
|
||||
|
||||
};
|
||||
|
||||
template < typename SK >
|
||||
inline
|
||||
bool
|
||||
operator==(const Line_arc_3<SK> &p,
|
||||
const Line_arc_3<SK> &q)
|
||||
{
|
||||
return SK().equal_3_object()(p, q);
|
||||
}
|
||||
|
||||
template < typename SK >
|
||||
inline
|
||||
bool
|
||||
operator!=(const Line_arc_3<SK> &p,
|
||||
const Line_arc_3<SK> &q)
|
||||
{
|
||||
return ! (p == q);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_3_H
|
||||
|
||||
#include <CGAL/Circular_kernel_3/Circular_arc_point_3.h>
|
||||
#include <CGAL/Circular_arc_point_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/function_objects_polynomial_sphere.h>
|
||||
|
||||
#include <CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h>
|
||||
|
||||
#include <CGAL/Spherical_kernel_type_equality_wrapper.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGALi {
|
||||
|
||||
template < class SphericalKernel, class LinearKernelBase >
|
||||
struct Spherical_kernel_base_no_ref_count: public LinearKernelBase
|
||||
// takes classes in internal sub-namespace
|
||||
{
|
||||
typedef CGALi::Circular_arc_point_3<SphericalKernel> Circular_arc_point_3;
|
||||
typedef CGALi::Circle_3<SphericalKernel> Circle_3;
|
||||
typedef CGALi::Line_arc_3<SphericalKernel> Line_arc_3;
|
||||
|
||||
// The mecanism that allows to specify reference-counting or not.
|
||||
template < typename T >
|
||||
struct Handle { typedef T type; };
|
||||
|
||||
#define CGAL_Spherical_Kernel_pred(Y,Z) typedef SphericalFunctors::Y<SphericalKernel> Y; \
|
||||
Y Z() const { return Y(); }
|
||||
#define CGAL_Spherical_Kernel_cons(Y,Z) CGAL_Spherical_Kernel_pred(Y,Z)
|
||||
|
||||
#include <CGAL/Circular_kernel_3/interface_macros.h>
|
||||
};
|
||||
|
||||
} // namespace CGALi
|
||||
|
||||
template < class LinearKernel, class AlgebraicKernel >
|
||||
struct Spherical_kernel_3
|
||||
: // there should be a derivation from
|
||||
// LinearKernel::Kernel_base<Self> to have types equalities for
|
||||
// the Linearkernel types
|
||||
public Spherical_kernel_type_equality_wrapper<CGALi::Spherical_kernel_base_no_ref_count<Spherical_kernel_3<LinearKernel,AlgebraicKernel>,
|
||||
typename LinearKernel::template Base<Spherical_kernel_3<LinearKernel,AlgebraicKernel> >::Type >,
|
||||
Spherical_kernel_3<LinearKernel,AlgebraicKernel> >
|
||||
{
|
||||
typedef Spherical_kernel_3<LinearKernel,AlgebraicKernel> Self;
|
||||
|
||||
typedef typename LinearKernel::template Base<Spherical_kernel_3<LinearKernel,AlgebraicKernel> >::Type Linear_kernel;
|
||||
typedef AlgebraicKernel Algebraic_kernel;
|
||||
|
||||
// //Please remove this if you consider it to be sloppy
|
||||
struct Circular_tag{};
|
||||
typedef Circular_tag Definition_tag;
|
||||
// ////////////////////////////////////////////////////
|
||||
|
||||
|
||||
typedef typename LinearKernel::RT RT;
|
||||
typedef typename LinearKernel::FT FT;
|
||||
typedef Algebraic_kernel AK;
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_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 std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 >
|
||||
Polynomials_for_circle_3;
|
||||
|
||||
// public classes
|
||||
typedef CGAL::Object Object_3;
|
||||
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SPHERICAL_KERNEL_3_H
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_3_H
|
||||
#define CGAL_SPHERICAL_KERNEL_3_H
|
||||
|
||||
#include <CGAL/Circular_kernel_3/Circular_arc_point_3.h>
|
||||
#include <CGAL/Circular_arc_point_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/function_objects_polynomial_sphere.h>
|
||||
|
||||
#include <CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h>
|
||||
|
||||
#include <CGAL/Spherical_kernel_type_equality_wrapper.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGALi {
|
||||
|
||||
template < class SphericalKernel, class LinearKernelBase >
|
||||
struct Spherical_kernel_base_ref_count: public LinearKernelBase
|
||||
// takes classes in internal sub-namespace
|
||||
{
|
||||
typedef CGALi::Circular_arc_point_3<SphericalKernel> Circular_arc_point_3;
|
||||
typedef CGALi::Circle_3<SphericalKernel> Circle_3;
|
||||
typedef CGALi::Line_arc_3<SphericalKernel> Line_arc_3;
|
||||
|
||||
// The mecanism that allows to specify reference-counting or not.
|
||||
template < typename T >
|
||||
struct Handle { typedef Handle_for<T> type; };
|
||||
|
||||
#define CGAL_Spherical_Kernel_pred(Y,Z) typedef SphericalFunctors::Y<SphericalKernel> Y; \
|
||||
Y Z() const { return Y(); }
|
||||
#define CGAL_Spherical_Kernel_cons(Y,Z) CGAL_Spherical_Kernel_pred(Y,Z)
|
||||
|
||||
#include <CGAL/Circular_kernel_3/interface_macros.h>
|
||||
};
|
||||
|
||||
} // namespace CGALi
|
||||
|
||||
template < class LinearKernel, class AlgebraicKernel >
|
||||
struct Spherical_kernel_3
|
||||
: // there should be a derivation from
|
||||
// LinearKernel::Kernel_base<Self> to have types equalities for
|
||||
// the Linearkernel types
|
||||
public Spherical_kernel_type_equality_wrapper<CGALi::Spherical_kernel_base_ref_count<Spherical_kernel_3<LinearKernel,AlgebraicKernel>,
|
||||
typename LinearKernel::template Base<Spherical_kernel_3<LinearKernel,AlgebraicKernel> >::Type >,
|
||||
Spherical_kernel_3<LinearKernel,AlgebraicKernel> >
|
||||
{
|
||||
typedef Spherical_kernel_3<LinearKernel,AlgebraicKernel> Self;
|
||||
|
||||
typedef typename LinearKernel::template Base<Spherical_kernel_3<LinearKernel,AlgebraicKernel> >::Type Linear_kernel;
|
||||
typedef AlgebraicKernel Algebraic_kernel;
|
||||
|
||||
// //Please remove this if you consider it to be sloppy
|
||||
struct Circular_tag{};
|
||||
typedef Circular_tag Definition_tag;
|
||||
// ////////////////////////////////////////////////////
|
||||
|
||||
|
||||
typedef typename LinearKernel::RT RT;
|
||||
typedef typename LinearKernel::FT FT;
|
||||
typedef Algebraic_kernel AK;
|
||||
typedef typename AK::Root_of_2 Root_of_2;
|
||||
typedef typename AK::Root_for_spheres_2_3 Root_for_spheres_2_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 std::pair< Polynomial_for_spheres_2_3, Polynomial_1_3 >
|
||||
Polynomials_for_circle_3;
|
||||
|
||||
// public classes
|
||||
typedef CGAL::Object Object_3;
|
||||
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_SPHERICAL_KERNEL_3_H
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2005 INRIA Sophia-Antipolis (France)
|
||||
// All rights reserved.
|
||||
//
|
||||
// Authors : Monique Teillaud <Monique.Teillaud@sophia.inria.fr>
|
||||
// Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
|
||||
// Julien Hazebrouck
|
||||
// Damien Leroy
|
||||
//
|
||||
// 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)
|
||||
|
||||
#ifndef CGAL_SPHERICAL_KERNEL_TYPE_EQUALITY_WRAPPER_H
|
||||
#define CGAL_SPHERICAL_KERNEL_TYPE_EQUALITY_WRAPPER_H
|
||||
|
||||
#include <CGAL/user_classes.h>
|
||||
#include <CGAL/Kernel/Type_equality_wrapper.h>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < typename K_base, typename Kernel >
|
||||
struct Spherical_kernel_type_equality_wrapper
|
||||
: public Type_equality_wrapper<K_base, Kernel>
|
||||
{
|
||||
typedef K_base Kernel_base;
|
||||
typedef CGAL::Circle_3<Kernel> Circle_3;
|
||||
typedef CGAL::Circular_arc_point_3<Kernel> Circular_arc_point_3;
|
||||
//typedef CGAL::Circular_arc_3<Kernel> Circular_arc_3;
|
||||
typedef CGAL::Line_arc_3<Kernel> Line_arc_3;
|
||||
typedef CGAL::Root_of_2<typename Kernel_base::FT> Root_of_2;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // CGAL_SPHERICAL_KERNEL_TYPE_EQUALITY_WRAPPER_H
|
||||
Loading…
Reference in New Issue