DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::FP< TIterator, TInteger, connectivity > Class Template Reference

Aim: Computes the faithful polygon (FP) of a range of 4/8-connected 2D Points. More...

#include <DGtal/geometry/curves/FP.h>

Public Types

typedef DGtal::PointVector< 2, TInteger > Point
 
typedef DGtal::PointVector< 2, TInteger > Vector
 
typedef DGtal::PointVector< 2, double > RealPoint
 
typedef DGtal::PointVector< 2, double > RealVector
 
typedef DGtal::ArithmeticalDSSComputer< TIterator, TInteger, connectivity > DSSComputer
 
typedef std::list< PointPolygon
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CInteger< TInteger >))
 
 FP (const TIterator &itb, const TIterator &ite)
 
 ~FP ()
 
const Polygonpolygon () const
 
bool isClosed () const
 
bool isValid () const
 
Polygon::size_type size () const
 
template<typename OutputIterator >
OutputIterator copyFP (OutputIterator result) const
 
template<typename OutputIterator >
OutputIterator copyMLP (OutputIterator result) const
 
void selfDisplay (std::ostream &out) const
 
std::string className () const
 

Private Member Functions

template<typename Adapter >
Adapter * initConvexityConcavity (typename Adapter::DSS &aDSS)
 
template<typename Adapter >
bool removingStep (Adapter *adapter)
 
template<typename Adapter >
bool addingStep (Adapter *adapter, const typename Adapter::DSS::ConstIterator &itEnd)
 
template<typename Adapter >
void addingStep (Adapter *adapter)
 
void algorithm (const TIterator &itb, const TIterator &ite)
 
void algorithm (const TIterator &itb, const TIterator &ite, IteratorType)
 
void algorithm (const TIterator &itb, const TIterator &ite, CirculatorType)
 
bool isValid (const Point &a, const Point &b, const Point &c) const
 
bool quadrant (const Vector &v, const int &q) const
 
RealPoint getRealPoint (const Point &a, const Point &b, const Point &c) const
 
 FP (const FP &other)
 
FPoperator= (const FP &other)
 

Private Attributes

Polygon myPolygon
 

Detailed Description

template<typename TIterator, typename TInteger, int connectivity>
class DGtal::FP< TIterator, TInteger, connectivity >

Aim: Computes the faithful polygon (FP) of a range of 4/8-connected 2D Points.

The FP has several interesting properties:

It is computed in the course of the maximal digital straight segments computation, because in convex parts (resp. concave parts), the first and last upper (resp. lower) leaning points of segments that are maximal at the front or at the back are also vertices of the FP.

See also
ArithmeticalDSSComputer DSSDecorator DSSDecorator4ConvexPart DSSDecorator4ConcavePart
Note
T. ROUSSILLON and I. SIVIGNON, Faithful polygonal representation of the convex and concave parts of a digital curve, Pattern Recognition, Volume 44, Issues 10-11, October-November 2011, Pages 2693-2700.

Usage:

//r is a range of 4-connected 2D points
FP<ConstIterator, Integer, 4> theFP( r .begin(), r.end() );
Aim: Computes the faithful polygon (FP) of a range of 4/8-connected 2D Points.
Definition: FP.h:293

Once the FP is computed, copyFP() is a way of geting its vertices. In the same way, copyMLP() is a way of getting the vertices of the MLP.

Template Parameters
TIteratortype ConstIterator on 2D points,
TInteger(satisfying CInteger)
connectivity4 for standard (4-connected) DSS or 8 for naive (8-connected) DSS. (Any other integers act as 8).
See also
testFP.cpp

Definition at line 292 of file FP.h.

Member Typedef Documentation

◆ DSSComputer

template<typename TIterator , typename TInteger , int connectivity>
typedef DGtal::ArithmeticalDSSComputer<TIterator,TInteger,connectivity> DGtal::FP< TIterator, TInteger, connectivity >::DSSComputer

Definition at line 307 of file FP.h.

◆ Point

template<typename TIterator , typename TInteger , int connectivity>
typedef DGtal::PointVector<2,TInteger> DGtal::FP< TIterator, TInteger, connectivity >::Point

Definition at line 301 of file FP.h.

◆ Polygon

template<typename TIterator , typename TInteger , int connectivity>
typedef std::list<Point> DGtal::FP< TIterator, TInteger, connectivity >::Polygon

Definition at line 309 of file FP.h.

◆ RealPoint

template<typename TIterator , typename TInteger , int connectivity>
typedef DGtal::PointVector<2, double> DGtal::FP< TIterator, TInteger, connectivity >::RealPoint

Definition at line 304 of file FP.h.

◆ RealVector

template<typename TIterator , typename TInteger , int connectivity>
typedef DGtal::PointVector<2, double> DGtal::FP< TIterator, TInteger, connectivity >::RealVector

Definition at line 305 of file FP.h.

◆ Vector

template<typename TIterator , typename TInteger , int connectivity>
typedef DGtal::PointVector<2,TInteger> DGtal::FP< TIterator, TInteger, connectivity >::Vector

Definition at line 302 of file FP.h.

Constructor & Destructor Documentation

◆ FP() [1/2]

template<typename TIterator , typename TInteger , int connectivity>
DGtal::FP< TIterator, TInteger, connectivity >::FP ( const TIterator &  itb,
const TIterator &  ite 
)

Constructor.

Parameters
itbbegin iterator
iteend iterator

◆ ~FP()

template<typename TIterator , typename TInteger , int connectivity>
DGtal::FP< TIterator, TInteger, connectivity >::~FP ( )

Destructor.

◆ FP() [2/2]

template<typename TIterator , typename TInteger , int connectivity>
DGtal::FP< TIterator, TInteger, connectivity >::FP ( const FP< TIterator, TInteger, connectivity > &  other)
private

Copy constructor.

Parameters
otherthe object to clone. Forbidden by default.

Member Function Documentation

◆ addingStep() [1/2]

template<typename TIterator , typename TInteger , int connectivity>
template<typename Adapter >
void DGtal::FP< TIterator, TInteger, connectivity >::addingStep ( Adapter *  adapter)
private

Adding step in the closed case

Parameters
adapteran Adapter to the current DSS
Template Parameters
Adaptertype that adapts a DSS computer
See also
details::DSSDecorator details::DSSDecorator4ConvexParts details::DSSDecorator4ConcaveParts

◆ addingStep() [2/2]

template<typename TIterator , typename TInteger , int connectivity>
template<typename Adapter >
bool DGtal::FP< TIterator, TInteger, connectivity >::addingStep ( Adapter *  adapter,
const typename Adapter::DSS::ConstIterator &  itEnd 
)
private

Adding step in the open case

Parameters
adapteran Adapter to the current DSS
itEndend iterator used to stop the algorithm (when currentDSS.end() == itEnd )
Returns
'false' if the algorithm has to stop and 'true' otherwise
Template Parameters
Adaptertype that adapts a DSS computer
See also
details::DSSDecorator details::DSSDecorator4ConvexParts details::DSSDecorator4ConcaveParts

◆ algorithm() [1/3]

template<typename TIterator , typename TInteger , int connectivity>
void DGtal::FP< TIterator, TInteger, connectivity >::algorithm ( const TIterator &  itb,
const TIterator &  ite 
)
private

Main algorithm

Parameters
itbbegin iterator
iteend iterator

◆ algorithm() [2/3]

template<typename TIterator , typename TInteger , int connectivity>
void DGtal::FP< TIterator, TInteger, connectivity >::algorithm ( const TIterator &  itb,
const TIterator &  ite,
CirculatorType   
)
private

Main algorithm overloading for circular iterator types (process as closed)

Parameters
itbbegin iterator
iteend iterator

◆ algorithm() [3/3]

template<typename TIterator , typename TInteger , int connectivity>
void DGtal::FP< TIterator, TInteger, connectivity >::algorithm ( const TIterator &  itb,
const TIterator &  ite,
IteratorType   
)
private

Main algorithm overloading for classic iterator types (process as open)

Parameters
itbbegin iterator
iteend iterator

◆ BOOST_CONCEPT_ASSERT()

template<typename TIterator , typename TInteger , int connectivity>
DGtal::FP< TIterator, TInteger, connectivity >::BOOST_CONCEPT_ASSERT ( (concepts::CInteger< TInteger >)  )

◆ className()

template<typename TIterator , typename TInteger , int connectivity>
std::string DGtal::FP< TIterator, TInteger, connectivity >::className ( ) const
Returns
the style name used for drawing this object.

◆ copyFP()

template<typename TIterator , typename TInteger , int connectivity>
template<typename OutputIterator >
OutputIterator DGtal::FP< TIterator, TInteger, connectivity >::copyFP ( OutputIterator  result) const
Returns
the vertices of the FP NB: O(n)

◆ copyMLP()

template<typename TIterator , typename TInteger , int connectivity>
template<typename OutputIterator >
OutputIterator DGtal::FP< TIterator, TInteger, connectivity >::copyMLP ( OutputIterator  result) const
Returns
the vertices of the MLP NB: O(n)

◆ getRealPoint()

template<typename TIterator , typename TInteger , int connectivity>
RealPoint DGtal::FP< TIterator, TInteger, connectivity >::getRealPoint ( const Point a,
const Point b,
const Point c 
) const
private

Gets a MLP vertex from three consecutive vertices of the FP.

Parameters
aprevious vertex of the FP
bcurrent vertex of the FP
cnext vertex of the FP
Returns
vertex of the MLP, which is the tranlated of b by (+- 0.5, +- 0.5)

◆ initConvexityConcavity()

template<typename TIterator , typename TInteger , int connectivity>
template<typename Adapter >
Adapter * DGtal::FP< TIterator, TInteger, connectivity >::initConvexityConcavity ( typename Adapter::DSS &  aDSS)
private

A DSS adapter is returned according to the local convexity/concavity

Parameters
aDSSa DSS lying on the range to process
Returns
an adapter to aDSS for convex or concave part
Template Parameters
Adaptertype that adapts a DSS computer
See also
details::DSSDecorator details::DSSDecorator4ConvexParts details::DSSDecorator4ConcaveParts

◆ isClosed()

template<typename TIterator , typename TInteger , int connectivity>
bool DGtal::FP< TIterator, TInteger, connectivity >::isClosed ( ) const
Returns
true if the list has to be consider as circular.

◆ isValid() [1/2]

template<typename TIterator , typename TInteger , int connectivity>
bool DGtal::FP< TIterator, TInteger, connectivity >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

Referenced by testFP().

◆ isValid() [2/2]

template<typename TIterator , typename TInteger , int connectivity>
bool DGtal::FP< TIterator, TInteger, connectivity >::isValid ( const Point a,
const Point b,
const Point c 
) const
private

Checks if a turn defined by three consecutive vertices of the FP is valid or not

Parameters
aprevious vertex of the FP
bcurrent vertex of the FP
cnext vertex of the FP
Returns
'true' if valid, 'false' otherwise.

◆ operator=()

template<typename TIterator , typename TInteger , int connectivity>
FP & DGtal::FP< TIterator, TInteger, connectivity >::operator= ( const FP< TIterator, TInteger, connectivity > &  other)
private

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'. Forbidden by default.

◆ polygon()

template<typename TIterator , typename TInteger , int connectivity>
const Polygon & DGtal::FP< TIterator, TInteger, connectivity >::polygon ( ) const
Returns
the list where each vertex of the FP is stored.

◆ quadrant()

template<typename TIterator , typename TInteger , int connectivity>
bool DGtal::FP< TIterator, TInteger, connectivity >::quadrant ( const Vector v,
const int &  q 
) const
private

Returns the quadrant number of a vector

Parameters
vany vector
qa quandrant number (0,1,2 or 3)
Returns
'true' if v lies in quadrant number q, 'false' otherwise

◆ removingStep()

template<typename TIterator , typename TInteger , int connectivity>
template<typename Adapter >
bool DGtal::FP< TIterator, TInteger, connectivity >::removingStep ( Adapter *  adapter)
private

Removing step

Parameters
adapteran Adapter to the current DSS
Returns
'false' if the underlying digital curve is detected as disconnected and 'true' otherwise
Template Parameters
Adaptertype that adapts a DSS computer
See also
details::DSSDecorator details::DSSDecorator4ConvexParts details::DSSDecorator4ConcaveParts

◆ selfDisplay()

template<typename TIterator , typename TInteger , int connectivity>
void DGtal::FP< TIterator, TInteger, connectivity >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ size()

template<typename TIterator , typename TInteger , int connectivity>
Polygon::size_type DGtal::FP< TIterator, TInteger, connectivity >::size ( ) const
Returns
number of FP vertices

Field Documentation

◆ myPolygon

template<typename TIterator , typename TInteger , int connectivity>
Polygon DGtal::FP< TIterator, TInteger, connectivity >::myPolygon
private

List where each vertex of the FP is stored

Definition at line 379 of file FP.h.


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