DGtal 1.4.0
Loading...
Searching...
No Matches
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>

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.
 

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

template<typename TShape >
typedef RealPoint DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::Argument

Definition at line 118 of file ShapeGeometricFunctors.h.

◆ Quantity

template<typename TShape >
typedef RealVector DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::Quantity

Definition at line 120 of file ShapeGeometricFunctors.h.

◆ RealPoint

◆ RealVector

template<typename TShape >
typedef Shape::RealVector DGtal::functors::ShapeGeometricFunctors::ShapeNormalVectorFunctor< TShape >::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()

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

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 ) {}
CountedConstPtrOrConstPtr< Shape > myShape
The shape of interest.

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: