mirror of https://github.com/CGAL/cgal
Sphere_3 -> Point_3 + double, so that we don't need another traits.
This commit is contained in:
parent
5c95a11352
commit
15d098c55f
|
|
@ -40,7 +40,8 @@ int main ()
|
||||||
CGAL::Random_points_on_sphere_3<Point> given_sphere(2.0, random); // generate points
|
CGAL::Random_points_on_sphere_3<Point> given_sphere(2.0, random); // generate points
|
||||||
for (int i = 0; i < size; ++i) v.push_back(*given_sphere++ + trans);
|
for (int i = 0; i < size; ++i) v.push_back(*given_sphere++ + trans);
|
||||||
|
|
||||||
CGAL::hilbert_sort_on_sphere(v.begin(), v.end(), sphere); // sort
|
CGAL::hilbert_sort_on_sphere(v.begin(), v.end(), // sort
|
||||||
|
sphere.squared_radius(), sphere.center());
|
||||||
|
|
||||||
for(std::size_t i=0; i<size; ++i) std::cout << v[i] << std::endl; //output
|
for(std::size_t i=0; i<size; ++i) std::cout << v[i] << std::endl; //output
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ int main ()
|
||||||
CGAL::Random_points_on_sphere_3<Point> given_sphere(2.0, random); // generate points
|
CGAL::Random_points_on_sphere_3<Point> given_sphere(2.0, random); // generate points
|
||||||
for (int i = 0; i < size; ++i) v.push_back(*given_sphere++ + trans);
|
for (int i = 0; i < size; ++i) v.push_back(*given_sphere++ + trans);
|
||||||
|
|
||||||
CGAL::spatial_sort_on_sphere(v.begin(), v.end(), sphere); // sort
|
CGAL::spatial_sort_on_sphere(v.begin(), v.end(), // sort
|
||||||
|
sphere.squared_radius(), sphere.center());
|
||||||
|
|
||||||
for(std::size_t i=0; i<size; ++i) std::cout << v[i] << std::endl; //output
|
for(std::size_t i=0; i<size; ++i) std::cout << v[i] << std::endl; //output
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,7 @@ namespace CGAL {
|
||||||
|
|
||||||
template <class K, class Hilbert_policy >
|
template <class K, class Hilbert_policy >
|
||||||
class Hilbert_sort_on_sphere_3 {
|
class Hilbert_sort_on_sphere_3 {
|
||||||
typedef typename K::Sphere_3 Sphere_3;
|
|
||||||
typedef typename K::Point_3 Point_3;
|
typedef typename K::Point_3 Point_3;
|
||||||
typedef typename K::FT FT;
|
|
||||||
|
|
||||||
static const double _sqrt_of_one_over_three = 0.57735026919;
|
static const double _sqrt_of_one_over_three = 0.57735026919;
|
||||||
|
|
||||||
|
|
@ -57,13 +55,15 @@ class Hilbert_sort_on_sphere_3 {
|
||||||
Hilbert_sort_2<Face_5_traits_3, Hilbert_policy > _hs_5_object;
|
Hilbert_sort_2<Face_5_traits_3, Hilbert_policy > _hs_5_object;
|
||||||
Hilbert_sort_2<Face_6_traits_3, Hilbert_policy > _hs_6_object;
|
Hilbert_sort_2<Face_6_traits_3, Hilbert_policy > _hs_6_object;
|
||||||
K _k;
|
K _k;
|
||||||
Sphere_3 _s;
|
Point_3 _p;
|
||||||
|
double _sq_r;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_on_sphere_3 (const K &k=K(),
|
Hilbert_sort_on_sphere_3 (const K &k=K(),
|
||||||
const Sphere_3 &s = Sphere_3(Point_3(FT(0),FT(0),FT(0)),FT(1)),
|
double sq_r = 1.0,
|
||||||
|
const Point_3 &p = Point_3(0,0,0),
|
||||||
std::ptrdiff_t limit=1)
|
std::ptrdiff_t limit=1)
|
||||||
: _k(k), _s(s),
|
: _k(k), _p(p), _sq_r(sq_r),
|
||||||
_hs_1_object(Face_1_traits_3(),limit),
|
_hs_1_object(Face_1_traits_3(),limit),
|
||||||
_hs_2_object(Face_2_traits_3(),limit),
|
_hs_2_object(Face_2_traits_3(),limit),
|
||||||
_hs_3_object(Face_3_traits_3(),limit),
|
_hs_3_object(Face_3_traits_3(),limit),
|
||||||
|
|
@ -77,11 +77,10 @@ public:
|
||||||
typedef typename std::iterator_traits<RandomAccessIterator>::value_type Point;
|
typedef typename std::iterator_traits<RandomAccessIterator>::value_type Point;
|
||||||
std::vector< Point > vec[6];
|
std::vector< Point > vec[6];
|
||||||
|
|
||||||
const FT mulcte = FT(_sqrt_of_one_over_three) *
|
const double mulcte = _sqrt_of_one_over_three * CGAL_NTS sqrt(_sq_r);
|
||||||
FT(CGAL_NTS sqrt(CGAL_NTS to_double(_s.squared_radius())));
|
const double lxi = _p.x() - mulcte, lxs = _p.x() + mulcte;
|
||||||
const FT lxi = _s.center().x() - mulcte, lxs = _s.center().x() + mulcte;
|
const double lyi = _p.y() - mulcte, lys = _p.y() + mulcte;
|
||||||
const FT lyi = _s.center().y() - mulcte, lys = _s.center().y() + mulcte;
|
const double lzs = _p.z() + mulcte;
|
||||||
const FT lzs = _s.center().z() + mulcte;
|
|
||||||
|
|
||||||
for(RandomAccessIterator i = begin; i != end; ++i) {
|
for(RandomAccessIterator i = begin; i != end; ++i) {
|
||||||
const Point &p = *i;
|
const Point &p = *i;
|
||||||
|
|
|
||||||
|
|
@ -84,12 +84,13 @@ namespace internal {
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy,
|
Policy,
|
||||||
typename Kernel::Point_3 *,
|
typename Kernel::Point_3 *,
|
||||||
const typename Kernel::Sphere_3 &s)
|
double sq_r,
|
||||||
|
const typename Kernel::Point_3 &p)
|
||||||
{
|
{
|
||||||
boost::rand48 random;
|
boost::rand48 random;
|
||||||
boost::random_number_generator<boost::rand48> rng(random);
|
boost::random_number_generator<boost::rand48> rng(random);
|
||||||
std::random_shuffle(begin,end, rng);
|
std::random_shuffle(begin,end, rng);
|
||||||
(Hilbert_sort_on_sphere_3<Kernel, Policy> (k,s))(begin, end);
|
(Hilbert_sort_on_sphere_3<Kernel, Policy> (k,sq_r,p))(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -162,13 +163,9 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3 &s =
|
double sq_r = 1.0,
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3(
|
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(
|
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0)
|
|
||||||
), typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
|
|
@ -177,30 +174,26 @@ void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, Kernel(), Hilbert_sort_median_policy(),
|
internal::hilbert_sort_on_sphere(begin, end, Kernel(), Hilbert_sort_median_policy(),
|
||||||
static_cast<value_type *> (0), s);
|
static_cast<value_type *> (0), sq_r, p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Kernel>
|
template <class RandomAccessIterator, class Kernel>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
const typename Kernel::Sphere_3 &s, const Kernel &k)
|
const typename Kernel::Point_3 &p, double sq_r, const Kernel &k)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, k, Hilbert_sort_median_policy(),
|
internal::hilbert_sort_on_sphere(begin, end, k, Hilbert_sort_median_policy(),
|
||||||
static_cast<value_type *> (0), s);
|
static_cast<value_type *> (0), sq_r, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_median_policy policy,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_median_policy policy,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3 &s =
|
double sq_r = 1.0,
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3(
|
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(
|
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0)
|
|
||||||
), typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
@ -208,19 +201,15 @@ void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy,
|
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy,
|
||||||
static_cast<value_type *> (0), s);
|
static_cast<value_type *> (0), sq_r, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_middle_policy policy,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_middle_policy policy,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3 &s =
|
double sq_r = 1.0,
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3(
|
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(
|
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0)
|
|
||||||
), typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
@ -228,21 +217,19 @@ void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy,
|
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy,
|
||||||
static_cast<value_type *> (0), s);
|
static_cast<value_type *> (0), sq_r, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Kernel, class Policy>
|
template <class RandomAccessIterator, class Kernel, class Policy>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, const Kernel &k, Policy policy,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, const Kernel &k, Policy policy,
|
||||||
const typename Kernel::Sphere_3 &s = typename Kernel::Sphere_3(
|
double sq_r = 1.0, const typename Kernel::Point_3 &p = typename Kernel::Point_3(0,0,0))
|
||||||
typename Kernel::Point_3(typename Kernel::FT(0), typename Kernel::FT(0), typename Kernel::FT(0)),
|
|
||||||
typename Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end,
|
internal::hilbert_sort_on_sphere(begin, end,
|
||||||
k, policy, static_cast<value_type *> (0), s);
|
k, policy, static_cast<value_type *> (0), sq_r, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,8 @@ namespace internal {
|
||||||
std::ptrdiff_t threshold_hilbert,
|
std::ptrdiff_t threshold_hilbert,
|
||||||
std::ptrdiff_t threshold_multiscale,
|
std::ptrdiff_t threshold_multiscale,
|
||||||
double ratio,
|
double ratio,
|
||||||
const typename Kernel::Sphere_3 &s)
|
double sq_r,
|
||||||
|
const typename Kernel::Point_3 &p)
|
||||||
{
|
{
|
||||||
typedef Hilbert_sort_on_sphere_3<Kernel, Policy> Sort;
|
typedef Hilbert_sort_on_sphere_3<Kernel, Policy> Sort;
|
||||||
boost::rand48 random;
|
boost::rand48 random;
|
||||||
|
|
@ -102,7 +103,7 @@ namespace internal {
|
||||||
if (threshold_multiscale==0) threshold_multiscale=16;
|
if (threshold_multiscale==0) threshold_multiscale=16;
|
||||||
if (ratio==0.0) ratio=0.25;
|
if (ratio==0.0) ratio=0.25;
|
||||||
|
|
||||||
(Multiscale_sort<Sort> (Sort (k, s, threshold_hilbert),
|
(Multiscale_sort<Sort> (Sort (k, sq_r, p, threshold_hilbert),
|
||||||
threshold_multiscale, ratio)) (begin, end);
|
threshold_multiscale, ratio)) (begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,15 +213,14 @@ void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
std::ptrdiff_t threshold_hilbert=0,
|
std::ptrdiff_t threshold_hilbert=0,
|
||||||
std::ptrdiff_t threshold_multiscale=0,
|
std::ptrdiff_t threshold_multiscale=0,
|
||||||
double ratio=0.0,
|
double ratio=0.0,
|
||||||
const typename Kernel::Sphere_3 &s = typename Kernel::Sphere_3(
|
double sq_r=1.0,
|
||||||
typename Kernel::Point_3(typename Kernel::FT(0), typename Kernel::FT(0), typename Kernel::FT(0)),
|
const typename Kernel::Point_3 &p = typename Kernel::Point_3(0,0,0))
|
||||||
typename Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
||||||
internal::spatial_sort_on_sphere(begin, end, k, policy, static_cast<value_type *> (0),
|
internal::spatial_sort_on_sphere(begin, end, k, policy, static_cast<value_type *> (0),
|
||||||
threshold_hilbert,threshold_multiscale,ratio,s);
|
threshold_hilbert,threshold_multiscale,ratio,sq_r,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
|
|
@ -229,13 +229,9 @@ void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
std::ptrdiff_t threshold_hilbert=0,
|
std::ptrdiff_t threshold_hilbert=0,
|
||||||
std::ptrdiff_t threshold_multiscale=0,
|
std::ptrdiff_t threshold_multiscale=0,
|
||||||
double ratio=0.0,
|
double ratio=0.0,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3 &s =
|
double sq_r=1.0,
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3(
|
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(
|
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0)
|
|
||||||
), typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
@ -243,7 +239,7 @@ void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
spatial_sort_on_sphere (begin, end, Kernel(), policy,
|
spatial_sort_on_sphere (begin, end, Kernel(), policy,
|
||||||
threshold_hilbert,threshold_multiscale,ratio,s);
|
threshold_hilbert,threshold_multiscale,ratio,sq_r,p);
|
||||||
}
|
}
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
|
|
@ -251,13 +247,9 @@ void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
std::ptrdiff_t threshold_hilbert=0,
|
std::ptrdiff_t threshold_hilbert=0,
|
||||||
std::ptrdiff_t threshold_multiscale=0,
|
std::ptrdiff_t threshold_multiscale=0,
|
||||||
double ratio=0.0,
|
double ratio=0.0,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3 &s =
|
double sq_r=1.0,
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3(
|
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(
|
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0)
|
|
||||||
), typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(1)))
|
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
@ -265,13 +257,14 @@ void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
spatial_sort_on_sphere (begin, end, Kernel(), policy,
|
spatial_sort_on_sphere (begin, end, Kernel(), policy,
|
||||||
threshold_hilbert,threshold_multiscale,ratio,s);
|
threshold_hilbert,threshold_multiscale,ratio,sq_r,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Kernel>
|
template <class RandomAccessIterator, class Kernel>
|
||||||
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
const typename Kernel::Sphere_3 &s,
|
double sq_r,
|
||||||
|
const typename Kernel::Point_3 &p,
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
std::ptrdiff_t threshold_hilbert=0,
|
std::ptrdiff_t threshold_hilbert=0,
|
||||||
std::ptrdiff_t threshold_multiscale=0,
|
std::ptrdiff_t threshold_multiscale=0,
|
||||||
|
|
@ -279,25 +272,21 @@ void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
{
|
{
|
||||||
spatial_sort_on_sphere (begin, end, k,
|
spatial_sort_on_sphere (begin, end, k,
|
||||||
Hilbert_sort_median_policy(),
|
Hilbert_sort_median_policy(),
|
||||||
threshold_hilbert,threshold_multiscale,ratio,s);
|
threshold_hilbert,threshold_multiscale,ratio,sq_r,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3 &s =
|
double sq_r = 1.0,
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Sphere_3(
|
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(
|
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0),
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0),
|
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(0)
|
|
||||||
), typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::FT(1)),
|
|
||||||
std::ptrdiff_t threshold_hilbert=0,
|
std::ptrdiff_t threshold_hilbert=0,
|
||||||
std::ptrdiff_t threshold_multiscale=0,
|
std::ptrdiff_t threshold_multiscale=0,
|
||||||
double ratio=0.0)
|
double ratio=0.0)
|
||||||
{
|
{
|
||||||
spatial_sort_on_sphere (begin, end,
|
spatial_sort_on_sphere (begin, end,
|
||||||
Hilbert_sort_median_policy(),
|
Hilbert_sort_median_policy(),
|
||||||
threshold_hilbert,threshold_multiscale,ratio,s);
|
threshold_hilbert,threshold_multiscale,ratio,sq_r,p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
typedef K::Point_2 Point_2;
|
typedef K::Point_2 Point_2;
|
||||||
typedef K::Point_3 Point_3;
|
typedef K::Point_3 Point_3;
|
||||||
typedef K::Vector_3 Vector_3;
|
typedef K::Vector_3 Vector_3;
|
||||||
typedef K::Sphere_3 Sphere_3;
|
|
||||||
typedef CGAL::Creator_uniform_2<double,Point_2> Creator_2;
|
typedef CGAL::Creator_uniform_2<double,Point_2> Creator_2;
|
||||||
typedef CGAL::Creator_uniform_3<double,Point_3> Creator_3;
|
typedef CGAL::Creator_uniform_3<double,Point_3> Creator_3;
|
||||||
|
|
||||||
|
|
@ -329,7 +328,7 @@ int main ()
|
||||||
std::cout << " Sorting points... " << std::flush;
|
std::cout << " Sorting points... " << std::flush;
|
||||||
|
|
||||||
cost.reset();cost.start();
|
cost.reset();cost.start();
|
||||||
CGAL::hilbert_sort_on_sphere(v.begin(),v.end(),Sphere_3(CGAL::ORIGIN + Vector_3(3,5,5),4));
|
CGAL::hilbert_sort_on_sphere(v.begin(),v.end(), 4, CGAL::ORIGIN + Vector_3(3,5,5));
|
||||||
cost.stop();
|
cost.stop();
|
||||||
|
|
||||||
std::cout << "done in "<<cost.time()<<"seconds." << std::endl;
|
std::cout << "done in "<<cost.time()<<"seconds." << std::endl;
|
||||||
|
|
@ -391,7 +390,7 @@ int main ()
|
||||||
std::cout << " Sorting points... " << std::flush;
|
std::cout << " Sorting points... " << std::flush;
|
||||||
|
|
||||||
cost.reset();cost.start();
|
cost.reset();cost.start();
|
||||||
CGAL::hilbert_sort_on_sphere(v.begin(),v.end(),CGAL::Hilbert_sort_middle_policy(), Sphere_3(CGAL::ORIGIN + Vector_3(3,5,5), 4));
|
CGAL::hilbert_sort_on_sphere(v.begin(),v.end(),CGAL::Hilbert_sort_middle_policy(), 4, CGAL::ORIGIN + Vector_3(3,5,5));
|
||||||
cost.stop();
|
cost.stop();
|
||||||
|
|
||||||
std::cout << "done in "<<cost.time()<<"seconds." << std::endl;
|
std::cout << "done in "<<cost.time()<<"seconds." << std::endl;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||||
typedef K::Point_2 Point_2;
|
typedef K::Point_2 Point_2;
|
||||||
typedef K::Point_3 Point_3;
|
typedef K::Point_3 Point_3;
|
||||||
typedef K::Vector_3 Vector_3;
|
typedef K::Vector_3 Vector_3;
|
||||||
typedef K::Sphere_3 Sphere_3;
|
|
||||||
|
|
||||||
typedef CGAL::Creator_uniform_2<double,Point_2> Creator_2;
|
typedef CGAL::Creator_uniform_2<double,Point_2> Creator_2;
|
||||||
typedef CGAL::Creator_uniform_3<double,Point_3> Creator_3;
|
typedef CGAL::Creator_uniform_3<double,Point_3> Creator_3;
|
||||||
|
|
@ -143,7 +142,7 @@ int main ()
|
||||||
|
|
||||||
std::cout << " Sorting points... " << std::flush;
|
std::cout << " Sorting points... " << std::flush;
|
||||||
|
|
||||||
CGAL::spatial_sort_on_sphere (v.begin(), v.end(), Sphere_3(Point_3(10,10,3),9));
|
CGAL::spatial_sort_on_sphere (v.begin(), v.end(), 9, Point_3(10,10,3));
|
||||||
|
|
||||||
std::cout << "done." << std::endl;
|
std::cout << "done." << std::endl;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue