mirror of https://github.com/CGAL/cgal
More code move to user classes.
This commit is contained in:
parent
a04f166f1f
commit
4408fa1c2a
|
|
@ -217,7 +217,7 @@ namespace CartesianKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Sphere_3& s, const Point_3& p) const
|
||||
{ return s.bounded_side(p); }
|
||||
{ return s.rep().bounded_side(p); }
|
||||
|
||||
result_type
|
||||
operator()( const Tetrahedron_3& t, const Point_3& p) const
|
||||
|
|
@ -930,7 +930,7 @@ namespace CartesianKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Sphere_3& s) const
|
||||
{ return s.squared_radius(); }
|
||||
{ return s.rep().squared_radius(); }
|
||||
|
||||
result_type
|
||||
operator()( const Point_3& p, const Point_3& q) const
|
||||
|
|
@ -2159,6 +2159,22 @@ namespace CartesianKernelFunctors {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_divided_vector_3
|
||||
{
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Vector_3 Vector_3;
|
||||
public:
|
||||
typedef Vector_3 result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
Vector_3
|
||||
operator()( const Vector_3& v, const FT& c) const
|
||||
{
|
||||
return Vector_3(v.x()/c, v.y()/c, v.z()/c);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_scaled_vector_3
|
||||
{
|
||||
|
|
@ -2580,7 +2596,7 @@ namespace CartesianKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Ray_3& r, const Point_3& p) const
|
||||
{ return r.has_on(p); }
|
||||
{ return r.rep().has_on(p); }
|
||||
|
||||
result_type
|
||||
operator()( const Segment_3& s, const Point_3& p) const
|
||||
|
|
@ -2873,6 +2889,7 @@ namespace CartesianKernelFunctors {
|
|||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Vector_3 Vector_3;
|
||||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
typedef typename K::Sphere_3 Sphere_3;
|
||||
public:
|
||||
typedef typename K::Orientation result_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
|
|
@ -2900,6 +2917,12 @@ namespace CartesianKernelFunctors {
|
|||
{
|
||||
return t.rep().orientation();
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()(const Sphere_3& s) const
|
||||
{
|
||||
return s.rep().orientation();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace HomogeneousKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Sphere_3& s, const Point_3& p) const
|
||||
{ return s.bounded_side(p); }
|
||||
{ return s.rep().bounded_side(p); }
|
||||
|
||||
result_type
|
||||
operator()( const Tetrahedron_3& t, const Point_3& p) const
|
||||
|
|
@ -1311,7 +1311,7 @@ namespace HomogeneousKernelFunctors {
|
|||
|
||||
FT
|
||||
operator()( const Sphere_3& s) const
|
||||
{ return s.squared_radius(); }
|
||||
{ return s.rep().squared_radius(); }
|
||||
|
||||
FT
|
||||
operator()( const Point_3& p, const Point_3& q) const
|
||||
|
|
@ -2186,6 +2186,30 @@ namespace HomogeneousKernelFunctors {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_divided_vector_3
|
||||
{
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::RT RT;
|
||||
typedef typename K::Vector_3 Vector_3;
|
||||
public:
|
||||
typedef Vector_3 result_type;
|
||||
typedef Arity_tag< 2 > Arity;
|
||||
|
||||
Vector_3
|
||||
operator()(const Vector_3& v, const FT& f ) const
|
||||
{
|
||||
return Vector_3( v.hx()*f.denominator(), v.hy()*f.denominator(),
|
||||
v.hz()*f.denominator(), v.hw()*f.numerator() );
|
||||
}
|
||||
|
||||
Vector_3
|
||||
operator()(const Vector_3& v, const RT& f ) const
|
||||
{
|
||||
return Vector_3( v.hx(), v.hy(), v.hz(), v.hw()*f );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename K>
|
||||
class Construct_iso_rectangle_2
|
||||
|
|
@ -3110,7 +3134,7 @@ namespace HomogeneousKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Ray_3& r, const Point_3& p) const
|
||||
{ return r.has_on(p); }
|
||||
{ return r.rep().has_on(p); }
|
||||
|
||||
result_type
|
||||
operator()( const Segment_3& s, const Point_3& p) const
|
||||
|
|
@ -3563,6 +3587,7 @@ namespace HomogeneousKernelFunctors {
|
|||
typedef typename K::Point_3 Point_3;
|
||||
typedef typename K::Vector_3 Vector_3;
|
||||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
typedef typename K::Sphere_3 Sphere_3;
|
||||
public:
|
||||
typedef typename K::Orientation result_type;
|
||||
typedef Arity_tag< 4 > Arity;
|
||||
|
|
@ -3593,6 +3618,12 @@ namespace HomogeneousKernelFunctors {
|
|||
{
|
||||
return t.rep().orientation();
|
||||
}
|
||||
|
||||
result_type
|
||||
operator()(const Sphere_3& s) const
|
||||
{
|
||||
return s.rep().orientation();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ public:
|
|||
Circle_2
|
||||
opposite() const
|
||||
{
|
||||
//return R().construct_opposite_circle_2_object()(*this);
|
||||
return Circle_2(center(),
|
||||
squared_radius(),
|
||||
CGAL::opposite(orientation()) );
|
||||
|
|
|
|||
|
|
@ -896,7 +896,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
Sphere_3
|
||||
operator()( const Sphere_3& s) const
|
||||
{ return s.opposite(); }
|
||||
{ return s.rep().opposite(); }
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
|
|
@ -1032,7 +1032,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
Point_3
|
||||
operator()( const Ray_3& r, int i) const
|
||||
{ return r.point(i); }
|
||||
{ return r.rep().point(i); }
|
||||
|
||||
Point_3
|
||||
operator()( const Plane_3& p) const
|
||||
|
|
@ -1192,6 +1192,25 @@ namespace CommonKernelFunctors {
|
|||
{ return r.rep().source(); }
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_source_3 : Has_qrt
|
||||
{
|
||||
typedef typename K::Segment_3 Segment_3;
|
||||
typedef typename K::Ray_3 Ray_3;
|
||||
typedef typename K::Point_3 Point_3;
|
||||
public:
|
||||
typedef Point_3 result_type;
|
||||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
const result_type&
|
||||
operator()(const Segment_3& s) const
|
||||
{ return s.rep().source(); }
|
||||
|
||||
const result_type&
|
||||
operator()(const Ray_3& r) const
|
||||
{ return r.rep().source(); }
|
||||
};
|
||||
|
||||
|
||||
template <typename K>
|
||||
class Construct_target_2 : Has_qrt
|
||||
|
|
@ -1221,6 +1240,20 @@ namespace CommonKernelFunctors {
|
|||
{ return r.rep().second_point(); }
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_second_point_3 // : Has_qrt
|
||||
{
|
||||
typedef typename K::Ray_3 Ray_3;
|
||||
typedef typename K::Point_3 Point_3;
|
||||
public:
|
||||
typedef Point_3 result_type;
|
||||
typedef Arity_tag< 1 > Arity;
|
||||
|
||||
result_type // const result_type& // Homogeneous...
|
||||
operator()(const Ray_3& r) const
|
||||
{ return r.rep().second_point(); }
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_sphere_3
|
||||
{
|
||||
|
|
@ -1289,7 +1322,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
Line_3
|
||||
operator()( const Ray_3& r) const
|
||||
{ return r.supporting_line(); }
|
||||
{ return r.rep().supporting_line(); }
|
||||
|
||||
Line_3
|
||||
operator()( const Segment_3& s) const
|
||||
|
|
@ -1763,7 +1796,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Sphere_3& s, const Point_3& p) const
|
||||
{ return s.has_on_boundary(p); }
|
||||
{ return s.rep().has_on_boundary(p); }
|
||||
|
||||
result_type
|
||||
operator()( const Tetrahedron_3& t, const Point_3& p) const
|
||||
|
|
@ -2054,7 +2087,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Ray_2& r) const
|
||||
{ return r.is_degenerate(); }
|
||||
{ return r.rep().is_degenerate(); }
|
||||
|
||||
result_type
|
||||
operator()( const Segment_2& s) const
|
||||
|
|
@ -2094,7 +2127,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Ray_3& r) const
|
||||
{ return r.is_degenerate(); }
|
||||
{ return r.rep().is_degenerate(); }
|
||||
|
||||
result_type
|
||||
operator()( const Segment_3& s) const
|
||||
|
|
@ -2102,7 +2135,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Sphere_3& s) const
|
||||
{ return s.is_degenerate(); }
|
||||
{ return s.rep().is_degenerate(); }
|
||||
|
||||
result_type
|
||||
operator()( const Triangle_3& t) const
|
||||
|
|
@ -2227,7 +2260,7 @@ namespace CommonKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Sphere_3& s, const Point_3& p) const
|
||||
{ return s.oriented_side(p); }
|
||||
{ return s.rep().oriented_side(p); }
|
||||
|
||||
result_type
|
||||
operator()( const Plane_3& pl, const Point_3& p) const
|
||||
|
|
|
|||
|
|
@ -285,16 +285,22 @@ CGAL_Kernel_cons(Construct_scaled_vector_2,
|
|||
construct_scaled_vector_2_object)
|
||||
CGAL_Kernel_cons(Construct_divided_vector_2,
|
||||
construct_divided_vector_2_object)
|
||||
CGAL_Kernel_cons(Construct_divided_vector_3,
|
||||
construct_divided_vector_3_object)
|
||||
CGAL_Kernel_cons(Construct_scaled_vector_3,
|
||||
construct_scaled_vector_3_object)
|
||||
CGAL_Kernel_cons(Construct_second_point_2,
|
||||
construct_second_point_2_object)
|
||||
CGAL_Kernel_cons(Construct_second_point_3,
|
||||
construct_second_point_3_object)
|
||||
CGAL_Kernel_cons(Construct_segment_2,
|
||||
construct_segment_2_object)
|
||||
CGAL_Kernel_cons(Construct_source_2,
|
||||
construct_source_2_object)
|
||||
CGAL_Kernel_cons(Construct_segment_3,
|
||||
construct_segment_3_object)
|
||||
CGAL_Kernel_cons(Construct_source_2,
|
||||
construct_source_2_object)
|
||||
CGAL_Kernel_cons(Construct_source_3,
|
||||
construct_source_3_object)
|
||||
CGAL_Kernel_cons(Construct_sphere_3,
|
||||
construct_sphere_3_object)
|
||||
#ifndef CGAL_NO_DEPRECATED_CODE
|
||||
|
|
|
|||
|
|
@ -72,13 +72,13 @@ public:
|
|||
: RRay_2(typename R::Construct_ray_2()(sp, l).rep()) {}
|
||||
|
||||
|
||||
typename Qualified_result_of<typename R_::Construct_source_2, Ray_2, int >::type
|
||||
typename Qualified_result_of<typename R_::Construct_source_2, Ray_2>::type
|
||||
source() const
|
||||
{
|
||||
return R().construct_source_2_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R_::Construct_second_point_2, Ray_2, int >::type
|
||||
typename Qualified_result_of<typename R_::Construct_second_point_2, Ray_2>::type
|
||||
second_point() const
|
||||
{
|
||||
return R().construct_second_point_2_object()(*this);
|
||||
|
|
@ -108,8 +108,6 @@ public:
|
|||
return source();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool is_horizontal() const
|
||||
{
|
||||
return R().equal_y_2_object()(source(), second_point());
|
||||
|
|
|
|||
|
|
@ -76,6 +76,77 @@ public:
|
|||
// NB : Homogeneous used direction() instead of second_point().
|
||||
}
|
||||
|
||||
/*
|
||||
const Point_3 & start() const;
|
||||
const Point_3 & source() const
|
||||
{
|
||||
return get(base).e0;
|
||||
}
|
||||
|
||||
Direction_3 direction() const;
|
||||
Vector_3 to_vector() const;
|
||||
Line_3 supporting_line() const;
|
||||
Ray_3 opposite() const;
|
||||
|
||||
bool is_degenerate() const;
|
||||
bool collinear_has_on(const Point_3 &p) const;
|
||||
*/
|
||||
|
||||
Point_3 point(int i) const // TODO : use Qrt
|
||||
{
|
||||
return R().construct_point_on_3_object()(*this, i);
|
||||
}
|
||||
|
||||
// FIXME : Use Qrt
|
||||
//typename Qualified_result_of<typename R_::Construct_source_3, Ray_3 >::type
|
||||
Point_3
|
||||
source() const
|
||||
{
|
||||
return R().construct_source_3_object()(*this);
|
||||
}
|
||||
|
||||
Point_3 second_point() const // TODO : use Qrt
|
||||
{
|
||||
return R().construct_second_point_3_object()(*this);
|
||||
}
|
||||
|
||||
bool has_on(const Point_3 &p) const
|
||||
{
|
||||
return R().has_on_3_object()(*this, p);
|
||||
}
|
||||
|
||||
Direction_3
|
||||
direction() const
|
||||
{
|
||||
typename R::Construct_vector_3 construct_vector;
|
||||
typename R::Construct_direction_3 construct_direction;
|
||||
return construct_direction( construct_vector(source(), second_point()) );
|
||||
}
|
||||
|
||||
Ray_3
|
||||
opposite() const
|
||||
{
|
||||
return Ray_3( source(), - direction() );
|
||||
}
|
||||
|
||||
Vector_3
|
||||
to_vector() const
|
||||
{
|
||||
typename R::Construct_vector_3 construct_vector;
|
||||
return construct_vector(source(), second_point());
|
||||
}
|
||||
|
||||
Line_3
|
||||
supporting_line() const
|
||||
{
|
||||
return R().construct_line_3_object()(source(), second_point());
|
||||
}
|
||||
|
||||
bool is_degenerate() const
|
||||
{
|
||||
return R().is_degenerate_3_object()(*this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#ifndef CGAL_NO_OSTREAM_INSERT_RAY_3
|
||||
|
|
|
|||
|
|
@ -83,6 +83,78 @@ public:
|
|||
return R().construct_center_3_object()(*this);
|
||||
}
|
||||
|
||||
FT
|
||||
squared_radius() const
|
||||
{
|
||||
return R().compute_squared_radius_3_object()(*this);
|
||||
}
|
||||
|
||||
// Returns a circle with opposite orientation
|
||||
Sphere_3 opposite() const
|
||||
{
|
||||
return R().construct_opposite_sphere_3_object()(*this);
|
||||
}
|
||||
|
||||
Orientation orientation() const
|
||||
{
|
||||
return R().orientation_3_object()(*this);
|
||||
}
|
||||
|
||||
Bounded_side
|
||||
bounded_side(const Point_3 &p) const
|
||||
{
|
||||
return R().bounded_side_3_object()(*this, p);
|
||||
}
|
||||
|
||||
Oriented_side
|
||||
oriented_side(const Point_3 &p) const
|
||||
{
|
||||
return R().oriented_side_3_object()(*this, p);
|
||||
}
|
||||
|
||||
bool
|
||||
has_on_boundary(const Point_3 &p) const
|
||||
{
|
||||
return R().has_on_boundary_3_object()(*this, p);
|
||||
//return bounded_side(p) == ON_BOUNDARY;
|
||||
}
|
||||
|
||||
bool
|
||||
has_on_bounded_side(const Point_3 &p) const
|
||||
{
|
||||
return bounded_side(p) == ON_BOUNDED_SIDE;
|
||||
}
|
||||
|
||||
bool
|
||||
has_on_unbounded_side(const Point_3 &p) const
|
||||
{
|
||||
return bounded_side(p) == ON_UNBOUNDED_SIDE;
|
||||
}
|
||||
|
||||
bool
|
||||
has_on_negative_side(const Point_3 &p) const
|
||||
{
|
||||
if (orientation() == COUNTERCLOCKWISE)
|
||||
return has_on_unbounded_side(p);
|
||||
return has_on_bounded_side(p);
|
||||
}
|
||||
|
||||
bool
|
||||
has_on_positive_side(const Point_3 &p) const
|
||||
{
|
||||
if (orientation() == COUNTERCLOCKWISE)
|
||||
return has_on_bounded_side(p);
|
||||
return has_on_unbounded_side(p);
|
||||
}
|
||||
|
||||
bool
|
||||
is_degenerate() const
|
||||
{
|
||||
return R().is_degenerate_3_object()(*this);
|
||||
//return CGAL_NTS is_zero(squared_radius());
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
template <class R_>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ template <class R_>
|
|||
class Vector_3 : public R_::Kernel_base::Vector_3
|
||||
{
|
||||
typedef typename R_::RT RT;
|
||||
typedef typename R_::FT FT;
|
||||
typedef typename R_::Segment_3 Segment_3;
|
||||
typedef typename R_::Ray_3 Ray_3;
|
||||
typedef typename R_::Line_3 Line_3;
|
||||
|
|
@ -91,6 +92,16 @@ public:
|
|||
return t.transform(*this);
|
||||
}
|
||||
|
||||
Vector_3 operator/(const RT& c) const
|
||||
{
|
||||
return R().construct_divided_vector_3_object()(*this,c);
|
||||
}
|
||||
|
||||
Vector_3 operator/(const typename First_if_different<FT,RT>::Type & c) const
|
||||
{
|
||||
return R().construct_divided_vector_3_object()(*this,c);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#ifndef CGAL_NO_OSTREAM_INSERT_VECTOR_3
|
||||
|
|
|
|||
Loading…
Reference in New Issue