DGtal 1.4.0
|
Aim: On-line recognition of a digital straight segment (DSS) defined as a sequence of connected grid edges such that there is at least one straight line that separates the centers of the two incident pixels of each grid edge. More...
#include <DGtal/geometry/curves/StabbingLineComputer.h>
Public Types | |
typedef TConstIterator | ConstIterator |
typedef StabbingLineComputer< ConstIterator > | Self |
typedef StabbingLineComputer< ReverseIterator< ConstIterator > > | Reverse |
typedef IteratorCirculatorTraits< ConstIterator >::Value | Pair |
typedef Pair::first_type | Point |
typedef StraightLineFrom2Points< Point > | StraightLine |
typedef Preimage2D< StraightLine > | Preimage |
typedef CowPtr< Preimage > | PreimagePtr |
Public Member Functions | |
BOOST_STATIC_ASSERT ((concepts::ConceptUtils::SameType< typename Pair::first_type, typename Pair::second_type > ::value)) | |
StabbingLineComputer () | |
StabbingLineComputer (const Self &other) | |
Self & | operator= (const Self &other) |
~StabbingLineComputer () | |
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 |
Point | Uf () const |
Point | Ul () const |
Point | Lf () const |
Point | Ll () const |
PreimagePtr | getPreimage () const |
bool | isClockwiseOriented () const |
void | getParameters (double &alpha, double &beta, double &gamma) const |
void | projects (double &x, double &y, const double &alpha, const double &beta, const double &gamma) const |
void | init (const ConstIterator &anIt) |
bool | extendFront () |
bool | isExtendableFront () |
bool | isConcave () |
bool | isConvex () |
bool | extendBack () |
bool | isExtendableBack () |
bool | isOppositeEndConcave () |
bool | isOppositeEndConvex () |
void | selfDisplay (std::ostream &out) const |
std::string | className () const |
Private Attributes | |
ConstIterator | myBegin |
ConstIterator | myEnd |
PreimagePtr | myPreimagePtr |
bool | myFlagIsInit |
bool | myFlagIsCW |
Aim: On-line recognition of a digital straight segment (DSS) defined as a sequence of connected grid edges such that there is at least one straight line that separates the centers of the two incident pixels of each grid edge.
The algorithm computes and maintains the preimage of the whole set of separating straight lines in linear time using Preimage2D and the algorithm of O'Rourke (1981).
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:
TConstIterator | ConstIterator type on STL pairs of 2D points |
Definition at line 92 of file StabbingLineComputer.h.
typedef TConstIterator DGtal::StabbingLineComputer< TConstIterator >::ConstIterator |
Definition at line 98 of file StabbingLineComputer.h.
typedef IteratorCirculatorTraits<ConstIterator>::Value DGtal::StabbingLineComputer< TConstIterator >::Pair |
Definition at line 103 of file StabbingLineComputer.h.
typedef Pair::first_type DGtal::StabbingLineComputer< TConstIterator >::Point |
Definition at line 104 of file StabbingLineComputer.h.
typedef Preimage2D<StraightLine> DGtal::StabbingLineComputer< TConstIterator >::Preimage |
Definition at line 113 of file StabbingLineComputer.h.
typedef CowPtr<Preimage> DGtal::StabbingLineComputer< TConstIterator >::PreimagePtr |
Definition at line 114 of file StabbingLineComputer.h.
typedef StabbingLineComputer<ReverseIterator<ConstIterator> > DGtal::StabbingLineComputer< TConstIterator >::Reverse |
Definition at line 100 of file StabbingLineComputer.h.
typedef StabbingLineComputer<ConstIterator> DGtal::StabbingLineComputer< TConstIterator >::Self |
Definition at line 99 of file StabbingLineComputer.h.
typedef StraightLineFrom2Points<Point> DGtal::StabbingLineComputer< TConstIterator >::StraightLine |
Definition at line 112 of file StabbingLineComputer.h.
DGtal::StabbingLineComputer< TConstIterator >::StabbingLineComputer | ( | ) |
Constructor.
DGtal::StabbingLineComputer< TConstIterator >::StabbingLineComputer | ( | const Self & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::StabbingLineComputer< TConstIterator >::~StabbingLineComputer | ( | ) |
Destructor.
ConstIterator DGtal::StabbingLineComputer< TConstIterator >::begin | ( | ) | const |
Referenced by testStabbingLineComputer().
DGtal::StabbingLineComputer< TConstIterator >::BOOST_STATIC_ASSERT | ( | (concepts::ConceptUtils::SameType< typename Pair::first_type, typename Pair::second_type > ::value) | ) |
std::string DGtal::StabbingLineComputer< TConstIterator >::className | ( | ) | const |
Default drawing style object.
ConstIterator DGtal::StabbingLineComputer< TConstIterator >::end | ( | ) | const |
Referenced by testStabbingLineComputer().
bool DGtal::StabbingLineComputer< TConstIterator >::extendBack | ( | ) |
Backward extension of the segment.
Referenced by testStabbingLineComputer().
bool DGtal::StabbingLineComputer< TConstIterator >::extendFront | ( | ) |
Forward extension of the segment.
Referenced by testStabbingLineComputer().
void DGtal::StabbingLineComputer< TConstIterator >::getParameters | ( | double & | alpha, |
double & | beta, | ||
double & | gamma ) const |
Get the parameters of one separating straight line
alpha | (returned) x-component of the normal |
beta | (returned) y-component of the normal |
gamma | (returned) intercept |
Referenced by testStabbingLineComputer().
PreimagePtr DGtal::StabbingLineComputer< TConstIterator >::getPreimage | ( | ) | const |
Reverse DGtal::StabbingLineComputer< TConstIterator >::getReverse | ( | ) | const |
Referenced by testStabbingLineComputer().
Self DGtal::StabbingLineComputer< TConstIterator >::getSelf | ( | ) | const |
void DGtal::StabbingLineComputer< TConstIterator >::init | ( | const ConstIterator & | anIt | ) |
Segment initialization
anIt | any iterator |
Referenced by main(), and testStabbingLineComputer().
bool DGtal::StabbingLineComputer< TConstIterator >::isClockwiseOriented | ( | ) | const |
bool DGtal::StabbingLineComputer< TConstIterator >::isConcave | ( | ) |
Decide whether the extension of the segment would result in a concave part or not.
NB: a true returned value implies that isExtendableFront() returns 'false'
bool DGtal::StabbingLineComputer< TConstIterator >::isConvex | ( | ) |
Decide whether the extension of the segment would result in a convex part or not.
NB: a true returned value implies that isExtendableFront() returns 'false'
bool DGtal::StabbingLineComputer< TConstIterator >::isExtendableBack | ( | ) |
Backward extension test.
bool DGtal::StabbingLineComputer< TConstIterator >::isExtendableFront | ( | ) |
Forward extension test.
Referenced by testStabbingLineComputer().
bool DGtal::StabbingLineComputer< TConstIterator >::isOppositeEndConcave | ( | ) |
Decide whether the extension of the segment would result in a concave part or not.
NB: a true returned value implies that isExtendableBack() returns 'false'
bool DGtal::StabbingLineComputer< TConstIterator >::isOppositeEndConvex | ( | ) |
Decide whether the extension of the segment would result in a convex part or not.
NB: a true returned value implies that isExtendableBack() returns 'false'
bool DGtal::StabbingLineComputer< TConstIterator >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
Referenced by testStabbingLineComputer().
Point DGtal::StabbingLineComputer< TConstIterator >::Lf | ( | ) | const |
Referenced by testStabbingLineComputer().
Point DGtal::StabbingLineComputer< TConstIterator >::Ll | ( | ) | const |
Referenced by testStabbingLineComputer().
bool DGtal::StabbingLineComputer< TConstIterator >::operator!= | ( | const Self & | other | ) | const |
Difference operator
other | the object to compare with. |
Self & DGtal::StabbingLineComputer< TConstIterator >::operator= | ( | const Self & | other | ) |
Assignment.
other | the object to copy. |
bool DGtal::StabbingLineComputer< TConstIterator >::operator== | ( | const Self & | other | ) | const |
Equality operator
other | the object to compare with. |
void DGtal::StabbingLineComputer< TConstIterator >::projects | ( | double & | x, |
double & | y, | ||
const double & | alpha, | ||
const double & | beta, | ||
const double & | gamma ) const |
Projects the point ( x , y ) onto the straight line of parameters ( alpha , beta , gamma )
x | (returned) x-coordinate of the point |
y | (returned) y-coordinate of the point |
alpha | x-component of the direction vector |
beta | y-component of the direction vector |
gamma | intercept |
void DGtal::StabbingLineComputer< TConstIterator >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
Point DGtal::StabbingLineComputer< TConstIterator >::Uf | ( | ) | const |
Referenced by testStabbingLineComputer().
Point DGtal::StabbingLineComputer< TConstIterator >::Ul | ( | ) | const |
Referenced by testStabbingLineComputer().
|
private |
segment begin iterator.
Definition at line 348 of file StabbingLineComputer.h.
|
private |
segment end iterator.
Definition at line 352 of file StabbingLineComputer.h.
|
private |
Flag equal to 'true' if the pairs of points are clockwise oriented, 'false' otherwise.
Definition at line 366 of file StabbingLineComputer.h.
|
private |
Flag equal to 'true' if the segment contains at least two pairs (the orientation is known) and 'false' otherwise.
Definition at line 361 of file StabbingLineComputer.h.
|
private |
Pointer to the preimage.
Definition at line 356 of file StabbingLineComputer.h.