DGtal  0.9.3beta
Public Member Functions
DGtal::functors::StrictTruncationFunctor< Integer > Struct Template Reference

#include <DGtal/geometry/curves/ArithmeticalDSSConvexHull.h>

Public Member Functions

Integer operator() (const Integer &a, const Integer &b) const

Detailed Description

template<typename Integer>
struct DGtal::functors::StrictTruncationFunctor< Integer >

BinaryFunctor that computes the algebraic quotient i of a/b with any non zero fractional part discarded (truncation toward zero), and that returns i+1 (resp. i-1) if a is negative (resp. positive) if b divides a. Since we assume that a is not equal to 0, we have \( |i| < |a/b| \). See also LargeTruncationFunctor.

Template Parameters
Integera model of integer used to store a and b

Definition at line 130 of file ArithmeticalDSSConvexHull.h.

Member Function Documentation

template<typename Integer >
Integer DGtal::functors::StrictTruncationFunctor< Integer >::operator() ( const Integer &  a,
const Integer &  b 
) const
quotient i defined above
a is not null
b is not null

Definition at line 142 of file ArithmeticalDSSConvexHull.h.

143  {
144  ASSERT( a != NumberTraits<Integer>::ZERO );
145  ASSERT( b != NumberTraits<Integer>::ZERO );
147  Integer i = a / b;
148  if (a == i*b)
149  {
150  if (i >= NumberTraits<Integer>::ZERO)
151  --i;
152  else
153  ++i;
154  }
155  return i;
156  }
DGtal::int32_t Integer
Definition: StdDefs.h:74
static const Integer ZERO
Definition: NumberTraits.h:93

The documentation for this struct was generated from the following file: