Cleanup. The 2D and 3D triangulation testsuite pass

This commit is contained in:
Andreas Fabri 2016-04-06 12:30:35 +02:00 committed by Jane Tournois
parent c2ee0ae9a8
commit ea50fb811d
15 changed files with 282 additions and 178 deletions

View File

@ -23,36 +23,34 @@
#define CGAL_CARTESIAN_WEIGHTED_POINT_2_H
#include <iostream>
#include <CGAL/Kernel_traits.h>
#include <CGAL/Dimension.h>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/logical.hpp>
#include <boost/tuple/tuple.hpp>
namespace CGAL {
template < class R_ >
class Weighted_pointC2 : public R_::Point_2
class Weighted_pointC2
{
typedef typename R_::Point_2 Point_2;
typedef typename R_::FT FT;
typedef typename R_::FT Weight;
typedef boost::tuple<Point_2, Weight> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
public:
typedef FT Weight;
typedef typename R_::Point_2 Point;
Weighted_pointC2 ()
: Point(), _weight(0) {}
{}
//explicit
Weighted_pointC2 (const Point &p)
: Point(p), _weight(0)
{
// CGAL_error_msg( "Warning : truncated weight !!!");
}
Weighted_pointC2 (const Point_2 &p)
: base(p,0)
{}
Weighted_pointC2 (const Point &p, const Weight &w)
: Point(p), _weight(w) {}
Weighted_pointC2 (const Point_2 &p, const Weight &w)
: base(p,w)
{}
// Constructors from coordinates are also provided for convenience, except
@ -60,29 +58,22 @@ public:
// to avoid any potential ambiguity between the homogeneous weight and the
// power weight (it should be easy enough to pass a Point explicitly in those
// cases).
// The enable_if complexity comes from the fact that we separate dimension 2 and 3.
Weighted_pointC2(const FT& x, const FT& y)
: base(Point_2(x,y),0)
{}
template < typename Tx, typename Ty>
Weighted_pointC2 (const Tx &x, const Ty &y,
typename boost::enable_if< boost::mpl::and_<boost::is_convertible<Tx, FT>,
boost::is_convertible<Ty, FT>,
boost::mpl::bool_<CGAL::Ambient_dimension<Point>::value == 2> > >::type* = 0)
: Point(x, y), _weight(0) {}
const Point & point() const
const Point_2 & point() const
{
return *this;
return get_pointee_or_identity(base).template get<0>();
}
const Weight & weight() const
{
return _weight;
return get_pointee_or_identity(base).template get<1>();
}
private:
Weight _weight;
};

View File

@ -23,68 +23,61 @@
#define CGAL_CARTESIAN_WEIGHTED_POINT_3_H
#include <iostream>
#include <CGAL/Kernel_traits.h>
#include <CGAL/Dimension.h>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/logical.hpp>
#include <boost/tuple/tuple.hpp>
namespace CGAL {
template < class R_ >
class Weighted_pointC3 : public R_::Point_3
class Weighted_pointC3
{
typedef typename R_::Point_3 Point_3;
typedef typename R_::FT FT;
typedef typename R_::RT RT;
typedef FT Weight;
typedef boost::tuple<Point_3, Weight> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
public:
typedef RT Weight;
typedef typename R_::Point_3 Point;
Weighted_pointC3 ()
: Point(), _weight(0) {}
{}
//explicit
Weighted_pointC3 (const Point &p)
: Point(p), _weight(0)
{
// CGAL_error_msg( "Warning : truncated weight !!!");
}
Weighted_pointC3 (const Point_3 &p)
: base(p,0)
{}
Weighted_pointC3 (const Point &p, const Weight &w)
: Point(p), _weight(w) {}
Weighted_pointC3 (const Point_3 &p, const Weight &w)
: base(p,w)
{}
// Constructors from coordinates are also provided for convenience, except
// that they are only from Cartesian coordinates, and with no weight, so as
// to avoid any potential ambiguity between the homogeneous weight and the
// power weight (it should be easy enough to pass a Point explicitly in those
// power weight (it should be easy enough to pass a Point_3 explicitly in those
// cases).
// The enable_if complexity comes from the fact that we separate dimension 2 and 3.
template < typename Tx, typename Ty, typename Tz >
Weighted_pointC3 (const Tx &x, const Ty &y, const Tz &z,
typename boost::enable_if< boost::mpl::and_<boost::is_convertible<Tx, FT>,
boost::is_convertible<Ty, FT>,
boost::is_convertible<Tz, FT>,
boost::mpl::bool_<CGAL::Ambient_dimension<Point>::value == 3> > >::type* = 0)
: Point(x, y, z), _weight(0) {}
const Point & point() const
Weighted_pointC3 (const FT &x, const FT &y, const FT &z)
: base(Point_3(x, y, z), 0)
{}
const Point_3 & point() const
{
return *this;
return get_pointee_or_identity(base).template get<0>();
}
const Weight & weight() const
{
return _weight;
return get_pointee_or_identity(base).template get<1>();
}
private:
Weight _weight;
};
@ -101,7 +94,7 @@ operator<<(std::ostream &os, const Weighted_pointC3<R_> &p)
write(os, p.weight());
return os;
default:
return os << "Weighted_point(" << p.point() << ", " << p.weight() << ")";
return os << "Weighted_point_3(" << p.point() << ", " << p.weight() << ")";
}
}
@ -110,7 +103,7 @@ std::istream &
operator>>(std::istream &is, Weighted_pointC3<R_> &wp)
{
typename Weighted_pointC3<R_>::Weight w;
typename Weighted_pointC3<R_>::Point p;
typename Weighted_pointC3<R_>::Point_3 p;
is >> p;
if(!is) return is;
if(is_ascii(is))

View File

@ -2921,7 +2921,16 @@ namespace CartesianKernelFunctors {
typedef typename K::Line_2 Line_2;
typedef typename Point_2::Rep Rep;
public:
typedef Point_2 result_type;
template<typename>
struct result {
typedef Point_2 type;
};
template<typename F>
struct result<F(Weighted_point_2)> {
typedef const Point_2& type;
};
Rep // Point_2
operator()(Return_base_tag, Origin o) const
@ -2977,8 +2986,19 @@ namespace CartesianKernelFunctors {
typedef typename K::Point_3 Point_3;
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename Point_3::Rep Rep;
public:
typedef Point_3 result_type;
template<typename>
struct result {
typedef Point_3 type;
};
template<typename F>
struct result<F(Weighted_point_3)> {
typedef const Point_3& type;
};
Rep // Point_3
operator()(Return_base_tag, Origin o) const
@ -3033,6 +3053,7 @@ namespace CartesianKernelFunctors {
class Construct_weighted_point_3
{
typedef typename K::RT RT;
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename Weighted_point_3::Rep Rep;
@ -3044,7 +3065,7 @@ namespace CartesianKernelFunctors {
{ return Rep(p,w); }
Rep
operator()(Return_base_tag, const RT& x, const RT& y, const RT& z) const
operator()(Return_base_tag, const FT& x, const FT& y, const FT& z) const
{ return Rep(x,y,z); }
};
@ -4115,7 +4136,7 @@ public:
{
//CGAL_kernel_precondition( collinear(p, q, r) );
//CGAL_kernel_precondition( p.point() != q.point() );
return power_testC2(p.x(), p.y(), p.weight(),
return power_testC2(p.point().x(), p.y(), p.weight(),
q.x(), q.y(), q.weight(),
t.x(), t.y(), t.weight());
}

View File

@ -681,6 +681,7 @@ power_testC2( const FT &px, const FT &py, const FT &pwt,
const FT &qx, const FT &qy, const FT &qwt,
const FT &tx, const FT &ty, const FT &twt)
{
std::cerr << px << " " << py << " " << pwt << std::endl;
// Same translation as above.
FT dpx = px - tx;
FT dpy = py - ty;

View File

@ -307,6 +307,35 @@ squared_distance(const Point_3<K> & pt1,
}
template <class K>
inline
typename K::FT
squared_distance(const Weighted_point_3<K> & pt1,
const Weighted_point_3<K> & pt2)
{
return internal::squared_distance(pt1.point(),pt2.point(), K());
}
template <class K>
inline
typename K::FT
squared_distance(const Weighted_point_3<K> & pt1,
const Point_3<K> & pt2)
{
return internal::squared_distance(pt1.point(),pt2, K());
}
template <class K>
inline
typename K::FT
squared_distance(const Point_3<K> & pt1,
const Weighted_point_3<K> & pt2)
{
return internal::squared_distance(pt1,pt2.point(), K());
}
template <class K>
inline
typename K::FT

View File

@ -34,60 +34,58 @@
namespace CGAL {
template < class R_ >
class Weighted_pointH3 : public R_::Point_3
class Weighted_pointH3
{
typedef typename R_::RT RT;
typedef typename R_::Point_3 Point_3;
typedef typename R_::FT FT;
typedef FT Weight;
typedef boost::tuple<Point_3, Weight> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
public:
typedef RT Weight;
typedef typename R_::Point_3 Point;
Weighted_pointH3 ()
: Point(), _weight(0) {}
{}
//explicit
Weighted_pointH3 (const Point &p)
: Point(p), _weight(0)
{
// CGAL_error_msg( "Warning : truncated weight !!!");
}
Weighted_pointH3 (const Point_3 &p)
: base(p,0)
{}
Weighted_pointH3 (const Point &p, const Weight &w)
: Point(p), _weight(w) {}
Weighted_pointH3 (const Point_3 &p, const Weight &w)
: base(p,w)
{}
// Constructors from coordinates are also provided for convenience, except
// that they are only from Homogeneous coordinates, and with no weight, so as
// that they are only from Cartesian coordinates, and with no weight, so as
// to avoid any potential ambiguity between the homogeneous weight and the
// power weight (it should be easy enough to pass a Point explicitly in those
// power weight (it should be easy enough to pass a Point_3 explicitly in those
// cases).
// The enable_if complexity comes from the fact that we separate dimension 2 and 3.
template < typename Tx, typename Ty, typename Tz >
Weighted_pointH3 (const Tx &x, const Ty &y, const Tz &z,
typename boost::enable_if< boost::mpl::and_<boost::is_convertible<Tx, FT>,
boost::is_convertible<Ty, FT>,
boost::is_convertible<Tz, FT>,
boost::mpl::bool_<CGAL::Ambient_dimension<Point>::value == 3> > >::type* = 0)
: Point(x, y, z), _weight(0) {}
const Point & point() const
Weighted_pointH3 (const FT &x, const FT &y, const FT &z)
: base(Point_3(x, y, z), 0)
{}
const Point_3 & point() const
{
return *this;
return get_pointee_or_identity(base).template get<0>();
}
const Weight & weight() const
{
return _weight;
return get_pointee_or_identity(base).template get<1>();
}
private:
Weight _weight;
};
template < class R_ >
std::ostream &
operator<<(std::ostream &os, const Weighted_pointH3<R_> &p)

View File

@ -3054,7 +3054,16 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Line_2 Line_2;
typedef typename Point_2::Rep Rep;
public:
typedef Point_2 result_type;
template<typename>
struct result {
typedef Point_2 type;
};
template<typename F>
struct result<F(Weighted_point_2)> {
typedef const Point_2& type;
};
Rep // Point_2
operator()(Return_base_tag, Origin o) const
@ -3117,8 +3126,18 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Point_3 Point_3;
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename Point_3::Rep Rep;
public:
typedef Point_3 result_type;
template<typename>
struct result {
typedef Point_3 type;
};
template<typename F>
struct result<F(Weighted_point_3)> {
typedef const Point_3& type;
};
Rep // Point_3
operator()(Return_base_tag, Origin o) const

View File

@ -479,7 +479,7 @@ class Compute_weight_2
{
public:
typedef typename K::Weighted_point_2 Weighted_point_2;
typedef typename Weighted_point_2::Weight Weight;
typedef typename K::FT Weight;
typedef const Weight& result_type;
@ -496,7 +496,7 @@ class Compute_weight_3
{
public:
typedef typename K::Weighted_point_3 Weighted_point_3;
typedef typename Weighted_point_3::Weight Weight;
typedef typename K::FT Weight;
typedef const Weight& result_type;
@ -3464,7 +3464,7 @@ public:
const Weighted_point_2 & q,
const Weighted_point_2 & r) const
{
CGAL_kernel_precondition( ! collinear(p, q, r) );
CGAL_kernel_precondition( ! collinear(p.point(), q.point(), r.point()) );
FT x,y;
weighted_circumcenterC2(p.x(),p.y(),p.weight(),
q.x(),q.y(),q.weight(),

View File

@ -91,14 +91,8 @@ public:
Weighted_point_2(const FT& x, const FT& y)
: Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y))
{}
/*
template < typename T1, typename T2>
Weighted_point_2(const T1& x, const T2& y)
: Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y))
{}
*/
typename cpp11::result_of<typename R::Construct_point_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Construct_point_2( Weighted_point_2)>::type
point() const
{
return typename R::Construct_point_2()(*this);
@ -111,37 +105,37 @@ public:
}
typename cpp11::result_of<typename R::Compute_x_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_x_2( Point_2)>::type
x() const
{
return typename R::Compute_x_2()(*this);
return typename R::Compute_x_2()(point());
}
typename cpp11::result_of<typename R::Compute_y_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_y_2( Point_2)>::type
y() const
{
return typename R::Compute_y_2()(*this);
return typename R::Compute_y_2()(point());
}
typename cpp11::result_of<typename R::Compute_hx_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_hx_2( Point_2)>::type
hx() const
{
return R().compute_hx_2_object()(*this);
return R().compute_hx_2_object()(point());
}
typename cpp11::result_of<typename R::Compute_hy_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_hy_2( Point_2)>::type
hy() const
{
return R().compute_hy_2_object()(*this);
return R().compute_hy_2_object()(point());
}
typename cpp11::result_of<typename R::Compute_hw_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_hw_2( Point_2)>::type
hw() const
{
return R().compute_hw_2_object()(*this);
return R().compute_hw_2_object()(point());
}
typename cpp11::result_of<typename R::Compute_x_2( Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_x_2( Point_2)>::type
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) );
@ -158,7 +152,7 @@ public:
return hz();
}
typename cpp11::result_of<typename R::Compute_x_2(Weighted_point_2)>::type
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
operator[](int i) const
{
return cartesian(i);
@ -166,12 +160,12 @@ public:
Cartesian_const_iterator cartesian_begin() const
{
return typename R::Construct_cartesian_const_iterator_2()(*this);
return typename R::Construct_cartesian_const_iterator_2()(point());
}
Cartesian_const_iterator cartesian_end() const
{
return typename R::Construct_cartesian_const_iterator_2()(*this,3);
return typename R::Construct_cartesian_const_iterator_2()(point(),3);
}
int dimension() const
@ -181,12 +175,12 @@ public:
Bbox_2 bbox() const
{
return R().construct_bbox_2_object()(*this);
return R().construct_bbox_2_object()(point());
}
Weighted_point_2 transform(const Aff_transformation_2 &t) const
{
return t.transform(*this);
return Weighted_point_2(t.transform(point(),weight()));
}
};
@ -204,6 +198,25 @@ operator!=(const Origin& o, const Weighted_point_2<R>& p)
{ return p != o; }
template <class R>
inline
bool
operator==(const Point_2<R>& bp, const Weighted_point_2<R>& p)
{ return bp == p.point(); }
template <class R>
inline
bool
operator==(const Weighted_point_2<R>& p, const Point_2<R>& bp)
{ return bp == p.point(); }
template <class R>
inline
bool
operator==(const Weighted_point_2<R>& p, const Weighted_point_2<R>& p2)
{ return p.point() == p2.point(); }
template <class R>
inline
bool

View File

@ -39,6 +39,7 @@ template <class R_>
class Weighted_point_3 : public R_::Kernel_base::Weighted_point_3
{
typedef typename R_::RT RT;
typedef typename R_::FT FT;
typedef Weighted_point_3 Self;
CGAL_static_assertion((boost::is_same<Self, typename R_::Weighted_point_3>::value));
@ -55,7 +56,7 @@ public:
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
typedef Point_3 Point;
typedef RT Weight;
typedef FT Weight;
const Rep& rep() const
{
@ -82,23 +83,13 @@ public:
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), p, 0))
{}
template <typename T2>
Weighted_point_3(const Point_3& p, const T2& w)
Weighted_point_3(const Point_3& p, const Weight& w)
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), p, w))
{}
/*
template < typename T1, typename T2>
Weighted_point_3(const T1& x, const T2& y)
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y))
{}
*/
template < typename T1, typename T2, typename T3 >
Weighted_point_3(const T1& x, const T2& y, const T3& z)
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z))
{}
Weighted_point_3(const RT& hx, const RT& hy, const RT& hz, const RT& hw)
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), hx, hy, hz, hw))
Weighted_point_3(const FT& x, const FT& y, const FT& z)
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z))
{}
typename cpp11::result_of<typename R::Construct_point_3( Weighted_point_3)>::type
@ -117,43 +108,43 @@ public:
typename cpp11::result_of<typename R::Compute_x_3( Weighted_point_3)>::type
x() const
{
return typename R::Compute_x_3()(*this);
return typename R::Compute_x_3()(point());
}
typename cpp11::result_of<typename R::Compute_y_3( Weighted_point_3)>::type
y() const
{
return typename R::Compute_y_3()(*this);
return typename R::Compute_y_3()(point());
}
typename cpp11::result_of<typename R::Compute_z_3( Weighted_point_3)>::type
z() const
{
return typename R::Compute_z_3()(*this);
return typename R::Compute_z_3()(point());
}
typename cpp11::result_of<typename R::Compute_hx_3( Weighted_point_3)>::type
hx() const
{
return R().compute_hx_3_object()(*this);
return R().compute_hx_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_hy_3( Weighted_point_3)>::type
hy() const
{
return R().compute_hy_3_object()(*this);
return R().compute_hy_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_hz_3( Weighted_point_3)>::type
hz() const
{
return R().compute_hz_3_object()(*this);
return R().compute_hz_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_hw_3( Weighted_point_3)>::type
hw() const
{
return R().compute_hw_3_object()(*this);
return R().compute_hw_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_x_3( Weighted_point_3)>::type
@ -183,12 +174,12 @@ public:
Cartesian_const_iterator cartesian_begin() const
{
return typename R::Construct_cartesian_const_iterator_3()(*this);
return typename R::Construct_cartesian_const_iterator_3()(point());
}
Cartesian_const_iterator cartesian_end() const
{
return typename R::Construct_cartesian_const_iterator_3()(*this,3);
return typename R::Construct_cartesian_const_iterator_3()(point(),3);
}
int dimension() const
@ -198,12 +189,12 @@ public:
Bbox_3 bbox() const
{
return R().construct_bbox_3_object()(*this);
return R().construct_bbox_3_object()(point());
}
Weighted_point_3 transform(const Aff_transformation_3 &t) const
{
return t.transform(*this);
return Weighted_point_3(t.transform(point(),weight()));
}
};
@ -220,6 +211,24 @@ bool
operator!=(const Origin& o, const Weighted_point_3<R>& p)
{ return p != o; }
template <class R>
inline
bool
operator==(const Point_3<R>& bp, const Weighted_point_3<R>& p)
{ return bp == p.point(); }
template <class R>
inline
bool
operator==(const Weighted_point_3<R>& p, const Point_3<R>& bp)
{ return bp == p.point(); }
template <class R>
inline
bool
operator==(const Weighted_point_3<R>& p, const Weighted_point_3<R>& p2)
{ return p.point() == p2.point(); }
template <class R>
inline
@ -234,15 +243,16 @@ insert(std::ostream& os, const Weighted_point_3<R>& p,const Cartesian_tag&)
{
switch(get_mode(os)) {
case IO::ASCII :
return os << p.x() << ' ' << p.y() << ' ' << p.z();
return os << p.point() << ' ' << p.weight();
case IO::BINARY :
write(os, p.x());
write(os, p.y());
write(os, p.z());
write(os, p.weight());
return os;
default:
return os << "PointC3(" << p.x() << ", " << p.y()
<< ", " << p.z() << ')';
return os << "Weighted_pointC3(" << p.x() << ", " << p.y()
<< ", " << p.z() << p.weight() << ')';
}
}
@ -253,18 +263,20 @@ insert(std::ostream& os, const Weighted_point_3<R>& p,const Homogeneous_tag&)
switch(get_mode(os))
{
case IO::ASCII :
return os << p.hx() << ' ' << p.hy() << ' ' << p.hz() << ' ' << p.hw();
return os << p.hx() << ' ' << p.hy() << ' ' << p.hz() << ' ' << p.hw() << ' ' << p.weight();
case IO::BINARY :
write(os, p.hx());
write(os, p.hy());
write(os, p.hz());
write(os, p.hw());
write(os, p.hw())
; write(os, p.weight());
return os;
default:
return os << "PointH3(" << p.hx() << ", "
return os << "Weighted_pointH3(" << p.hx() << ", "
<< p.hy() << ", "
<< p.hz() << ", "
<< p.hw() << ')';
<< p.hw() << ", "
<< p.weight() << ')';
}
}
@ -280,15 +292,16 @@ template <class R >
std::istream&
extract(std::istream& is, Weighted_point_3<R>& p, const Cartesian_tag&)
{
typename R::FT x, y, z;
typename R::FT x, y, z, weight;
switch(get_mode(is)) {
case IO::ASCII :
is >> iformat(x) >> iformat(y) >> iformat(z);
is >> iformat(x) >> iformat(y) >> iformat(z) >> iformat(weight);
break;
case IO::BINARY :
read(is, x);
read(is, y);
read(is, z);
read(is, weight);
break;
default:
std::cerr << "" << std::endl;
@ -296,7 +309,7 @@ extract(std::istream& is, Weighted_point_3<R>& p, const Cartesian_tag&)
break;
}
if (is)
p = Weighted_point_3<R>(x, y, z);
p = Weighted_point_3<R>(Point_3<R>(x, y,z), z);
return is;
}
@ -306,16 +319,18 @@ std::istream&
extract(std::istream& is, Weighted_point_3<R>& p, const Homogeneous_tag&)
{
typename R::RT hx, hy, hz, hw;
typename R::FT weight;
switch(get_mode(is))
{
case IO::ASCII :
is >> hx >> hy >> hz >> hw;
is >> hx >> hy >> hz >> hw >> weight;
break;
case IO::BINARY :
read(is, hx);
read(is, hy);
read(is, hz);
read(is, hw);
read(is, weight);
break;
default:
std::cerr << "" << std::endl;
@ -323,7 +338,7 @@ extract(std::istream& is, Weighted_point_3<R>& p, const Homogeneous_tag&)
break;
}
if (is)
p = Weighted_point_3<R>(hx, hy, hz, hw);
p = Weighted_point_3<R>(Point_3<R>(hx, hy, hz), hw);
return is;
}

View File

@ -157,6 +157,10 @@ _test_cls_regular_triangulation_2( const Triangulation & )
}
Cls T;
std::cerr << wp1 << " " << wp1.x() << std::endl;
std::cerr << wp2 << std::endl;
std::cerr << wp3 << std::endl;
assert(T.power_test(wp1,wp2,wp3) == CGAL::ON_NEGATIVE_SIDE);
assert(T.power_test(wp1,wp8,wp2) == CGAL::ON_POSITIVE_SIDE);
assert(T.power_test(wp2,wp8,wp9) == CGAL::ON_NEGATIVE_SIDE);

View File

@ -27,10 +27,24 @@
#include <CGAL/Regular_triangulation_2.h>
#include <CGAL/_test_cls_regular_triangulation_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#if 0
typedef CGAL::Simple_cartesian<CGAL::Interval_nt<> > K;
int main()
{
K::Weighted_point_2 wp(K::Point_2(7.8, 1),2);
std::cout << wp << std::endl;
std::cout << wp.x() << std::endl;
std::cout << K::Compute_x_2()(wp.point()) << std::endl;
return 0;
}
#else
typedef CGAL::Regular_triangulation_euclidean_traits_2
<CGAL::Exact_predicates_inexact_constructions_kernel> RGt;
<CGAL::Exact_predicates_exact_constructions_kernel> RGt;
// Explicit instantiation of the whole class :
template class CGAL::Regular_triangulation_2<RGt>;
@ -57,3 +71,4 @@ int main()
std::cout << "done" << std::endl;
return 0;
}
#endif

View File

@ -8,7 +8,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Regular_triangulation_euclidean_traits_3<K> Traits;
typedef Traits::RT Weight;
typedef Traits::FT Weight;
typedef Traits::Bare_point Point;
typedef Traits::Weighted_point Weighted_point;

View File

@ -6135,7 +6135,7 @@ _remove_cluster_3D(InputIterator first, InputIterator beyond, VertexRemover &rem
mp_vps[vv->point()] = vv;
} else inf = true;
}
spatial_sort(vps.begin(), vps.end());
spatial_sort(vps.begin(), vps.end(),geom_traits());
std::size_t svps = vps.size();

View File

@ -35,6 +35,7 @@
#include <CGAL/Random.h>
#include <CGAL/Testsuite/use.h>
// Accessory set of functions to differentiate between
// Delaunay::nearest_vertex[_in_cell] and
// Regular::nearest_power_vertex[_in_cell].
@ -671,22 +672,26 @@ _test_cls_delaunay_3(const Triangulation &)
Vertex_handle v = nearest_vertex(T3_13, p);
for (typename Cls::Finite_vertices_iterator
fvit = T3_13.finite_vertices_begin();
fvit != T3_13.finite_vertices_end(); ++fvit)
assert(CGAL::squared_distance(p, v->point()) <=
CGAL::squared_distance(p, fvit->point()));
Vertex_handle v1 = nearest_vertex_in_cell(T3_13, p, c1);
fvit != T3_13.finite_vertices_end(); ++fvit){
assert(CGAL::squared_distance(p,
v->point()) <=
CGAL::squared_distance(p, fvit->point()));
}
Vertex_handle v1 = nearest_vertex_in_cell(T3_13, p, c1)
;
int i1 = c1->index(v1);
for(int i=0; i<4; ++i) {
if (i != i1)
assert(CGAL::squared_distance(p, v1->point()) <=
CGAL::squared_distance(p, c1->vertex(i)->point()));
CGAL::squared_distance(p, c1->vertex(i)->point()));
}
Vertex_handle v2 = nearest_vertex_in_cell(T3_13, p, c2);
int i2 = c2->index(v2);
for(int i=0; i<4; ++i) {
if (i != i2 && c2->vertex(i) != T3_13.infinite_vertex())
assert(CGAL::squared_distance(p, v2->point()) <=
CGAL::squared_distance(p, c2->vertex(i)->point()));
CGAL::squared_distance(p, c2->vertex(i)->point()));
}
}
}