DGtal  1.4.beta
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.

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

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  }
MyDigitalSurface::ConstIterator ConstIterator

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: