DGtal 2.1.0
Loading...
Searching...
No Matches
DGtal::detail::AffineGeometryScalarOperations< TScalar > Struct Template Reference

Aim: Internal class used by AffineGeometry to differentiate operations on point coordinates, which may be integer or floating-point numbers.. The generic class assume integer coordinates, while there are two specializations for float and double. More...

#include <DGtal/geometry/tools/AffineGeometry.h>

Public Types

typedef TScalar Scalar
 
typedef Scalar Integer
 In the generic class, the type scalar should be an integral type.
 

Static Private Member Functions

static internal services
static std::pair< Integer, IntegergetMultipliers (Integer a, Integer b)
 
static Integer gcd (Integer a, Integer b)
 
static Integer lcmPositive (Integer a, Integer b)
 
static bool isNonZero (Integer x, double)
 

Friends

template<typename T >
struct DGtal::AffineGeometry
 
template<typename T >
struct DGtal::AffineBasis
 

Detailed Description

template<typename TScalar>
struct DGtal::detail::AffineGeometryScalarOperations< TScalar >

Aim: Internal class used by AffineGeometry to differentiate operations on point coordinates, which may be integer or floating-point numbers.. The generic class assume integer coordinates, while there are two specializations for float and double.

Description of template class 'AffineGeometryScalarOperations'

Template Parameters
TScalarany integer or floating point number type.

Definition at line 202 of file AffineGeometry.h.

Member Typedef Documentation

◆ Integer

template<typename TScalar >
typedef Scalar DGtal::detail::AffineGeometryScalarOperations< TScalar >::Integer

In the generic class, the type scalar should be an integral type.

Definition at line 209 of file AffineGeometry.h.

◆ Scalar

template<typename TScalar >
typedef TScalar DGtal::detail::AffineGeometryScalarOperations< TScalar >::Scalar

Definition at line 207 of file AffineGeometry.h.

Member Function Documentation

◆ gcd()

template<typename TScalar >
static Integer DGtal::detail::AffineGeometryScalarOperations< TScalar >::gcd ( Integer  a,
Integer  b 
)
inlinestaticprivate
Parameters
[in]aany integer number
[in]bany integer number
Returns
the greatest common divisor of a and b.

Definition at line 237 of file AffineGeometry.h.

238 {
239 return IntegerComputer< Integer >::staticGcd( abs( a ), abs( b ) );
240 }
static Integer staticGcd(IntegerParamType a, IntegerParamType b)

References DGtal::IntegerComputer< TInteger >::staticGcd().

Referenced by DGtal::detail::AffineGeometryScalarOperations< TScalar >::getMultipliers(), and DGtal::detail::AffineGeometryScalarOperations< TScalar >::lcmPositive().

◆ getMultipliers()

template<typename TScalar >
static std::pair< Integer, Integer > DGtal::detail::AffineGeometryScalarOperations< TScalar >::getMultipliers ( Integer  a,
Integer  b 
)
inlinestaticprivate
Parameters
[in]aany integer number
[in]bany integer number
Returns
the pair ( b/g, a/g ), where g is gcd(a,b), which allows to cancel a component in a Gauss pivoting algorithm.

Definition at line 222 of file AffineGeometry.h.

223 {
224 const Integer g = gcd( a, b );
225 // return std::make_pair( b / g, a / g );
226 // left multiplier should be positive.
227 return (b >= 0)
228 ? std::make_pair( b / g, a / g )
229 : std::make_pair( -b / g, -a / g );
230 }
STL namespace.
static Integer gcd(Integer a, Integer b)
std::mt19937 g(rd())

References g(), and DGtal::detail::AffineGeometryScalarOperations< TScalar >::gcd().

Referenced by DGtal::AffineGeometry< TPoint >::reduceVector(), and DGtal::AffineGeometry< TPoint >::reduceVector().

◆ isNonZero()

template<typename TScalar >
static bool DGtal::detail::AffineGeometryScalarOperations< TScalar >::isNonZero ( Integer  x,
double   
)
inlinestaticprivate
Parameters
[in]xany integer number
Returns
'true' iff x is non zero.

Definition at line 257 of file AffineGeometry.h.

258 {
259 return x != Integer( 0 );
260 }
Scalar Integer
In the generic class, the type scalar should be an integral type.

Referenced by DGtal::AffineGeometry< TPoint >::addIfIndependent(), DGtal::AffineGeometry< TPoint >::independentVector(), DGtal::AffineGeometry< TPoint >::reduceVector(), and DGtal::AffineGeometry< TPoint >::reduceVector().

◆ lcmPositive()

template<typename TScalar >
static Integer DGtal::detail::AffineGeometryScalarOperations< TScalar >::lcmPositive ( Integer  a,
Integer  b 
)
inlinestaticprivate
Parameters
[in]aany integer number
[in]bany integer number
Returns
the least common multiple of a and b.

Definition at line 247 of file AffineGeometry.h.

248 {
249 const Integer g = gcd( a, b );
250 return (a / g) * b;
251 }

References g(), and DGtal::detail::AffineGeometryScalarOperations< TScalar >::gcd().

Friends And Related Symbol Documentation

◆ DGtal::AffineBasis

template<typename TScalar >
template<typename T >
friend struct DGtal::AffineBasis
friend

Definition at line 205 of file AffineGeometry.h.

◆ DGtal::AffineGeometry

template<typename TScalar >
template<typename T >
friend struct DGtal::AffineGeometry
friend

Definition at line 204 of file AffineGeometry.h.


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