DGtal  1.5.beta
DGtal::detail Namespace Reference

detail namespace gathers internal classes and functions. More...

Data Structures

struct  HasNestedTypeCategory
 Aim: Checks whether type T has a nested type called 'Category' or not. NB: from en.wikipedia.org/wiki/Substitution_failure_is_not_an_error NB: to avoid various compiler issues, we use BOOST_STATIC_CONSTANT according to http://www.boost.org/development/int_const_guidelines.html. More...
 
struct  IsContainerFromCategory
 
struct  IsSequenceContainerFromCategory
 
struct  IsAssociativeContainerFromCategory
 
struct  IsOrderedAssociativeContainerFromCategory
 
struct  IsUnorderedAssociativeContainerFromCategory
 
struct  IsSimpleAssociativeContainerFromCategory
 
struct  IsPairAssociativeContainerFromCategory
 
struct  IsUniqueAssociativeContainerFromCategory
 
struct  IsMultipleAssociativeContainerFromCategory
 
struct  HasNestedTypeType
 Aim: Checks whether type IC has a nested type called 'Type' or not. NB: from en.wikipedia.org/wiki/Substitution_failure_is_not_an_error NB: to avoid various compiler issues, we use BOOST_STATIC_CONSTANT according to http://www.boost.org/development/int_const_guidelines.html. More...
 
struct  IsCirculatorFromType
 Aim: In order to check whether type IC is a circular or a classical iterator, the nested type called 'Type' is read.
More...
 
struct  IsCirculatorFromType< IC, CirculatorType >
 
struct  IsCirculator
 Aim: Checks whether type IC is a circular or a classical iterator. Static value set to 'true' for a circulator, 'false' otherwise.
1) if type IC has no nested type 'Type', it is a classical iterator and 'false' is returned. 2) if type IC has a nested type 'Type', 'true' is returned is 'Type' is CirculatorType, 'false' otherwise. More...
 
struct  IsCirculator< IC, true >
 
struct  IteratorCirculatorTypeImpl
 Aim: Defines the Iterator or Circulator type as a nested type according to the value of b. More...
 
struct  IteratorCirculatorTypeImpl< true >
 
struct  LabelledMapMemFunctor
 
struct  EqualPredicateFromLessThanComparator
 
struct  KeyComparatorForPairKeyData
 
struct  ComparatorAdapter
 
struct  ComparatorAdapter< Container, true, true, false >
 Set-like adapter. More...
 
struct  ComparatorAdapter< Container, true, true, true >
 Map-like adapter. More...
 
struct  ComparatorAdapter< Container, true, false, false >
 unordered set-like adapter. More...
 
struct  ComparatorAdapter< Container, true, false, true >
 unordered map-like adapter. More...
 
struct  SetFunctionsImpl
 Aim: Specialize set operations (union, intersection, difference, symmetric_difference) according to the given type of container. It uses standard algorithms when containers are ordered, otherwise it provides a default implementation. More...
 
struct  SetFunctionsImpl< Container, true, false >
 
struct  SetFunctionsImpl< Container, true, true >
 
struct  SetFunctionsImpl< Container, false, true >
 
struct  toCoordinateImpl
 Aim: Define a simple functor that can cast a signed integer (possibly a DGtal::BigInteger) into another. More...
 
struct  toCoordinateImpl< DGtal::BigInteger, TOutput >
 
struct  toCoordinateImpl< DGtal::BigInteger, DGtal::BigInteger >
 
class  PosIndepScaleIndepSCEstimator
 
class  PosIndepScaleDepSCEstimator
 
class  PosDepScaleIndepSCEstimator
 
class  PosDepScaleDepSCEstimator
 
struct  TangentAngleFromDSS
 
struct  NormalizedTangentVectorFromDSS
 
struct  TangentVectorFromDSS
 
struct  CurvatureFromDCA
 
struct  CurvatureFromDCA< false >
 
struct  NormalVectorFromDCA
 
struct  TangentVectorFromDCA
 
struct  DistanceFromDCA
 
struct  CurvatureFromDSSLength
 
struct  CurvatureFromDSSLengthAndWidth
 
class  CurvatureFromDSSBaseEstimator
 
class  DSSDecorator
 Aim: Abstract DSSDecorator for ArithmeticalDSSComputer. Has 2 virtual methods returning the first and last leaning point: More...
 
class  DSSDecorator4ConvexPart
 Aim: adapter for TDSS used by FP in CONVEX parts. Has 2 methods: More...
 
class  DSSDecorator4ConcavePart
 Aim: adapter for TDSS used by FP in CONCAVE parts. Has 2 methods: More...
 
class  PointOnProbingRay
 A ray consists of a permutation \( \sigma \) and an integer index \( \lambda \) (position on the ray). For a triplet of vectors \( (m_k)_{0 \leq k \leq 2} \) and a point \( q \), a point on the ray is defined as: \( q - m_{\sigma(0)} + m_{\sigma(1)} + \lambda m_{\sigma(2)} \). \( q - m_{\sigma(0)} + m_{\sigma(1)} \) is called the base point. More...
 
class  GridPoint
 A grid point consists of a couple of nonnegative coordinates \( (x,y) \) and an integer index \( k \) that determines a point used as origin. For a triplet of vectors \( (m_k)_{0 \leq k \leq 2} \) and a point \( q \), a grid point is defined as: \( q - m_{k} + x m_{(k+1)\bmod 3} + y m_{(k+2)\bmod 3} \). \( q - m_{k} \), called base point, is used as origin. More...
 
class  GridPointOnProbingRay
 Aim: Represents a grid point along a discrete ray defined on a grid. More...
 
struct  EuclideanDivisionHelper
 Aim: Small stucture that provides a static method returning the Euclidean division of two integers. More...
 
struct  EuclideanDivisionHelper< float >
 
struct  EuclideanDivisionHelper< double >
 
struct  EuclideanDivisionHelper< long double >
 
struct  BoundedLatticePolytopeSpecializer
 Aim: It is just a helper class for BoundedLatticePolytope to add dimension specific static methods. More...
 
struct  BoundedLatticePolytopeSpecializer< 3, TInteger >
 Aim: 3D specialization for BoundedLatticePolytope to add dimension specific static methods. More...
 
struct  BoundedRationalPolytopeSpecializer
 Aim: It is just a helper class for BoundedRationalPolytope to add dimension specific static methods. More...
 
struct  BoundedRationalPolytopeSpecializer< 3, TInteger >
 Aim: 3D specialization for BoundedRationalPolytope to add dimension specific static methods. More...
 
struct  ConvexityHelperInternalInteger
 
struct  ConvexityHelperInternalInteger< DGtal::int32_t, true >
 
struct  ConvexityHelperInternalInteger< DGtal::int32_t, false >
 
struct  ConvexityHelperInternalInteger< DGtal::int64_t, true >
 
struct  ConvexityHelperInternalInteger< DGtal::int64_t, false >
 
struct  ConvexityHelperInternalInteger< DGtal::BigInteger, safe >
 
class  PointValueCompare
 Aim: Small binary predicate to order candidates points according to their (absolute) distance value. More...
 
struct  RecursivePConvexity
 
struct  RecursivePConvexity< 1, TInteger >
 
struct  ValueConverter
 Generic definition of a class for converting type X toward type Y. More...
 
struct  ValueConverter< std::string, double >
 Specialized definitions of a class for converting type X toward type Y. More...
 
struct  ValueConverter< std::string, float >
 Specialized definitions of a class for converting type X toward type Y. More...
 
struct  ValueConverter< std::string, int >
 Specialized definitions of a class for converting type X toward type Y. More...
 
struct  ValueConverter< X, std::string >
 Specialized definitions of a class for converting type X toward type Y. More...
 
struct  power_node
 
struct  monomial_node
 
struct  top_node
 
struct  FFTWComplexCast
 Facility to cast to the complex type used by fftw. More...
 
struct  FFTWWrapper
 Wrapper to fftw functions depending on value type. More...
 
struct  FFTWWrapper< double >
 
struct  FFTWWrapper< float >
 
struct  FFTWWrapper< long double >
 

Typedefs

typedef boost::variant< boost::recursive_wrapper< top_node >, monomial_nodeexpr_node
 

Functions

template<typename IC >
bool isNotEmpty (const IC &itb, const IC &ite, IteratorType)
 
template<typename IC >
bool isNotEmpty (const IC &c1, const IC &c2, CirculatorType)
 
template<typename IC >
void advanceIterator (IC &ic, typename IteratorCirculatorTraits< IC >::Difference n, ForwardCategory)
 
template<typename IC >
void advanceIterator (IC &ic, typename IteratorCirculatorTraits< IC >::Difference n, RandomAccessCategory)
 
template<typename I >
IteratorCirculatorTraits< I >::Difference rangeSize (const I &itb, const I &ite, IteratorType, ForwardCategory)
 
template<typename C >
IteratorCirculatorTraits< C >::Difference rangeSize (const C &cb, const C &ce, CirculatorType, ForwardCategory)
 
template<typename I >
IteratorCirculatorTraits< I >::Difference rangeSize (const I &itb, const I &ite, IteratorType, RandomAccessCategory)
 
template<typename C >
IteratorCirculatorTraits< C >::Difference rangeSize (const C &cb, const C &ce, CirculatorType, RandomAccessCategory)
 
template<typename I >
rangeMiddle (const I &itb, const I &ite, IteratorType, ForwardCategory)
 
template<typename C >
rangeMiddle (const C &cb, const C &ce, CirculatorType, ForwardCategory)
 
template<typename I >
rangeMiddle (const I &itb, const I &ite, IteratorType, BidirectionalCategory)
 
template<typename C >
rangeMiddle (const C &cb, const C &ce, CirculatorType, BidirectionalCategory)
 
template<typename I >
rangeMiddle (const I &itb, const I &ite, IteratorType, RandomAccessCategory)
 
template<typename C >
rangeMiddle (const C &cb, const C &ce, CirculatorType, RandomAccessCategory)
 
template<typename TData >
std::pair< unsigned int, unsigned int > argminLabelledMapMemoryUsageForGeometricDistribution (unsigned int L, double prob_no_data, double prob_one_data)
 
template<typename Point >
Point::Coordinate squaredNorm (Point const &aPoint)
 
template<int N, typename T >
determinant (const T aMatrix[N][N])
 
template<typename Point >
Point::Coordinate distToSphere (std::array< Point, 5 > const &aPoints)
 
template<typename Point >
bool isBasisReduced (Point const &aU, Point const &aV)
 
template<typename Integer , typename Index >
std::ostream & operator<< (std::ostream &aOs, PointOnProbingRay< Integer, Index > const &aRay)
 
template<typename Integer , typename Index >
std::ostream & operator<< (std::ostream &aOs, GridPoint< Integer, Index > const &aGridPoint)
 
template<typename Point >
Point center (const std::vector< Point > &points)
 
template<typename OutputValue , typename ForwardIterator , typename ConversionFct >
void transform (std::vector< OutputValue > &output_values, std::vector< std::size_t > &input2output, std::vector< std::size_t > &output2input, ForwardIterator itb, ForwardIterator ite, const ConversionFct &F, bool remove_duplicates)
 
static void mpz_set_sll (mpz_t n, long long sll)
 ----------— GMP SPECIALIZED SERVICES -------------------------— More...
 
static void mpz_set_ull (mpz_t n, unsigned long long ull)
 
static unsigned long long mpz_get_ull (mpz_t n)
 
static long long mpz_get_sll (mpz_t n)
 

Detailed Description

detail namespace gathers internal classes and functions.

Typedef Documentation

◆ expr_node

typedef boost::variant< boost::recursive_wrapper<top_node>, monomial_node > DGtal::detail::expr_node

Part of the polynomial tree structure. Either a top_node or a monomial.

Definition at line 87 of file MPolynomialReader.h.

Function Documentation

◆ advanceIterator() [1/2]

template<typename IC >
void DGtal::detail::advanceIterator ( IC &  ic,
typename IteratorCirculatorTraits< IC >::Difference  n,
ForwardCategory   
)
inline

Moves ic at position @ it + n

Parameters
icany (circular)iterator
nany positive distance
Template Parameters
ICany iterator or circulator

◆ advanceIterator() [2/2]

template<typename IC >
void DGtal::detail::advanceIterator ( IC &  ic,
typename IteratorCirculatorTraits< IC >::Difference  n,
RandomAccessCategory   
)
inline

Moves ic at position @ it + n

Parameters
icany (circular)iterator
nany positive distance
Template Parameters
ICany iterator or circulator

◆ argminLabelledMapMemoryUsageForGeometricDistribution()

template<typename TData >
std::pair< unsigned int, unsigned int > DGtal::detail::argminLabelledMapMemoryUsageForGeometricDistribution ( unsigned int  L,
double  prob_no_data,
double  prob_one_data 
)

Tries to find the best values N and M which will minimized the memory usage of a LabelledMap, for the distribution specified by the parameters.

Template Parameters
TDatathe type of data that will be stored.
Parameters
Lthe total number of labels.
prob_no_dataProbability that there is no data at this location.
prob_one_dataIf there is a possibility to have a data, this probability is used to define a geometric distribution that defines the number of data (ie valid labels) at this place. The smaller, the higher is the expectation. 0.5 means E(X) = 1.
Returns
the pair (N,M) that minimizes the memory usage of a LabelledMap for the given distribution.

◆ center()

template<typename Point >
Point DGtal::detail::center ( const std::vector< Point > &  points)

Compute the center of the bounding box containing the given points.

Template Parameters
Pointany type of points
Parameters
[in]pointsa range of points
Returns
the (approximate center of the given range.
Note
Complexity is O(n), if n is the size of points.

Definition at line 66 of file QuickHullKernels.h.

67  {
68  if ( points.empty() ) return Point::zero;
69  Point l = points[ 0 ];
70  Point u = l;
71  for ( const auto& p : points ) {
72  l = l.inf( p );
73  u = u.sup( p );
74  }
75  return Point( ( l + u ) / 2 );
76  }
MyPointD Point
Definition: testClone2.cpp:383

◆ determinant()

template<int N, typename T >
T DGtal::detail::determinant ( const T  aMatrix[N][N])

Determinant of a NxN matrix represented by a two-dimensional static array.

Parameters
aMatrixthe static array representing the matrix.
Returns
the determinant of the input matrix.

◆ distToSphere()

template<typename Point >
Point::Coordinate DGtal::detail::distToSphere ( std::array< Point, 5 > const &  aPoints)
inline

Computes the distance of a point to a sphere passing through 4 given points.

Parameters
aPoints5 points where the first 4 define the sphere and the last one is the point to which we want to compute the distance.
Returns
the distance of the last point to the sphere defined by the first 4 points.

◆ isBasisReduced()

template<typename Point >
bool DGtal::detail::isBasisReduced ( Point const &  aU,
Point const &  aV 
)
inline

Test if a pair of vectors form a reduced basis.

Parameters
aUthe first vector.
aVthe second vector.
Returns
'true' if (aU, aV) is a reduced basis, 'false' otherwise.

◆ isNotEmpty() [1/2]

template<typename IC >
bool DGtal::detail::isNotEmpty ( const IC &  c1,
const IC &  c2,
CirculatorType   
)
inline

Checks if a circular range is not empty, ie. checks if the circulators are valid.

Parameters
c1begin iterator of the range
c2end iterator of the range
Template Parameters
ICiterator or circulator

◆ isNotEmpty() [2/2]

template<typename IC >
bool DGtal::detail::isNotEmpty ( const IC &  itb,
const IC &  ite,
IteratorType   
)
inline

◆ mpz_get_sll()

static long long DGtal::detail::mpz_get_sll ( mpz_t  n)
inlinestatic

Conversion to int64 is tricky and not native for GMP.

Parameters
nany number
Returns
its int64 representation.

Definition at line 94 of file IntegerConverter.h.

95  {
96  return (long long)mpz_get_ull(n); /* just use unsigned version */
97  }
static unsigned long long mpz_get_ull(mpz_t n)

References mpz_get_ull().

Referenced by DGtal::IntegerConverter< dim, DGtal::int64_t >::cast().

◆ mpz_get_ull()

static unsigned long long DGtal::detail::mpz_get_ull ( mpz_t  n)
inlinestatic

Conversion to uint64 is tricky and not native for GMP.

Parameters
nany number
Returns
its uint64 representation.

Definition at line 79 of file IntegerConverter.h.

80  {
81  mpz_t tmp;
82  mpz_init( tmp );
83  mpz_mod_2exp( tmp, n, 64 ); /* tmp = (lower 64 bits of n) */
84  auto lo = mpz_get_ui( tmp ); /* lo = tmp & 0xffffffff */
85  mpz_div_2exp( tmp, tmp, 32 ); /* tmp >>= 32 */
86  auto hi = mpz_get_ui( tmp ); /* hi = tmp & 0xffffffff */
87  mpz_clear( tmp );
88  return (((unsigned long long)hi) << 32) + lo;
89  }

Referenced by mpz_get_sll().

◆ mpz_set_sll()

static void DGtal::detail::mpz_set_sll ( mpz_t  n,
long long  sll 
)
inlinestatic

----------— GMP SPECIALIZED SERVICES -------------------------—

Parameters
[in,out]nthe (initialized) big integer to set
[in]slla signed long long integer to assign to n.

Definition at line 60 of file IntegerConverter.h.

61  {
62  mpz_set_si(n, (int)(sll >> 32)); /* n = (int)sll >> 32 */
63  mpz_mul_2exp(n, n, 32 ); /* n <<= 32 */
64  mpz_add_ui(n, n, (unsigned int)sll); /* n += (unsigned int)sll */
65  }

Referenced by DGtal::IntegerConverter< dim, DGtal::int64_t >::cast(), and DGtal::IntegerConverter< dim, DGtal::BigInteger >::cast().

◆ mpz_set_ull()

static void DGtal::detail::mpz_set_ull ( mpz_t  n,
unsigned long long  ull 
)
inlinestatic
Parameters
[in,out]nthe (initialized) big integer to set
[in]ullan unsigned long long integer to assign to n.

Definition at line 69 of file IntegerConverter.h.

70  {
71  mpz_set_ui(n, (unsigned int)(ull >> 32)); /* n = (unsigned int)(ull >> 32) */
72  mpz_mul_2exp(n, n, 32); /* n <<= 32 */
73  mpz_add_ui(n, n, (unsigned int)ull); /* n += (unsigned int)ull */
74  }

◆ operator<<() [1/2]

template<typename Integer , typename Index >
std::ostream& DGtal::detail::operator<< ( std::ostream &  aOs,
GridPoint< Integer, Index > const &  aGridPoint 
)

Display a grid point on the standard output.

Parameters
aOsthe output stream where the object is written.
aGridPointthe grid point to display.
Returns
the output stream after the writing.

Definition at line 401 of file PlaneProbingEstimatorHelper.h.

401  {
402  aOs << "GridPoint[k=" << aGridPoint.k()
403  << ", a=" << aGridPoint.direction().first
404  << ", b=" << aGridPoint.direction().second
405  << "]";
406  return aOs;
407  }

References DGtal::detail::GridPoint< Integer, Index >::direction(), and DGtal::detail::GridPoint< Integer, Index >::k().

◆ operator<<() [2/2]

template<typename Integer , typename Index >
std::ostream& DGtal::detail::operator<< ( std::ostream &  aOs,
PointOnProbingRay< Integer, Index > const &  aRay 
)

Display a probing ray on the standard output.

Parameters
aOsthe output stream where the object is written.
aRaythe probing ray to display.
Returns
the output stream after the writing.

◆ rangeMiddle() [1/6]

template<typename C >
C DGtal::detail::rangeMiddle ( const C &  cb,
const C &  ce,
CirculatorType  ,
BidirectionalCategory   
)
inline

Computes the middle of a given range [ cb, ce ). Note that if cb = ce then [ cb, ce ) is assumed to be a whole range.

Parameters
cbbegin iterator of the range
ceend iterator of the range
Returns
the middle circulator of the range [ cb , ce ) NB: linear in the range size
Template Parameters
Cany circulator

◆ rangeMiddle() [2/6]

template<typename C >
C DGtal::detail::rangeMiddle ( const C &  cb,
const C &  ce,
CirculatorType  ,
ForwardCategory   
)
inline

Computes the middle of a given range [ cb, ce ). Note that if cb = ce then [ cb, ce ) is assumed to be a whole range.

Parameters
cbbegin iterator of the range
ceend iterator of the range
Returns
the middle circulator of the range [ cb , ce ) NB: linear in the range size
Template Parameters
Cany circulator

◆ rangeMiddle() [3/6]

template<typename C >
C DGtal::detail::rangeMiddle ( const C &  cb,
const C &  ce,
CirculatorType  ,
RandomAccessCategory   
)
inline

Computes the middle of a given range [ cb, ce ). Note that if cb = ce then [ cb, ce ) is assumed to be a whole range.

Parameters
cbbegin iterator of the range
ceend iterator of the range
Returns
the middle circulator of the range [ cb , ce ) NB: in O(1)
Template Parameters
Cany circulator

◆ rangeMiddle() [4/6]

template<typename I >
I DGtal::detail::rangeMiddle ( const I &  itb,
const I &  ite,
IteratorType  ,
BidirectionalCategory   
)
inline

Computes the middle of a given range [ itb , ite )

Parameters
itbbegin iterator of the range
iteend iterator of the range
Returns
the middle iterator of the range [ itb , ite ) NB: in O(ite-itb)
Template Parameters
Iany iterator

◆ rangeMiddle() [5/6]

template<typename I >
I DGtal::detail::rangeMiddle ( const I &  itb,
const I &  ite,
IteratorType  ,
ForwardCategory   
)
inline

Computes the middle of a given range [ itb , ite ).

Parameters
itbbegin iterator of the range
iteend iterator of the range
Returns
the middle iterator of the range [ itb , ite ) NB: in O(ite-itb)
Template Parameters
Iany iterator

◆ rangeMiddle() [6/6]

template<typename I >
I DGtal::detail::rangeMiddle ( const I &  itb,
const I &  ite,
IteratorType  ,
RandomAccessCategory   
)
inline

Computes the middle of a given range [ itb , ite )

Parameters
itbbegin iterator of the range
iteend iterator of the range
Returns
the middle iterator of the range [ itb , ite ) NB: in O(1)
Template Parameters
Iany iterator

◆ rangeSize() [1/4]

template<typename C >
IteratorCirculatorTraits<C>::Difference DGtal::detail::rangeSize ( const C &  cb,
const C &  ce,
CirculatorType  ,
ForwardCategory   
)
inline

Computes the size of a given range [ cb, ce ). Note that if cb = ce then [ cb, ce ) is assumed to be a whole range.

Parameters
cbbegin iterator of the range
ceend iterator of the range
Returns
the size NB: linear in the range size
Template Parameters
Cany circulator

◆ rangeSize() [2/4]

template<typename C >
IteratorCirculatorTraits<C>::Difference DGtal::detail::rangeSize ( const C &  cb,
const C &  ce,
CirculatorType  ,
RandomAccessCategory   
)
inline

Computes the size of a given range [ cb, ce ). Note that if cb = ce then [ cb, ce ) is assumed to be a whole range.

Parameters
cbbegin iterator of the range
ceend iterator of the range
Returns
the size NB: in O(1)
Template Parameters
Cany circulator

◆ rangeSize() [3/4]

template<typename I >
IteratorCirculatorTraits<I>::Difference DGtal::detail::rangeSize ( const I &  itb,
const I &  ite,
IteratorType  ,
ForwardCategory   
)
inline

Computes the size of a given range [ itb , ite )

Parameters
itbbegin iterator of the range
iteend iterator of the range
Returns
the size NB: in O(ite-itb)
Template Parameters
Iany iterator

◆ rangeSize() [4/4]

template<typename I >
IteratorCirculatorTraits<I>::Difference DGtal::detail::rangeSize ( const I &  itb,
const I &  ite,
IteratorType  ,
RandomAccessCategory   
)
inline

Computes the size of a given range [ itb , ite )

Parameters
itbbegin iterator of the range
iteend iterator of the range
Returns
the size NB: in O(1)
Template Parameters
Iany iterator

◆ squaredNorm()

template<typename Point >
Point::Coordinate DGtal::detail::squaredNorm ( Point const &  aPoint)

Version of DGtal::PointVector::squaredNorm with no conversion to double.

Parameters
aPointan input digital point.
Returns
the squared norm of the input point.

◆ transform()

template<typename OutputValue , typename ForwardIterator , typename ConversionFct >
void DGtal::detail::transform ( std::vector< OutputValue > &  output_values,
std::vector< std::size_t > &  input2output,
std::vector< std::size_t > &  output2input,
ForwardIterator  itb,
ForwardIterator  ite,
const ConversionFct &  F,
bool  remove_duplicates 
)

Transform an input range of points into an output range with a conversion function, and possibly removes duplicates in the output range. Used as preprocessing of QuickHull algorithm.

Template Parameters
OutputValueany value that is LessThanComparable, Assignable, CopyConstructible, DefaultConstructible.
ConversionFctis a functor from input values to OutputValue.
ForwardIteratoris a forward iterator on some input values.
Parameters
[out]output_valuesa range of points converted from the input range, with duplicates possibly removed according to remove_duplicates
[out]input2outputthe surjective mapping between the input range and the output range used for computation.
[out]output2inputthe injective mapping between the output range and the input range.
[in]itb,itea range of values.
[in]Fa function that may transform input values to output values
[in]remove_duplicateswhen 'true' remove duplicate values, otherwise, output_values.size() is equal to the size of the range itb,ite.

Definition at line 109 of file QuickHullKernels.h.

115  {
116  typedef std::size_t Size;
117  std::vector< OutputValue > input;
118  while ( itb != ite ) {
119  const auto ip = *itb++;
120  input.push_back( F( ip ) );
121  }
122  if ( ! remove_duplicates ) {
123  output_values.swap( input );
124  input2output.resize( input.size() );
125  output2input.resize( input.size() );
126  for ( Size i = 0; i < input.size(); ++i )
127  input2output[ i ] = output2input[ i ] = i;
128  }
129  else {
130  output_values.clear();
131  std::vector< std::size_t > i2c_sort( input.size() );
132  input2output.resize( input.size() );
133  for ( Size i = 0; i < input.size(); i++ ) i2c_sort[ i ] = i;
134  // indirect sort
135  std::sort( i2c_sort.begin(), i2c_sort.end(),
136  [&input] ( Size i, Size j ) { return input[ i ] < input[ j ]; } );
137  output_values.resize( input.size() );
138  output_values[ 0 ] = input[ i2c_sort[ 0 ] ];
139  input2output[ i2c_sort[ 0 ] ] = 0;
140  Size j = 0;
141  for ( Size i = 1; i < input.size(); i++ ) {
142  if ( input[ i2c_sort[ i-1 ] ] != input[ i2c_sort[ i ] ] )
143  output_values[ ++j ] = input[ i2c_sort[ i ] ];
144  input2output[ i2c_sort[ i ] ] = j;
145  }
146  output_values.resize( j+1 );
147  output2input.resize( output_values.size() );
148  for ( Size i = 0; i < input2output.size(); i++ )
149  output2input[ input2output[ i ] ] = i;
150  }
151  }
HalfEdgeDataStructure::Size Size

Referenced by DGtal::ConvexHullIntegralKernel< dim, TCoordinateInteger, TInternalInteger >::makeInput(), DGtal::DelaunayIntegralKernel< dim, TCoordinateInteger, TInternalInteger >::makeInput(), DGtal::ConvexHullRationalKernel< dim, TCoordinateInteger, TInternalInteger >::makeInput(), and DGtal::DelaunayRationalKernel< dim, TCoordinateInteger, TInternalInteger >::makeInput().