\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.5 - Spatial Sorting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages

Functions

template<class RandomAccessIterator , class Traits , class PolicyTag >
void CGAL::hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end, const Traits &traits=Default_traits, PolicyTag policy=Default_policy)
 The function hilbert_sort() sorts an iterator range of points along a Hilbert curve. More...
 
template<class RandomAccessIterator , class Traits , class PolicyTag >
void CGAL::spatial_sort (RandomAccessIterator begin, RandomAccessIterator end, const Traits &traits=Default_traits, PolicyTag policy=Default_policy, std::ptrdiff_t threshold_hilbert=default, std::ptrdiff_t threshold_multiscale=default, double ratio=default)
 The function spatial_sort() sorts an iterator range of points in a way that improves space locality. More...
 

Function Documentation

template<class RandomAccessIterator , class Traits , class PolicyTag >
void CGAL::hilbert_sort ( RandomAccessIterator  begin,
RandomAccessIterator  end,
const Traits &  traits = Default_traits,
PolicyTag  policy = Default_policy 
)

The function hilbert_sort() sorts an iterator range of points along a Hilbert curve.

sorts the range [begin, end) in place.

The default traits class Default_traits is the kernel in which the type std::iterator_traits<RandomAccessIterator>::value_type is defined. The default policy is Hilbert_sort_median_policy() and the other option is Hilbert_sort_middle_policy().

Requirements

  1. std::iterator_traits<RandomAccessIterator>::value_type is convertible to Traits::Point_2, Traits::Point_3, or Traits::Point_d.
  2. Traits is a model for concept SpatialSortingTraits_2, SpatialSortingTraits_3, or SpatialSortingTraits_d.

Implementation

Creates an instance of Hilbert_sort_2<Traits, PolicyTag>, Hilbert_sort_3<Traits, PolicyTag>, or Hilbert_sort_d<Traits, PolicyTag> and calls its operator().

#include <CGAL/hilbert_sort.h>

Examples:
Spatial_sorting/hilbert.cpp, Spatial_sorting/hilbert_policies.cpp, and Spatial_sorting/small_example_delaunay_2.cpp.
template<class RandomAccessIterator , class Traits , class PolicyTag >
void CGAL::spatial_sort ( RandomAccessIterator  begin,
RandomAccessIterator  end,
const Traits &  traits = Default_traits,
PolicyTag  policy = Default_policy,
std::ptrdiff_t  threshold_hilbert = default,
std::ptrdiff_t  threshold_multiscale = default,
double  ratio = default 
)

The function spatial_sort() sorts an iterator range of points in a way that improves space locality.

Two points close in the order will be close geometrically, and two points close geometrically will have a high probability of being close in the order.

sorts the range [begin, end) in place.

The default traits class Default_traits is the kernel in which the type std::iterator_traits<RandomAccessIterator>::value_type is defined.

The default policy is Hilbert_sort_median_policy() and the other option is Hilbert_sort_middle_policy().

The default values for the thresholds and the ratio depends on the dimension.

Requirements

  1. std::iterator_traits<RandomAccessIterator>::value_type is convertible to Traits::Point_2, Traits::Point_3, or Traits::Point_d.
  2. Traits is a model for concept SpatialSortingTraits_2, SpatialSortingTraits_3, or SpatialSortingTraits_d.

Implementation

Creates an instance of Multiscale_sort<Hilbert_sort> where Hilbert_sort is an Hilbert sorting object, and calls its operator().

The threshold_hilbert is the minimal size of a point set to be subdivided recursively during Hilbert sorting, otherwise random order is used. The threshold_multiscale value is the minimal size for a sample to call Hilbert sort, otherwise random order is used. The ratio value is used to split the original set in two subsets, spatial sort is applied on the first subset of size ratio times the original size of the set, Hilbert sort is applied on the second subset.

#include <CGAL/spatial_sort.h>

Examples:
Spatial_sorting/myPoint.cpp, Spatial_sorting/small_example_delaunay_2.cpp, Spatial_sorting/sp_sort_using_property_map_2.cpp, Spatial_sorting/sp_sort_using_property_map_3.cpp, and Spatial_sorting/sp_sort_using_property_map_d.cpp.