DGtal  0.9.4beta
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

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

Definition at line 58 of file Point2ScalarFunctors.h.

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

Definition at line 56 of file Point2ScalarFunctors.h.

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

Definition at line 57 of file Point2ScalarFunctors.h.

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

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

Member Function Documentation

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.

References DGtal::functions::square().

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  }

Field Documentation

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

Definition at line 63 of file Point2ScalarFunctors.h.

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

Definition at line 64 of file Point2ScalarFunctors.h.

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

Definition at line 61 of file Point2ScalarFunctors.h.

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

Definition at line 62 of file Point2ScalarFunctors.h.


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