DGtal  1.3.beta
Public Types | Public Member Functions | Data Fields
DGtal::functors::HatPointFunction< TPoint, TScalar > Struct Template Reference

#include <DGtal/kernel/Point2ScalarFunctors.h>

Public Types

typedef TPoint Point
 
typedef TScalar Scalar
 
typedef Point argument_type
 
typedef Scalar value_type
 

Public Member Functions

 HatPointFunction (Scalar v0, Scalar r)
 
Scalar operator() (const Point &p) const
 

Data Fields

Scalar myV0
 
Scalar myV0OverR
 
Scalar myR
 
Scalar myR2
 

Detailed Description

template<typename TPoint, typename TScalar>
struct DGtal::functors::HatPointFunction< TPoint, TScalar >

The hat function of value v0 at point 0 with a linear decrease to 0 at distance r. A function Point -> Scalar.

Examples
geometry/surfaces/dvcm-3d.cpp, and geometry/volumes/dvcm-2d.cpp.

Definition at line 55 of file Point2ScalarFunctors.h.

Member Typedef Documentation

◆ argument_type

template<typename TPoint , typename TScalar >
typedef Point DGtal::functors::HatPointFunction< TPoint, TScalar >::argument_type

Definition at line 58 of file Point2ScalarFunctors.h.

◆ Point

template<typename TPoint , typename TScalar >
typedef TPoint DGtal::functors::HatPointFunction< TPoint, TScalar >::Point

Definition at line 56 of file Point2ScalarFunctors.h.

◆ Scalar

template<typename TPoint , typename TScalar >
typedef TScalar DGtal::functors::HatPointFunction< TPoint, TScalar >::Scalar

Definition at line 57 of file Point2ScalarFunctors.h.

◆ value_type

template<typename TPoint , typename TScalar >
typedef Scalar DGtal::functors::HatPointFunction< TPoint, TScalar >::value_type

Definition at line 59 of file Point2ScalarFunctors.h.

Constructor & Destructor Documentation

◆ HatPointFunction()

template<typename TPoint , typename TScalar >
DGtal::functors::HatPointFunction< TPoint, TScalar >::HatPointFunction ( Scalar  v0,
Scalar  r 
)
inline

Definition at line 67 of file Point2ScalarFunctors.h.

68  : myV0( v0 ), myV0OverR( v0 / r ), myR( r ), myR2( r*r ) {}

Member Function Documentation

◆ operator()()

template<typename TPoint , typename TScalar >
Scalar DGtal::functors::HatPointFunction< TPoint, TScalar >::operator() ( const Point p) const
inline

Definition at line 69 of file Point2ScalarFunctors.h.

70  {
71  Scalar d = 0;
72  for ( typename Point::ConstIterator it = p.begin(), itE = p.end(); it != itE; ++it )
73  d += functions::square( (Scalar) *it );
74  if ( d >= myR2 ) return 0.0;
75  d = sqrt( d );
76  return myV0 - myV0OverR * d;
77  }

References DGtal::functors::HatPointFunction< TPoint, TScalar >::myR2, DGtal::functors::HatPointFunction< TPoint, TScalar >::myV0, DGtal::functors::HatPointFunction< TPoint, TScalar >::myV0OverR, and DGtal::functions::square().

Field Documentation

◆ myR

template<typename TPoint , typename TScalar >
Scalar DGtal::functors::HatPointFunction< TPoint, TScalar >::myR

Definition at line 63 of file Point2ScalarFunctors.h.

◆ myR2

template<typename TPoint , typename TScalar >
Scalar DGtal::functors::HatPointFunction< TPoint, TScalar >::myR2

◆ myV0

template<typename TPoint , typename TScalar >
Scalar DGtal::functors::HatPointFunction< TPoint, TScalar >::myV0

◆ myV0OverR

template<typename TPoint , typename TScalar >
Scalar DGtal::functors::HatPointFunction< TPoint, TScalar >::myV0OverR

The documentation for this struct was generated from the following file:
ConstIterator
MyDigitalSurface::ConstIterator ConstIterator
Definition: greedy-plane-segmentation-ex2.cpp:93
DGtal::functors::HatPointFunction::myV0OverR
Scalar myV0OverR
Definition: Point2ScalarFunctors.h:62
DGtal::functions::square
T square(T x)
Definition: BasicMathFunctions.h:133
DGtal::functors::HatPointFunction::Scalar
TScalar Scalar
Definition: Point2ScalarFunctors.h:57
DGtal::functors::HatPointFunction::myR2
Scalar myR2
Definition: Point2ScalarFunctors.h:64
DGtal::functors::HatPointFunction::myR
Scalar myR
Definition: Point2ScalarFunctors.h:63
DGtal::functors::HatPointFunction::myV0
Scalar myV0
Definition: Point2ScalarFunctors.h:61