DGtal  1.1.0
Public Types | Public Member Functions | Private Attributes
DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape > Struct Template Reference

Aim: A functor RealPoint -> Quantity that returns the normal vector at given point. More...

#include <DGtal/shapes/ShapeGeometricFunctors.h>

Collaboration diagram for DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >:
[legend]

Public Types

typedef TShape Shape
 
typedef Shape::RealPoint RealPoint
 
typedef Shape::RealVector RealVector
 
typedef RealPoint Argument
 
typedef RealVector::Component Scalar
 
typedef RealVector Quantity
 
typedef Quantity Value
 

Public Member Functions

 ShapeNormalVectorFunctor (ConstAlias< Shape > aShape=0)
 
void attach (ConstAlias< Shape > aShape)
 
Quantity operator() (const RealPoint &p) const
 

Private Attributes

CountedConstPtrOrConstPtr< ShapemyShape
 The shape of interest. More...
 

Detailed Description

template<typename TShape>
struct DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >

Aim: A functor RealPoint -> Quantity that returns the normal vector at given point.

Description of template class 'ShapeNormalVectorFunctor'

Template Parameters
TShapethe type of the shape where geometric estimation are made. It must have methods gradient.

Definition at line 114 of file ShapeGeometricFunctors.h.

Member Typedef Documentation

◆ Argument

Definition at line 118 of file ShapeGeometricFunctors.h.

◆ Quantity

Definition at line 120 of file ShapeGeometricFunctors.h.

◆ RealPoint

Definition at line 116 of file ShapeGeometricFunctors.h.

◆ RealVector

Definition at line 117 of file ShapeGeometricFunctors.h.

◆ Scalar

Definition at line 119 of file ShapeGeometricFunctors.h.

◆ Shape

template<typename TShape >
typedef TShape DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::Shape

Definition at line 115 of file ShapeGeometricFunctors.h.

◆ Value

Definition at line 121 of file ShapeGeometricFunctors.h.

Constructor & Destructor Documentation

◆ ShapeNormalVectorFunctor()

Constructor. A shape may also be attached at construction.

Parameters
aShapethe shape of interest. The alias can be secured if a some counted pointer is handed.

Definition at line 129 of file ShapeGeometricFunctors.h.

129 : myShape( aShape ) {}

Member Function Documentation

◆ attach()

template<typename TShape >
void DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::attach ( ConstAlias< Shape aShape)
inline

Attach a shape.

Parameters
aShapethe shape of interest. The alias can be secured if a some counted pointer is handed.

Definition at line 137 of file ShapeGeometricFunctors.h.

138  {
139  myShape = aShape;
140  }

References DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::myShape.

◆ operator()()

template<typename TShape >
Quantity DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::operator() ( const RealPoint p) const
inline

Map operator RealPoint -> RealVector giving the normal vector.

Parameters
pany point on the shape.
Returns
the normal at point p (as the normalized gradient).

Definition at line 147 of file ShapeGeometricFunctors.h.

148  {
149  RealVector v = myShape->gradient( p );
150  Scalar norm = v.norm();
151  return ( norm != 0 ) ? v / norm : v;
152  }

References DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::myShape.

Field Documentation

◆ myShape


The documentation for this struct was generated from the following file:
DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor::myShape
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.
Definition: ShapeGeometricFunctors.h:156
DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor::Scalar
RealVector::Component Scalar
Definition: ShapeGeometricFunctors.h:119
DGtal::PointVector
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593