DGtal  0.9.4beta
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
DGtal::StabbingCircleComputer< TConstIterator > Class Template Reference

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

Collaboration diagram for DGtal::StabbingCircleComputer< TConstIterator >:
[legend]

Public Types

typedef TConstIterator ConstIterator
 
typedef StabbingCircleComputer< ConstIteratorSelf
 
typedef StabbingCircleComputer< ReverseIterator< ConstIterator > > Reverse
 
typedef IteratorCirculatorTraits< ConstIterator >::Value Pair
 
typedef Pair::first_type Point
 

Public Member Functions

 BOOST_STATIC_ASSERT ((concepts::ConceptUtils::SameType< typename Pair::first_type, typename Pair::second_type >::value))
 
 BOOST_STATIC_ASSERT ((Point::dimension==2))
 
 StabbingCircleComputer ()
 
 StabbingCircleComputer (const Self &other)
 
Selfoperator= (const Self &other)
 
 ~StabbingCircleComputer ()
 
bool operator== (const Self &other) const
 
bool operator!= (const Self &other) const
 
Self getSelf () const
 
Reverse getReverse () const
 
bool isValid () const
 
ConstIterator begin () const
 
ConstIterator end () const
 
bool isStraight () const
 
StabbingLineComputerPtr getStabbingLineComputerPtr () const
 
Circle getSeparatingCircle () const
 
void init (const ConstIterator &anIt)
 
bool extendFront ()
 
bool isExtendableFront ()
 
bool extendBack ()
 
bool isExtendableBack ()
 
void selfDisplay (std::ostream &out) const
 
std::string className () const
 

Private Types

typedef CowPtr< StabbingLineComputer< ConstIterator > > StabbingLineComputerPtr
 
typedef CircleFrom3Points< PointCircle
 
typedef functors::Point2ShapePredicate< Circle, false, true > PInCirclePred
 
typedef functors::Point2ShapePredicate< Circle, true, true > QInCirclePred
 

Private Member Functions

template<typename TIterator >
bool isCircularlySeparable (const TIterator &itb, const TIterator &ite, const Point &aPole, Point &Pf, Point &Pl, Point &Qf, Point &Ql)
 

Private Attributes

ConstIterator myBegin
 
ConstIterator myEnd
 
StabbingLineComputerPtr mySegPtr
 
Circle myCircle
 
bool myFlagIsInit
 

Detailed Description

template<typename TConstIterator>
class DGtal::StabbingCircleComputer< TConstIterator >

Aim: On-line recognition of a digital circular arcs (DCA) defined as a sequence of connected grid edges such that there is at least one (Euclidean) circle that separates the centers of the two incident pixels of each grid edge.

The algorithm iteratively calls a routine (isCircularlySeparable) that uses Preimage2D in order to compute the whole set of separating (Euclidean) circles passing through a given point. It returns 'false' if the set is empty and 'true' otherwise.

The algorithm may be divided into two steps:

For a DCA of \( n \) grid edges, a trivial upper bound of this algorithm is \( O(n^2) \) because the linear-time routine may be possibly called \( n \) times. But we observed in practice that the routine is called only a few times and that the algorithm is fast.

This class is a model of the concept CBidirectionalSegmentComputer.

It should be used with the Curve object (defined in StdDefs.h) and its IncidentPointsRange as follows:

Curve::IncidentPointsRange r = c.getIncidentPointsRange();
Curve::IncidentPointsRange::ConstIterator itEnd (r.end());
StabbingCircleComputer<Curve::IncidentPointsRange::ConstIterator> s;
//extension
s.init( r.begin() );
while ( ( s.end() != itEnd )
&&( s.extendFront() ) ) {}
Template Parameters
TConstIteratorConstIterator type on STL pairs of 2D points
See also
testStabbingCircleComputer.cpp exampleStabbingCircleComputer.cpp testStabbingLineComputer.cpp exampleStabbingLineComputer.cpp
Examples:
geometry/curves/estimation/exampleCurvature.cpp.

Definition at line 112 of file StabbingCircleComputer.h.

Member Typedef Documentation

template<typename TConstIterator>
typedef CircleFrom3Points<Point> DGtal::StabbingCircleComputer< TConstIterator >::Circle
private

Definition at line 133 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef TConstIterator DGtal::StabbingCircleComputer< TConstIterator >::ConstIterator

Definition at line 118 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef IteratorCirculatorTraits<ConstIterator>::Value DGtal::StabbingCircleComputer< TConstIterator >::Pair

Definition at line 123 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef functors::Point2ShapePredicate<Circle,false,true> DGtal::StabbingCircleComputer< TConstIterator >::PInCirclePred
private

Definition at line 137 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef Pair::first_type DGtal::StabbingCircleComputer< TConstIterator >::Point

Definition at line 126 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef functors::Point2ShapePredicate<Circle,true,true> DGtal::StabbingCircleComputer< TConstIterator >::QInCirclePred
private

Definition at line 139 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef StabbingCircleComputer<ReverseIterator<ConstIterator> > DGtal::StabbingCircleComputer< TConstIterator >::Reverse

Definition at line 120 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef StabbingCircleComputer<ConstIterator> DGtal::StabbingCircleComputer< TConstIterator >::Self

Definition at line 119 of file StabbingCircleComputer.h.

template<typename TConstIterator>
typedef CowPtr<StabbingLineComputer<ConstIterator> > DGtal::StabbingCircleComputer< TConstIterator >::StabbingLineComputerPtr
private

Definition at line 132 of file StabbingCircleComputer.h.

Constructor & Destructor Documentation

template<typename TConstIterator>
DGtal::StabbingCircleComputer< TConstIterator >::StabbingCircleComputer ( )

Constructor.

template<typename TConstIterator>
DGtal::StabbingCircleComputer< TConstIterator >::StabbingCircleComputer ( const Self other)

Copy constructor.

Parameters
otherthe object to clone.
template<typename TConstIterator>
DGtal::StabbingCircleComputer< TConstIterator >::~StabbingCircleComputer ( )

Destructor.

Member Function Documentation

template<typename TConstIterator>
ConstIterator DGtal::StabbingCircleComputer< TConstIterator >::begin ( ) const
Returns
segment begin iterator.
template<typename TConstIterator>
DGtal::StabbingCircleComputer< TConstIterator >::BOOST_STATIC_ASSERT ( (concepts::ConceptUtils::SameType< typename Pair::first_type, typename Pair::second_type >::value)  )
template<typename TConstIterator>
DGtal::StabbingCircleComputer< TConstIterator >::BOOST_STATIC_ASSERT ( (Point::dimension==2)  )
template<typename TConstIterator>
std::string DGtal::StabbingCircleComputer< TConstIterator >::className ( ) const
Returns
the name of the class.
template<typename TConstIterator>
ConstIterator DGtal::StabbingCircleComputer< TConstIterator >::end ( ) const
Returns
segment end iterator.
template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::extendBack ( )

Backward extension of the segment.

NB: linear in the size of the segment is the worst case

template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::extendFront ( )

Forward extension of the segment.

NB: linear in the size of the segment is the worst case

template<typename TConstIterator>
Reverse DGtal::StabbingCircleComputer< TConstIterator >::getReverse ( ) const
Returns
a default-constructed instance of Reverse.
template<typename TConstIterator>
Self DGtal::StabbingCircleComputer< TConstIterator >::getSelf ( ) const
Returns
a default-constructed instance of Self
template<typename TConstIterator>
Circle DGtal::StabbingCircleComputer< TConstIterator >::getSeparatingCircle ( ) const
Returns
a separating circle.
template<typename TConstIterator>
StabbingLineComputerPtr DGtal::StabbingCircleComputer< TConstIterator >::getStabbingLineComputerPtr ( ) const
Returns
a cow pointer on the StabbingLineComputer used during the initialization step.
See also
isStraight
template<typename TConstIterator>
void DGtal::StabbingCircleComputer< TConstIterator >::init ( const ConstIterator anIt)

Segment initialization

Parameters
anItany iterator
template<typename TConstIterator>
template<typename TIterator >
bool DGtal::StabbingCircleComputer< TConstIterator >::isCircularlySeparable ( const TIterator &  itb,
const TIterator &  ite,
const Point aPole,
Point Pf,
Point Pl,
Point Qf,
Point Ql 
)
private

Check if the two sets of points can be separated by circles passing through the given point aPole. If yes, return the four points of support of the partial preimage. The pole and either Pf and Ql or Qf and Pl implicitely describe a separating circle.

Parameters
itbbegin iterator on STL pairs of 2D points.
iteend iterator on STL pairs of 2D points.
aPolethe point the circles pass through.
Pf(returned) first inner point of support.
Pl(returned) last inner point of support.
Qf(returned) first outer point of support.
Ql(returned) last outer point of support.
Template Parameters
TIteratortype of iterator (normal or reverse type)
Returns
'true' if the sets of points can be separated, 'false' otherwise
template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::isExtendableBack ( )

Backward extension test.

NB: linear in the size of the segment is the worst case

template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::isExtendableFront ( )

Forward extension test.

NB: linear in the size of the segment is the worst case

template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::isStraight ( ) const
Returns
boolean equal to 'true' is the segment is straight (infinite radius) and 'false' otherwise.
template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::operator!= ( const Self other) const

Difference operator

Parameters
otherthe object to compare with.
Returns
'true' if not equal, 'false' otherwise.

NB: linear in the size of the segment

template<typename TConstIterator>
Self& DGtal::StabbingCircleComputer< TConstIterator >::operator= ( const Self other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.
template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::operator== ( const Self other) const

Equality operator

Parameters
otherthe object to compare with.
Returns
'true' if equal, 'false' otherwise

NB: linear in the size of the segment

template<typename TConstIterator>
void DGtal::StabbingCircleComputer< TConstIterator >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

template<typename TConstIterator>
ConstIterator DGtal::StabbingCircleComputer< TConstIterator >::myBegin
private

segment begin iterator.

Definition at line 292 of file StabbingCircleComputer.h.

template<typename TConstIterator>
Circle DGtal::StabbingCircleComputer< TConstIterator >::myCircle
private

Separating circle.

Definition at line 304 of file StabbingCircleComputer.h.

template<typename TConstIterator>
ConstIterator DGtal::StabbingCircleComputer< TConstIterator >::myEnd
private

segment end iterator.

Definition at line 296 of file StabbingCircleComputer.h.

template<typename TConstIterator>
bool DGtal::StabbingCircleComputer< TConstIterator >::myFlagIsInit
private

Flag equal to 'true' if mySegPtr has finished its extension 'false' otherwise.

Definition at line 309 of file StabbingCircleComputer.h.

template<typename TConstIterator>
StabbingLineComputerPtr DGtal::StabbingCircleComputer< TConstIterator >::mySegPtr
private

Pointer to the geometrical DSS.

Definition at line 300 of file StabbingCircleComputer.h.


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