diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index 713dfc08b39..bb2253f4665 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -278,4 +278,4 @@ CircleC3::operator!=(const CircleC3 &t) const CGAL_END_NAMESPACE -#endif // CGAL_CARTESIAN_CIRCLEC3_H \ No newline at end of file +#endif // CGAL_CARTESIAN_CIRCLEC3_H diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h index e758593721c..e064617fe03 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h @@ -37,6 +37,7 @@ class SphereC3 typedef typename R_::Point_3 Point_3; typedef typename R_::Vector_3 Vector_3; typedef typename R_::Sphere_3 Sphere_3; + typedef typename R_::Circle_3 Circle_3; typedef Triple Rep; typedef typename R_::template Handle::type Base; @@ -128,6 +129,7 @@ public: //! precond: ! x.is_degenerate() (when available) // Returns R::ON_POSITIVE_SIDE, R::ON_ORIENTED_BOUNDARY or // R::ON_NEGATIVE_SIDE + bool has_on(const Circle_3 &p) const; bool has_on_boundary(const Point_3 &p) const; bool has_on_positive_side(const Point_3 &p) const; bool has_on_negative_side(const Point_3 &p) const; @@ -180,6 +182,22 @@ bounded_side(const typename SphereC3::Point_3 &p) const squared_distance(center(),p))); } +template < class R > +inline +bool +SphereC3:: +has_on(const typename SphereC3::Circle_3 &c) const +{ + typedef typename SphereC3::Point_3 Point_3; + typedef typename SphereC3::FT FT; + Point_3 proj = c.supporting_plane().projection(center()); + if(!(proj == c.center())) return false; + const FT d2 = CGAL::square(center().x() - c.center().x()) + + CGAL::square(center().y() - c.center().y()) + + CGAL::square(center().z() - c.center().z()); + return ((squared_radius() - d2) == c.squared_radius()); +} + template < class R > inline bool diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 2c03b6379b8..08b3ff380d3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -3619,6 +3619,7 @@ namespace CartesianKernelFunctors { typedef typename K::Plane_3 Plane_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Circle_3 Circle_3; + typedef typename K::Sphere_3 Sphere_3; public: typedef typename K::Bool_type result_type; typedef Arity_tag< 2 > Arity; diff --git a/Cartesian_kernel/include/CGAL/Cartesian_converter.h b/Cartesian_kernel/include/CGAL/Cartesian_converter.h index 631b137168b..b934321da7b 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian_converter.h +++ b/Cartesian_kernel/include/CGAL/Cartesian_converter.h @@ -247,6 +247,15 @@ public: a.rep().orientation()); } + typename K2::Circle_3 + operator()(const typename K1::Circle_3 &a) const + { + typedef typename K2::Circle_3 Circle_3; + return Circle_3(operator()(a.center()), + c(a.squared_radius()), + c(a.supporting_plane())); + } + typename K2::Triangle_3 operator()(const typename K1::Triangle_3 &a) const {