More code move towards user classes, and improve 3D support for LazyK.

This commit is contained in:
Sylvain Pion 2006-08-02 11:23:56 +00:00
parent e816ebc3c8
commit b7614eee4e
16 changed files with 295 additions and 203 deletions

View File

@ -1876,6 +1876,7 @@ namespace CartesianKernelFunctors {
typedef typename K::Ray_3 Ray_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::RT RT;
typedef typename Direction_3::Rep Rep;
public:
typedef Direction_3 result_type;
typedef Arity_tag< 1 > Arity;
@ -1883,28 +1884,27 @@ namespace CartesianKernelFunctors {
#ifndef CGAL_NO_DEPRECATED_CODE
Direction_3
operator()(const RT& x, const RT& y, const RT& z) const
{ return Direction_3(x, y, z); }
{ return Rep(x, y, z); }
#endif // CGAL_NO_DEPRECATED_CODE
Direction_3
operator()(const Vector_3& v) const
{ return Direction_3(v); }
{ return Rep(v); }
Direction_3
operator()(const Line_3& l) const
{ return Direction_3(l); }
{ return Rep(l); }
Direction_3
operator()(const Ray_3& r) const
{ return Direction_3(r); }
{ return Rep(r); }
Direction_3
operator()(const Segment_3& s) const
{ return Direction_3(s); }
{ return Rep(s); }
};
template <typename K>
class Construct_iso_rectangle_2
{
@ -2035,6 +2035,7 @@ namespace CartesianKernelFunctors {
typedef typename K::Construct_vector_3 Construct_vector_3;
typedef typename K::Construct_direction_3 Construct_direction_3;
typedef typename K::Construct_point_on_3 Construct_point_on_3;
typedef typename Line_3::Rep Rep;
Construct_vector_3 cv;
Construct_point_on_3 cp;
public:
@ -2049,7 +2050,7 @@ namespace CartesianKernelFunctors {
Line_3
operator()(const Point_3& p, const Point_3& q) const
{ return Line_3(p, cv(p, q)); }
{ return Rep(p, cv(p, q)); }
Line_3
operator()(const Point_3& p, const Direction_3& d) const
@ -2057,15 +2058,15 @@ namespace CartesianKernelFunctors {
Line_3
operator()(const Point_3& p, const Vector_3& v) const
{ return Line_3(p, v); }
{ return Rep(p, v); }
Line_3
operator()(const Segment_3& s) const
{ return Line_3(cp(s,0), cv(cp(s,0), cp(s,1))); }
{ return Rep(cp(s,0), cv(cp(s,0), cp(s,1))); }
Line_3
operator()(const Ray_3& r) const
{ return Line_3(cp(r,0), cv(cp(r,0), cp(r,1))); }
{ return Rep(cp(r,0), cv(cp(r,0), cp(r,1))); }
};
template <typename K>
@ -2554,6 +2555,7 @@ namespace CartesianKernelFunctors {
typedef typename K::Line_3 Line_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::Point_3 Point_3;
typedef typename Vector_3::Rep Rep;
public:
typedef Vector_3 result_type;
typedef Arity_tag< 2 > Arity;
@ -2561,19 +2563,19 @@ namespace CartesianKernelFunctors {
Vector_3
operator()( const Point_3& p, const Point_3& q) const
{
return Vector_3(q.x() - p.x(), q.y() - p.y(), q.z() - p.z());
return Rep(q.x() - p.x(), q.y() - p.y(), q.z() - p.z());
}
Vector_3
operator()( const Origin&, const Point_3& q) const
{
return Vector_3(q.x(), q.y(), q.z());
return Rep(q.x(), q.y(), q.z());
}
Vector_3
operator()( const Point_3& p, const Origin&) const
{
return Vector_3(- p.x(), - p.y(), - p.z());
return Rep(- p.x(), - p.y(), - p.z());
}
Vector_3
@ -2586,7 +2588,7 @@ namespace CartesianKernelFunctors {
Vector_3
operator()( const Ray_3& r) const
{ return r.to_vector(); }
{ return r.rep().to_vector(); }
Vector_3
operator()( const Line_3& l) const
@ -2594,16 +2596,16 @@ namespace CartesianKernelFunctors {
Vector_3
operator()( const Null_vector&) const
{ return Vector_3(FT(0), FT(0), FT(0)); }
{ return Rep(FT(0), FT(0), FT(0)); }
// #ifndef CGAL_NO_DEPRECATED_CODE
Vector_3
operator()( const RT& x, const RT& y, const RT& z) const
{ return Vector_3(x, y, z); }
{ return Rep(x, y, z); }
Vector_3
operator()( const RT& x, const RT& y, const RT& z, const RT& w) const
{ return Vector_3(x, y, z, w); }
{ return Rep(x, y, z, w); }
// #endif // CGAL_NO_DEPRECATED_CODE
};

View File

@ -2366,7 +2366,7 @@ namespace HomogeneousKernelFunctors {
#ifndef CGAL_NO_DEPRECATED_CODE
Direction_3
operator()(const RT& x, const RT& y, const RT& z) const
{ return Direction_3(x, y, z); }
{ return Rep(x, y, z); }
#endif // CGAL_NO_DEPRECATED_CODE
Direction_3
@ -2375,15 +2375,15 @@ namespace HomogeneousKernelFunctors {
Direction_3
operator()(const Line_3& l) const
{ return Direction_3(l); }
{ return Rep(l); }
Direction_3
operator()(const Ray_3& r) const
{ return Direction_3(r); }
{ return Rep(r); }
Direction_3
operator()(const Segment_3& s) const
{ return Direction_3(s); }
{ return Rep(s); }
};
@ -3058,6 +3058,7 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Line_3 Line_3;
typedef typename K::Vector_3 Vector_3;
typedef typename K::Point_3 Point_3;
typedef typename Vector_3::Rep Rep;
public:
typedef Vector_3 result_type;
typedef Arity_tag< 2 > Arity;
@ -3065,22 +3066,22 @@ namespace HomogeneousKernelFunctors {
Vector_3
operator()( const Point_3& p, const Point_3& q) const
{
return Vector_3(q.hx()*p.hw() - p.hx()*q.hw(),
q.hy()*p.hw() - p.hy()*q.hw(),
q.hz()*p.hw() - p.hz()*q.hw(),
q.hw()*p.hw() );
return Rep(q.hx()*p.hw() - p.hx()*q.hw(),
q.hy()*p.hw() - p.hy()*q.hw(),
q.hz()*p.hw() - p.hz()*q.hw(),
q.hw()*p.hw() );
}
Vector_3
operator()( const Origin&, const Point_3& q) const
{
return Vector_3( q.hx(), q.hy(), q.hz(), q.hw());
return Rep( q.hx(), q.hy(), q.hz(), q.hw());
}
Vector_3
operator()( const Point_3& p, const Origin& q) const
{
return Vector_3( - p.hx(), - p.hy(), - p.hz(), p.hw() );
return Rep( - p.hx(), - p.hy(), - p.hz(), p.hw() );
}
Vector_3
@ -3094,7 +3095,7 @@ namespace HomogeneousKernelFunctors {
Vector_3
operator()( const Ray_3& r) const
{ return r.to_vector(); }
{ return r.rep().to_vector(); }
Vector_3
operator()( const Line_3& l) const
@ -3102,16 +3103,16 @@ namespace HomogeneousKernelFunctors {
Vector_3
operator()( const Null_vector&) const
{ return Vector_3(RT(0), RT(0), RT(0), RT(1)); }
{ return Rep(RT(0), RT(0), RT(0), RT(1)); }
// #ifndef CGAL_NO_DEPRECATED_CODE
Vector_3
operator()( const RT& x, const RT& y, const RT& z) const
{ return Vector_3(x, y, z); }
{ return Rep(x, y, z); }
Vector_3
operator()( const RT& x, const RT& y, const RT& z, const RT& w) const
{ return Vector_3(x, y, z, w); }
{ return Rep(x, y, z, w); }
// #endif // CGAL_NO_DEPRECATED_CODE
};

View File

@ -35,10 +35,9 @@ class Direction_3 : public R_::Kernel_base::Direction_3
typedef typename R_::Ray_3 Ray_3;
typedef typename R_::Segment_3 Segment_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Direction_3 RDirection_3;
public:
typedef RDirection_3 Rep;
typedef typename R_::Kernel_base::Direction_3 Rep;
const Rep& rep() const
{
@ -54,23 +53,23 @@ public:
Direction_3() {}
Direction_3(const RDirection_3& d)
: RDirection_3(d) {}
Direction_3(const Rep& d)
: Rep(d) {}
Direction_3(const Vector_3& v)
: RDirection_3(v) {}
: Rep(typename R::Construct_direction_3()(v).rep()) {}
Direction_3(const Line_3& l)
: RDirection_3(l) {}
: Rep(typename R::Construct_direction_3()(l).rep()) {}
Direction_3(const Ray_3& r)
: RDirection_3(r) {}
: Rep(typename R::Construct_direction_3()(r).rep()) {}
Direction_3(const Segment_3& s)
: RDirection_3(s) {}
: Rep(typename R::Construct_direction_3()(s).rep()) {}
Direction_3(const RT& hx, const RT& hy, const RT& hz)
: RDirection_3(hx, hy, hz) {}
: Rep(typename R::Construct_direction_3()(hx, hy, hz).rep()) {}
Direction_3 transform(const Aff_transformation_3 &t) const
{
@ -125,16 +124,16 @@ public:
template < class R >
std::ostream& operator<<(std::ostream& os, const Direction_3<R>& d)
{
typedef typename R::Kernel_base::Direction_3 RDirection_3;
return os << static_cast<const RDirection_3&>(d); }
typedef typename R::Kernel_base::Direction_3 Rep;
return os << static_cast<const Rep&>(d); }
#endif // CGAL_NO_OSTREAM_INSERT_DIRECTION_3
#ifndef CGAL_NO_ISTREAM_EXTRACT_DIRECTION_3
template < class R >
std::istream& operator>>(std::istream& is, Direction_3<R>& p)
{
typedef typename R::Kernel_base::Direction_3 RDirection_3;
return is >> static_cast<RDirection_3&>(p); }
typedef typename R::Kernel_base::Direction_3 Rep;
return is >> static_cast<Rep&>(p); }
#endif // CGAL_NO_ISTREAM_EXTRACT_DIRECTION_3
CGAL_END_NAMESPACE

View File

@ -31,10 +31,9 @@ class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3
{
typedef typename R_::RT RT;
typedef typename R_::Point_3 Point_3;
typedef typename R_::Kernel_base::Iso_cuboid_3 RIso_cuboid_3;
public:
typedef RIso_cuboid_3 Rep;
typedef typename R_::Kernel_base::Iso_cuboid_3 Rep;
const Rep& rep() const
{
@ -50,25 +49,28 @@ public:
Iso_cuboid_3() {}
Iso_cuboid_3(const RIso_cuboid_3& r)
: RIso_cuboid_3(r) {}
Iso_cuboid_3(const Rep& r)
: Rep(r) {}
Iso_cuboid_3(const Point_3& p, const Point_3& q)
: RIso_cuboid_3(p,q) {}
: Rep(typename R::Construct_iso_cuboid_3()(p,q).rep()) {}
Iso_cuboid_3(const Point_3 &left, const Point_3 &right,
const Point_3 &bottom, const Point_3 &top,
const Point_3 &far_, const Point_3 &close)
: RIso_cuboid_3(left, right, bottom, top, far_, close) {}
: Rep(typename R::Construct_iso_cuboid_3()(left, right, bottom,
top, far_, close).rep()) {}
Iso_cuboid_3(const RT& min_hx, const RT& min_hy, const RT& min_hz,
const RT& max_hx, const RT& max_hy, const RT& max_hz,
const RT& hw)
: RIso_cuboid_3(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw) {}
: Rep(typename R::Construct_iso_cuboid_3()(min_hx, min_hy, min_hz,
max_hx, max_hy, max_hz, hw).rep()) {}
Iso_cuboid_3(const RT& min_hx, const RT& min_hy, const RT& min_hz,
const RT& max_hx, const RT& max_hy, const RT& max_hz)
: RIso_cuboid_3(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz) {}
: Rep(typename R::Construct_iso_cuboid_3()(min_hx, min_hy, min_hz,
max_hx, max_hy, max_hz).rep()) {}
// TODO FIXME : why is Qrt not working here ?
// TODO : the Cartesian and Homogeneous functors should be split here
@ -211,8 +213,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Iso_cuboid_3<R>& r)
{
typedef typename R::Kernel_base::Iso_cuboid_3 RIso_cuboid_3;
return os << (const RIso_cuboid_3& )r; }
typedef typename R::Kernel_base::Iso_cuboid_3 Rep;
return os << (const Rep& )r; }
#endif // CGAL_NO_OSTREAM_INSERT_ISO_CUBOID_3
#ifndef CGAL_NO_ISTREAM_EXTRACT_ISO_CUBOID_3
@ -220,8 +222,8 @@ template < class R >
std::istream&
operator>>(std::istream& is, Iso_cuboid_3<R>& r)
{
typedef typename R::Kernel_base::Iso_cuboid_3 RIso_cuboid_3;
is >> (RIso_cuboid_3& )r;
typedef typename R::Kernel_base::Iso_cuboid_3 Rep;
is >> (Rep& )r;
return is;
}
#endif // CGAL_NO_ISTREAM_EXTRACT_ISO_CUBOID_3

View File

@ -33,10 +33,9 @@ class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2
typedef typename R_::FT FT;
typedef typename R_::Point_2 Point_2;
typedef typename R_::Aff_transformation_2 Aff_transformation_2;
typedef typename R_::Kernel_base::Iso_rectangle_2 RIso_rectangle_2;
public:
typedef RIso_rectangle_2 Rep;
typedef typename R_::Kernel_base::Iso_rectangle_2 Rep;
const Rep& rep() const
{
@ -52,23 +51,23 @@ public:
Iso_rectangle_2() {}
Iso_rectangle_2(const RIso_rectangle_2& r)
: RIso_rectangle_2(r) {}
Iso_rectangle_2(const Rep& r)
: Rep(r) {}
Iso_rectangle_2(const Point_2 &p, const Point_2 &q)
: RIso_rectangle_2(typename R::Construct_iso_rectangle_2()(p,q).rep()) {}
: Rep(typename R::Construct_iso_rectangle_2()(p,q).rep()) {}
Iso_rectangle_2(const Point_2 &left, const Point_2 &right,
const Point_2 &bottom, const Point_2 &top)
: RIso_rectangle_2(typename R::Construct_iso_rectangle_2()(left, right, bottom, top).rep()) {}
: Rep(typename R::Construct_iso_rectangle_2()(left, right, bottom, top).rep()) {}
Iso_rectangle_2(const RT& min_hx, const RT& min_hy,
const RT& max_hx, const RT& max_hy)
: RIso_rectangle_2(typename R::Construct_iso_rectangle_2()(min_hx, min_hy, max_hx, max_hy).rep()) {}
: Rep(typename R::Construct_iso_rectangle_2()(min_hx, min_hy, max_hx, max_hy).rep()) {}
Iso_rectangle_2(const RT& min_hx, const RT& min_hy,
const RT& max_hx, const RT& max_hy, const RT& hw)
: RIso_rectangle_2(typename R::Construct_iso_rectangle_2()(min_hx, min_hy, max_hx, max_hy, hw).rep()) {}
: Rep(typename R::Construct_iso_rectangle_2()(min_hx, min_hy, max_hx, max_hy, hw).rep()) {}
typename Qualified_result_of<typename R::Construct_min_vertex_2, Iso_rectangle_2 >::type

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005 Utrecht University (The Netherlands),
// Copyright (c) 2005, 2006 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),
@ -31,6 +31,8 @@ CGAL_BEGIN_NAMESPACE
// This is a tool to obtain the K2::Point_2 from K1 and K1::Point_2.
// Similarly for other kernel types.
// TODO : add more specializations ? Use a different mechanism ?
template < typename T, typename K1, typename K2 >
struct Type_mapper
{
@ -95,7 +97,74 @@ struct Type_mapper < typename K1::Circle_2, K1, K2 >
typedef typename K2::Circle_2 type;
};
// TODO : more specializations...
// 3D
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Point_3, K1, K2 >
{
typedef typename K2::Point_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Plane_3, K1, K2 >
{
typedef typename K2::Plane_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Vector_3, K1, K2 >
{
typedef typename K2::Vector_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Direction_3, K1, K2 >
{
typedef typename K2::Direction_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Segment_3, K1, K2 >
{
typedef typename K2::Segment_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Ray_3, K1, K2 >
{
typedef typename K2::Ray_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Line_3, K1, K2 >
{
typedef typename K2::Line_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Triangle_3, K1, K2 >
{
typedef typename K2::Triangle_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Tetrahedron_3, K1, K2 >
{
typedef typename K2::Tetrahedron_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Iso_cuboid_3, K1, K2 >
{
typedef typename K2::Iso_cuboid_3 type;
};
template < typename K1, typename K2 >
struct Type_mapper < typename K1::Sphere_3, K1, K2 >
{
typedef typename K2::Sphere_3 type;
};
CGAL_END_NAMESPACE

View File

@ -254,7 +254,7 @@ namespace CommonKernelFunctors {
FT
operator()( const Vector_3& v) const
{ return v.squared_length(); }
{ return v.rep().squared_length(); }
FT
operator()( const Segment_3& s) const
@ -698,21 +698,35 @@ namespace CommonKernelFunctors {
template <typename K>
class Construct_iso_cuboid_3
{
typedef typename K::RT RT;
typedef typename K::Point_3 Point_3;
typedef typename K::Iso_cuboid_3 Iso_cuboid_3;
typedef typename Iso_cuboid_3::Rep Rep;
public:
typedef Iso_cuboid_3 result_type;
typedef Arity_tag< 2 > Arity;
Iso_cuboid_3
operator()(const Point_3& p, const Point_3& q) const
{ return Iso_cuboid_3(p, q); }
{ return Rep(p, q); }
Iso_cuboid_3
operator()(const Point_3 &left, const Point_3 &right,
const Point_3 &bottom, const Point_3 &top,
const Point_3 &far_, const Point_3 &close) const
{ return Iso_cuboid_3(left, right, bottom, top, far_, close); }
{ return Rep(left, right, bottom, top, far_, close); }
Iso_cuboid_3
operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,
const RT& max_hx, const RT& max_hy, const RT& max_hz,
const RT& hw) const
{ return Rep(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw); }
Iso_cuboid_3
operator()(const RT& min_hx, const RT& min_hy, const RT& min_hz,
const RT& max_hx, const RT& max_hy, const RT& max_hz) const
{ return Rep(min_hx, min_hy, min_hz, max_hx, max_hy, max_hz); }
};
template <typename K>
@ -1022,37 +1036,38 @@ namespace CommonKernelFunctors {
typedef typename K::Ray_3 Ray_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::Plane_3 Plane_3;
typedef typename Plane_3::Rep Rep;
public:
typedef Plane_3 result_type;
typedef Arity_tag< 2 > Arity;
Plane_3
operator()(const RT& a, const RT& b, const RT& c, const RT& d) const
{ return Plane_3(a, b, c, d); }
{ return Rep(a, b, c, d); }
Plane_3
operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
{ return Plane_3(p, q, r); }
{ return Rep(p, q, r); }
Plane_3
operator()(const Point_3& p, const Direction_3& d) const
{ return Plane_3(p, d); }
{ return Rep(p, d); }
Plane_3
operator()(const Point_3& p, const Vector_3& v) const
{ return Plane_3(p, v); }
{ return Rep(p, v); }
Plane_3
operator()(const Line_3& l, const Point_3& p) const
{ return Plane_3(l, p); }
{ return Rep(l, p); }
Plane_3
operator()(const Ray_3& r, const Point_3& p) const
{ return Plane_3(r, p); }
{ return Rep(r, p); }
Plane_3
operator()(const Segment_3& s, const Point_3& p) const
{ return Plane_3(s, p); }
{ return Rep(s, p); }
};
template <typename K>
@ -1114,13 +1129,14 @@ namespace CommonKernelFunctors {
{
typedef typename K::RT RT;
typedef typename K::Point_3 Point_3;
typedef typename Point_3::Rep Rep;
public:
typedef Point_3 result_type;
typedef Arity_tag< 1 > Arity;
Point_3
operator()(Origin o) const
{ return Point_3(o); }
{ return Rep(o); }
// Reactivated, as some functors in Cartesian/function_objects.h
@ -1128,11 +1144,11 @@ namespace CommonKernelFunctors {
//#ifndef CGAL_NO_DEPRECATED_CODE
Point_3
operator()(const RT& x, const RT& y, const RT& z) const
{ return Point_3(x, y, z); }
{ return Rep(x, y, z); }
Point_3
operator()(const RT& x, const RT& y, const RT& z, const RT& w) const
{ return Point_3(x, y, z, w); }
{ return Rep(x, y, z, w); }
//#endif // CGAL_NO_DEPRECATED_CODE
};
@ -1148,7 +1164,7 @@ namespace CommonKernelFunctors {
Point_2
operator()( const Plane_3& h, const Point_3& p) const
{ return h.to_2d(p); }
{ return h.rep().to_2d(p); }
};
template <typename K>
@ -1189,25 +1205,26 @@ namespace CommonKernelFunctors {
typedef typename K::Direction_3 Direction_3;
typedef typename K::Line_3 Line_3;
typedef typename K::Ray_3 Ray_3;
typedef typename Ray_3::Rep Rep;
public:
typedef Ray_3 result_type;
typedef Arity_tag< 2 > Arity;
Ray_3
operator()(const Point_3& p, const Point_3& q) const
{ return Ray_3(p, q); }
{ return Rep(p, q); }
Ray_3
operator()(const Point_3& p, const Vector_3& v) const
{ return Ray_3(p, v); }
{ return Rep(p, v); }
Ray_3
operator()(const Point_3& p, const Direction_3& d) const
{ return Ray_3(p, d); }
{ return Rep(p, d); }
Ray_3
operator()(const Point_3& p, const Line_3& l) const
{ return Ray_3(p, l); }
{ return Rep(p, l); }
};
template <typename K>
@ -1230,13 +1247,14 @@ namespace CommonKernelFunctors {
{
typedef typename K::Segment_3 Segment_3;
typedef typename K::Point_3 Point_3;
typedef typename Segment_3::Rep Rep;
public:
typedef Segment_3 result_type;
typedef Arity_tag< 2 > Arity;
Segment_3
operator()( const Point_3& p, const Point_3& q) const
{ return Segment_3(p, q); }
{ return Rep(p, q); }
};
@ -1343,6 +1361,7 @@ namespace CommonKernelFunctors {
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Sphere_3 Sphere_3;
typedef typename Sphere_3::Rep Rep;
public:
typedef Sphere_3 result_type;
typedef Arity_tag< 4 > Arity;
@ -1350,27 +1369,27 @@ namespace CommonKernelFunctors {
Sphere_3
operator()( const Point_3& center, const FT& squared_radius,
Orientation orientation = COUNTERCLOCKWISE) const
{ return Sphere_3(center, squared_radius, orientation); }
{ return Rep(center, squared_radius, orientation); }
Sphere_3
operator()( const Point_3& p, const Point_3& q,
const Point_3& r, const Point_3& s) const
{ return Sphere_3(p, q, r, s); }
{ return Rep(p, q, r, s); }
Sphere_3
operator()( const Point_3& p, const Point_3& q, const Point_3& r,
Orientation orientation = COUNTERCLOCKWISE) const
{ return Sphere_3(p, q, r, orientation); }
{ return Rep(p, q, r, orientation); }
Sphere_3
operator()( const Point_3& p, const Point_3& q,
Orientation orientation = COUNTERCLOCKWISE) const
{ return Sphere_3(p, q, orientation); }
{ return Rep(p, q, orientation); }
Sphere_3
operator()( const Point_3& center,
Orientation orientation = COUNTERCLOCKWISE) const
{ return Sphere_3(center, orientation); }
{ return Rep(center, orientation); }
};
#ifndef CGAL_NO_DEPRECATED_CODE
@ -1432,6 +1451,7 @@ namespace CommonKernelFunctors {
{
typedef typename K::Tetrahedron_3 Tetrahedron_3;
typedef typename K::Point_3 Point_3;
typedef typename Tetrahedron_3::Rep Rep;
public:
typedef Tetrahedron_3 result_type;
typedef Arity_tag< 4 > Arity;
@ -1439,7 +1459,7 @@ namespace CommonKernelFunctors {
Tetrahedron_3
operator()( const Point_3& p, const Point_3& q,
const Point_3& r, const Point_3& s) const
{ return Tetrahedron_3(p, q, r, s); }
{ return Rep(p, q, r, s); }
};
template <typename K>
@ -1462,13 +1482,14 @@ namespace CommonKernelFunctors {
{
typedef typename K::Triangle_3 Triangle_3;
typedef typename K::Point_3 Point_3;
typedef typename Triangle_3::Rep Rep;
public:
typedef Triangle_3 result_type;
typedef Arity_tag< 3 > Arity;
Triangle_3
operator()( const Point_3& p, const Point_3& q, const Point_3& r) const
{ return Triangle_3(p, q, r); }
{ return Rep(p, q, r); }
};

View File

@ -38,10 +38,9 @@ class Line_3 : public R_::Kernel_base::Line_3
typedef typename R_::Vector_3 Vector_3;
typedef typename R_::Plane_3 Plane_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Line_3 RLine_3;
public:
typedef RLine_3 Rep;
typedef typename R_::Kernel_base::Line_3 Rep;
const Rep& rep() const
{
@ -57,24 +56,24 @@ public:
Line_3() {}
Line_3(const Point_3 & p, const Point_3 & q)
: RLine_3(p,q) {}
// conversion impl -> interface class
Line_3(const RLine_3& l)
: RLine_3(l) {}
Line_3(const Rep& l)
: Rep(l) {}
Line_3(const Point_3 & p, const Point_3 & q)
: Rep(typename R::Construct_line_3()(p, q).rep()) {}
Line_3(const Segment_3 & s)
: RLine_3( s ) {}
: Rep(typename R::Construct_line_3()(s).rep()) {}
Line_3(const Ray_3 & r)
: RLine_3( r ) {}
: Rep(typename R::Construct_line_3()(r).rep()) {}
Line_3(const Point_3 & p, const Direction_3 & d)
: RLine_3( p, d ) {}
: Rep(typename R::Construct_line_3()(p, d).rep()) {}
Line_3(const Point_3 & p, const Vector_3 & v)
: RLine_3( p, v ) {}
: Rep(typename R::Construct_line_3()(p, v).rep()) {}
Line_3 transform(const Aff_transformation_3 &t) const
{
@ -134,8 +133,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Line_3<R>& l)
{
typedef typename R::Kernel_base::Line_3 RLine_3;
return os << static_cast<const RLine_3&>(l);
typedef typename R::Kernel_base::Line_3 Rep;
return os << static_cast<const Rep&>(l);
}
#endif // CGAL_NO_OSTREAM_INSERT_LINE_3
@ -144,8 +143,8 @@ template < class R >
std::istream&
operator>>(std::istream & is, Line_3<R> & p)
{
typedef typename R::Kernel_base::Line_3 RLine_3;
is >> static_cast<RLine_3&>(p);
typedef typename R::Kernel_base::Line_3 Rep;
is >> static_cast<Rep&>(p);
return is;
}
#endif // CGAL_NO_ISTREAM_EXTRACT_LINE_3

View File

@ -38,10 +38,9 @@ class Plane_3 : public R_::Kernel_base::Plane_3
typedef typename R_::Line_3 Line_3;
typedef typename R_::Ray_3 Ray_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Plane_3 RPlane_3;
public:
typedef RPlane_3 Rep;
typedef typename R_::Kernel_base::Plane_3 Rep;
const Rep& rep() const
{
@ -57,29 +56,29 @@ public:
Plane_3() {}
Plane_3(const RPlane_3& p)
: RPlane_3(p) {}
Plane_3(const Rep& p)
: Rep(p) {}
Plane_3(const Point_3& p, const Point_3& q, const Point_3& r)
: RPlane_3(p,q,r) {}
: Rep(typename R::Construct_plane_3()(p, q, r).rep()) {}
Plane_3(const Point_3& p, const Direction_3& d)
: RPlane_3(p,d) {}
: Rep(typename R::Construct_plane_3()(p, d).rep()) {}
Plane_3(const Point_3& p, const Vector_3& v)
: RPlane_3(p,v) {}
: Rep(typename R::Construct_plane_3()(p, v).rep()) {}
Plane_3(const RT& a, const RT& b, const RT& c, const RT& d)
: RPlane_3(a,b,c,d) {}
: Rep(typename R::Construct_plane_3()(a, b, c, d).rep()) {}
Plane_3(const Line_3& l, const Point_3& p)
: RPlane_3(l,p) {}
: Rep(typename R::Construct_plane_3()(l, p).rep()) {}
Plane_3(const Segment_3& s, const Point_3& p)
: RPlane_3(s,p) {}
: Rep(typename R::Construct_plane_3()(s, p).rep()) {}
Plane_3(const Ray_3& r, const Point_3& p)
: RPlane_3(r,p) {}
: Rep(typename R::Construct_plane_3()(r, p).rep()) {}
Plane_3 transform(const Aff_transformation_3 &t) const
{
@ -163,7 +162,7 @@ public:
Point_2 to_2d(const Point_3 &p) const
{
return rep().to_2d(p);
return R().construct_projected_xy_point_2_object()(*this, p);
}
Point_3 to_3d(const Point_2 &p) const
@ -214,8 +213,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Plane_3<R>& p)
{
typedef typename R::Kernel_base::Plane_3 RPlane_3;
return os << static_cast<const RPlane_3&>(p);
typedef typename R::Kernel_base::Plane_3 Rep;
return os << static_cast<const Rep&>(p);
}
#endif // CGAL_NO_OSTREAM_INSERT_PLANE_3
@ -224,8 +223,8 @@ template < class R >
std::istream&
operator>>(std::istream& is, Plane_3<R>& t)
{
typedef typename R::Kernel_base::Plane_3 RPlane_3;
return is >> static_cast<RPlane_3&>(t);
typedef typename R::Kernel_base::Plane_3 Rep;
return is >> static_cast<Rep&>(t);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_PLANE_3

View File

@ -34,10 +34,10 @@ class Point_3 : public R_::Kernel_base::Point_3
typedef typename R_::RT RT;
typedef typename R_::Vector_3 Vector_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Point_3 RPoint_3;
public:
typedef RPoint_3 Rep;
typedef typename R_::Kernel_base::Point_3 Rep;
typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator;
const Rep& rep() const
@ -55,18 +55,21 @@ public:
Point_3() {}
Point_3(const Origin& o)
: RPoint_3(o) {}
: Rep(typename R::Construct_point_3()(o).rep())
{}
#if 1
Point_3(const RPoint_3& p)
: RPoint_3(p) {}
Point_3(const Rep& p)
: Rep(p) {}
#endif
Point_3(const RT& x, const RT& y, const RT& z)
: RPoint_3(x, y, z) {}
: Rep(typename R::Construct_point_3()(x, y, z).rep())
{}
Point_3(const RT& hx, const RT& hy, const RT& hz, const RT& hw)
: RPoint_3(hx, hy, hz, hw) {}
: Rep(typename R::Construct_point_3()(hx, hy, hz, hw).rep())
{}
typename Qualified_result_of<typename R::Compute_x_3, Point_3>::type
x() const
@ -168,8 +171,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Point_3<R>& p)
{
typedef typename R::Kernel_base::Point_3 RPoint_3;
return os << static_cast<const RPoint_3&>(p);
typedef typename R::Kernel_base::Point_3 Rep;
return os << static_cast<const Rep&>(p);
}
#endif // CGAL_NO_OSTREAM_INSERT_POINT_3
@ -177,8 +180,8 @@ operator<<(std::ostream& os, const Point_3<R>& p)
template < class R >
std::istream& operator>>(std::istream& is, Point_3<R>& p)
{
typedef typename R::Kernel_base::Point_3 RPoint_3;
return is >> static_cast<RPoint_3&>(p);
typedef typename R::Kernel_base::Point_3 Rep;
return is >> static_cast<Rep&>(p);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_POINT_3

View File

@ -35,10 +35,9 @@ class Ray_3 : public R_::Kernel_base::Ray_3
typedef typename R_::Vector_3 Vector_3;
typedef typename R_::Line_3 Line_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Ray_3 RRay_3;
public:
typedef RRay_3 Rep;
typedef typename R_::Kernel_base::Ray_3 Rep;
const Rep& rep() const
{
@ -54,20 +53,20 @@ public:
Ray_3() {}
Ray_3(const RRay_3& r)
: RRay_3(r) {}
Ray_3(const Rep& r)
: Rep(r) {}
Ray_3(const Point_3& sp, const Point_3& secondp)
: RRay_3(sp, secondp) {}
: Rep(typename R::Construct_ray_3()(sp, secondp).rep()) {}
Ray_3(const Point_3& sp, const Vector_3& v)
: RRay_3(sp, v) {}
: Rep(typename R::Construct_ray_3()(sp, v).rep()) {}
Ray_3(const Point_3& sp, const Direction_3& d)
: RRay_3(sp, d) {}
: Rep(typename R::Construct_ray_3()(sp, d).rep()) {}
Ray_3(const Point_3& sp, const Line_3& l)
: RRay_3(sp, l) {}
: Rep(typename R::Construct_ray_3()(sp, l).rep()) {}
Ray_3 transform(const Aff_transformation_3 &t) const
{
@ -154,8 +153,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Ray_3<R>& r)
{
typedef typename R::Kernel_base::Ray_3 RRay_3;
return os << static_cast<const RRay_3&>(r);
typedef typename R::Kernel_base::Ray_3 Rep;
return os << static_cast<const Rep&>(r);
}
#endif // CGAL_NO_OSTREAM_INSERT_RAY_3
@ -164,8 +163,8 @@ template < class R >
std::istream&
operator>>(std::istream& is, Ray_3<R>& r)
{
typedef typename R::Kernel_base::Ray_3 RRay_3;
return is >> static_cast<RRay_3&>(r);
typedef typename R::Kernel_base::Ray_3 Rep;
return is >> static_cast<Rep&>(r);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_RAY_3

View File

@ -36,10 +36,9 @@ class Segment_3 : public R_::Kernel_base::Segment_3
typedef typename R_::Direction_3 Direction_3;
typedef typename R_::Line_3 Line_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Segment_3 RSegment_3;
public:
typedef RSegment_3 Rep;
typedef typename R_::Kernel_base::Segment_3 Rep;
const Rep& rep() const
{
@ -55,11 +54,11 @@ public:
Segment_3() {}
Segment_3(const Point_3& sp, const Point_3& ep)
: RSegment_3(sp,ep) {}
Segment_3(const Rep& s)
: Rep(s) {}
Segment_3(const RSegment_3& s)
: RSegment_3(s) {}
Segment_3(const Point_3& sp, const Point_3& ep)
: Rep(typename R::Construct_segment_3()(sp, ep).rep()) {}
// FIXME TODO : Use Qrt here !
//typename Qualified_result_of<typename R::Construct_source_3, Segment_3>::type
@ -194,8 +193,8 @@ template < class R>
std::ostream&
operator<<(std::ostream& os, const Segment_3<R>& s)
{
typedef typename R::Kernel_base::Segment_3 RSegment_3;
return os << static_cast<const RSegment_3&>(s);
typedef typename R::Kernel_base::Segment_3 Rep;
return os << static_cast<const Rep&>(s);
}
#endif // CGAL_NO_OSTREAM_INSERT_SEGMENT_3
@ -204,8 +203,8 @@ template < class R>
std::istream&
operator>>(std::istream& is, Segment_3<R>& s)
{
typedef typename R::Kernel_base::Segment_3 RSegment_3;
return is >> static_cast<RSegment_3&>(s);
typedef typename R::Kernel_base::Segment_3 Rep;
return is >> static_cast<Rep&>(s);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_SEGMENT_3

View File

@ -32,10 +32,9 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3
typedef typename R_::FT FT;
typedef typename R_::Point_3 Point_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Sphere_3 RSphere_3;
public:
typedef RSphere_3 Rep;
typedef typename R_::Kernel_base::Sphere_3 Rep;
const Rep& rep() const
{
@ -51,27 +50,27 @@ public:
Sphere_3() {}
Sphere_3(const RSphere_3& s)
: RSphere_3(s) {}
Sphere_3(const Rep& s)
: Rep(s) {}
Sphere_3(const Point_3& p, const FT& sq_rad,
const Orientation& o = COUNTERCLOCKWISE)
: RSphere_3(p, sq_rad, o) {}
: Rep(typename R::Construct_sphere_3()(p, sq_rad, o).rep()) {}
Sphere_3(const Point_3& p, const Point_3& q,
const Point_3& r, const Point_3& u)
: RSphere_3(p, q, r, u) {}
: Rep(typename R::Construct_sphere_3()(p, q, r, u).rep()) {}
Sphere_3(const Point_3& p, const Point_3& q, const Point_3& r,
const Orientation& o = COUNTERCLOCKWISE)
: RSphere_3(p, q, r, o) {}
: Rep(typename R::Construct_sphere_3()(p, q, r, o).rep()) {}
Sphere_3(const Point_3& p, const Point_3& q,
const Orientation& o = COUNTERCLOCKWISE)
: RSphere_3(p, q, o) {}
: Rep(typename R::Construct_sphere_3()(p, q, o).rep()) {}
Sphere_3(const Point_3& p, const Orientation& o = COUNTERCLOCKWISE)
: RSphere_3(p, o) {}
: Rep(typename R::Construct_sphere_3()(p, o).rep()) {}
Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const;

View File

@ -31,10 +31,9 @@ class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3
{
typedef typename R_::Point_3 Point_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Tetrahedron_3 RTetrahedron_3;
public:
typedef RTetrahedron_3 Rep;
typedef typename R_::Kernel_base::Tetrahedron_3 Rep;
const Rep& rep() const
{
@ -50,14 +49,12 @@ public:
Tetrahedron_3() {}
Tetrahedron_3(const RTetrahedron_3& t)
: RTetrahedron_3(t) {}
Tetrahedron_3(const Rep& t)
: Rep(t) {}
Tetrahedron_3(const Point_3& p,
const Point_3& q,
const Point_3& r,
const Point_3& s)
: RTetrahedron_3(p,q,r,s) {}
Tetrahedron_3(const Point_3& p, const Point_3& q,
const Point_3& r, const Point_3& s)
: Rep(typename R::Construct_tetrahedron_3()(p, q, r, s).rep()) {}
Tetrahedron_3 transform(const Aff_transformation_3 &t) const
{
@ -141,8 +138,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Tetrahedron_3<R>& t)
{
typedef typename R::Kernel_base::Tetrahedron_3 RTetrahedron_3;
return os << static_cast<const RTetrahedron_3&>(t);
typedef typename R::Kernel_base::Tetrahedron_3 Rep;
return os << static_cast<const Rep&>(t);
}
#endif // CGAL_NO_OSTREAM_INSERT_TETRAHEDRON_3
@ -151,8 +148,8 @@ template < class R >
std::istream&
operator>>(std::istream& is, Tetrahedron_3<R>& t)
{
typedef typename R::Kernel_base::Tetrahedron_3 RTetrahedron_3;
return is >> static_cast<RTetrahedron_3&>(t);
typedef typename R::Kernel_base::Tetrahedron_3 Rep;
return is >> static_cast<Rep&>(t);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_TETRAHEDRON_3

View File

@ -34,10 +34,9 @@ class Triangle_3 : public R_::Kernel_base::Triangle_3
typedef typename R_::Point_3 Point_3;
typedef typename R_::Plane_3 Plane_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Triangle_3 RTriangle_3;
public:
typedef RTriangle_3 Rep;
typedef typename R_::Kernel_base::Triangle_3 Rep;
const Rep& rep() const
{
@ -53,11 +52,11 @@ public:
Triangle_3() {}
Triangle_3(const RTriangle_3& t)
: RTriangle_3(t) {}
Triangle_3(const Rep& t)
: Rep(t) {}
Triangle_3(const Point_3& p, const Point_3& q, const Point_3& r)
: RTriangle_3(p,q,r) {}
: Rep(typename R::Construct_triangle_3()(p, q, r).rep()) {}
Triangle_3 transform(const Aff_transformation_3 &t) const
{
@ -103,8 +102,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Triangle_3<R>& t)
{
typedef typename R::Kernel_base::Triangle_3 RTriangle_3;
return os << static_cast<const RTriangle_3&>(t);
typedef typename R::Kernel_base::Triangle_3 Rep;
return os << static_cast<const Rep&>(t);
}
#endif // CGAL_NO_OSTREAM_INSERT_TRIANGLE_3
@ -113,8 +112,8 @@ template < class R >
std::istream&
operator>>(std::istream& is, Triangle_3<R>& t)
{
typedef typename R::Kernel_base::Triangle_3 RTriangle_3;
return is >> static_cast<RTriangle_3&>(t);
typedef typename R::Kernel_base::Triangle_3 Rep;
return is >> static_cast<Rep&>(t);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_TRIANGLE_3

View File

@ -39,10 +39,9 @@ class Vector_3 : public R_::Kernel_base::Vector_3
typedef typename R_::Point_3 Point_3;
typedef typename R_::Direction_3 Direction_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef typename R_::Kernel_base::Vector_3 RVector_3;
public:
typedef RVector_3 Rep;
typedef typename R_::Kernel_base::Vector_3 Rep;
const Rep& rep() const
{
@ -58,29 +57,29 @@ public:
Vector_3() {}
Vector_3(const Rep& v)
: Rep(v) {}
Vector_3(const Point_3& a, const Point_3& b)
: RVector_3(a, b) {}
: Rep(typename R::Construct_vector_3()(a, b).rep()) {}
Vector_3(const Segment_3& s)
: RVector_3(s) {}
: Rep(typename R::Construct_vector_3()(s).rep()) {}
Vector_3(const Ray_3& r)
: RVector_3(r) {}
: Rep(typename R::Construct_vector_3()(r).rep()) {}
Vector_3(const Line_3& l)
: RVector_3(l) {}
Vector_3(const RVector_3& v)
: RVector_3(v) {}
: Rep(typename R::Construct_vector_3()(l).rep()) {}
Vector_3(const Null_vector& v)
: RVector_3(v) {}
: Rep(typename R::Construct_vector_3()(v).rep()) {}
Vector_3(const RT& x, const RT& y, const RT& z)
: RVector_3(x, y, z) {}
: Rep(typename R::Construct_vector_3()(x, y, z).rep()) {}
Vector_3(const RT& x, const RT& y, const RT& z, const RT& w)
: RVector_3(x, y, z, w) {}
: Rep(typename R::Construct_vector_3()(x, y, z, w).rep()) {}
Direction_3 direction() const
{
@ -189,6 +188,12 @@ public:
return cartesian(i);
}
typename Qualified_result_of<typename R::Compute_squared_length_3, Vector_3>::type
squared_length() const
{
return R().compute_squared_length_3_object()(*this);
}
};
#ifndef CGAL_NO_OSTREAM_INSERT_VECTOR_3
@ -196,8 +201,8 @@ template < class R >
std::ostream&
operator<<(std::ostream& os, const Vector_3<R>& v)
{
typedef typename R::Kernel_base::Vector_3 RVector_3;
return os << static_cast<const RVector_3&>(v);
typedef typename R::Kernel_base::Vector_3 Rep;
return os << static_cast<const Rep&>(v);
}
#endif // CGAL_NO_OSTREAM_INSERT_VECTOR_3
@ -206,8 +211,8 @@ template < class R >
std::istream&
operator>>(std::istream& is, Vector_3<R>& p)
{
typedef typename R::Kernel_base::Vector_3 RVector_3;
return is >> static_cast<RVector_3&>(p);
typedef typename R::Kernel_base::Vector_3 Rep;
return is >> static_cast<Rep&>(p);
}
#endif // CGAL_NO_ISTREAM_EXTRACT_VECTOR_3