Data Structures | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

DGtal::ArithDSS< Domain2D > Class Template Reference

Aim: Recognition of a digital straight segment (DSS) based on the arithmetical algorithm of Debled and Reveilles (1995). More...

#include <ArithDSS.h>

Inheritance diagram for DGtal::ArithDSS< Domain2D >:
Inheritance graph
[legend]

Data Structures

struct  SelfDrawStyle

Public Types

typedef Domain2D::Coordinate Integer
typedef Domain2D::Point Point
typedef Domain2D::Vector Vector
typedef DGtal::PointVector
< 2, double > 
PointD

Public Member Functions

 ArithDSS ()
 ~ArithDSS ()
PointD project (const Point &m) const
PointD project (const Point &m, float r) const
PointD project (const Point &m, const Point &p) const
double projectedSegmentLength () const
void selfDisplay (std::ostream &out)
bool isValid () const
bool addFront (const Point &aPoint)
bool removeBack ()
std::vector< Pointrecover () const
Integer getRemainder (const Point &aPoint) const
bool isInDSL (const Point &aPoint) const
bool isInDSS (const Point &aPoint) const
Integer getA () const
Integer getB () const
Integer getMu () const
Integer getOmega () const
Point getUf () const
Point getUl () const
Point getLf () const
Point getLl () const
Point getF () const
Point getL () const
 ArithDSS (const ArithDSS &other)
ArithDSSoperator= (const ArithDSS &other)
bool operator== (const ArithDSS &other) const
bool operator!= (const ArithDSS &other) const
template<typename Functor >
void selfDraw (LibBoard::Board &board) const
void selfDraw (LibBoard::Board &board) const

Protected Member Functions

virtual Integer norm (const Integer &x, const Integer &y) const =0
virtual bool sameQuadrant (const Vector &aVec) const =0
virtual Vector vectorFrom0ToOmega () const =0
virtual Point next (const Point &aPoint) const =0

Protected Attributes

Integer myA
Integer myB
Integer myMu
Integer myOmega
Point myUf
Point myUl
Point myLf
Point myLl
Point myF
Point myL

Detailed Description

template<typename Domain2D>
class DGtal::ArithDSS< Domain2D >

Aim: Recognition of a digital straight segment (DSS) based on the arithmetical algorithm of Debled and Reveilles (1995).

Description of class 'ArithDSS'


Member Typedef Documentation

template<typename Domain2D >
typedef Domain2D::Coordinate DGtal::ArithDSS< Domain2D >::Integer

Reimplemented in DGtal::ArithDSS4< Domain2D >.

template<typename Domain2D >
typedef Domain2D::Point DGtal::ArithDSS< Domain2D >::Point

Reimplemented in DGtal::ArithDSS4< Domain2D >.

template<typename Domain2D >
typedef DGtal::PointVector<2,double> DGtal::ArithDSS< Domain2D >::PointD
template<typename Domain2D >
typedef Domain2D::Vector DGtal::ArithDSS< Domain2D >::Vector

Reimplemented in DGtal::ArithDSS4< Domain2D >.


Constructor & Destructor Documentation

template<typename Domain2D >
DGtal::ArithDSS< Domain2D >::ArithDSS (  )  [inline]

Constructor.

template<typename Domain2D >
DGtal::ArithDSS< Domain2D >::~ArithDSS (  )  [inline]

Destructor.

template<typename Domain2D >
DGtal::ArithDSS< Domain2D >::ArithDSS ( const ArithDSS< Domain2D > &  other  )  [inline]

Copy constructor.

Parameters:
other the object to clone. Forbidden by default.

Member Function Documentation

template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::addFront ( const Point aPoint  ) 

Tests whether the union between a point (adding to the front of the DSS with respect to the scan orientaion) and a DSS is a DSS. Computes the parameters of the new DSS with the adding point if true.

Parameters:
aPoint the new pixel (connected to the DSS)
Returns:
'true' if the union is a DSS, 'false' otherwise.
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::getA (  )  const

myA accessor

Returns:
an Integer of value myA.
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::getB (  )  const

myB accessor

Returns:
an Integer of value myB.
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::getF (  )  const

Accessor to the first point of the DSS

Returns:
first point.
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::getL (  )  const

Accessor to the last point of the DSS

Returns:
last point.
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::getLf (  )  const

Accessor to the first lower leaning point

Returns:
first lower leaning point.
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::getLl (  )  const

Accessor to the last lower leaning point

Returns:
last lower leaning point.
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::getMu (  )  const

myMu accessor

Returns:
an Integer of value myMu.
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::getOmega (  )  const

myOmega accessor

Returns:
an Integer of value myOmega.
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::getRemainder ( const Point aPoint  )  const

Computes the remainder of a point (that does not necessarily belong to the DSS)

Parameters:
aPoint the point whose remainder is returned
Returns:
the remainder.
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::getUf (  )  const

Accessor to the first upper leaning point

Returns:
first upper leaning point.
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::getUl (  )  const

Accessor to the last upper leaning point

Returns:
last upper leaning point.
template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::isInDSL ( const Point aPoint  )  const

Checks whether a point is in the DSL of parameters (myA,myB,myMu,myOmega)

Returns:
'true' if yes, 'false' otherwise
template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::isInDSS ( const Point aPoint  )  const

Checks whether a point belongs to the DSS or not

Returns:
'true' if yes, 'false' otherwise
template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename Domain2D >
virtual Point DGtal::ArithDSS< Domain2D >::next ( const Point aPoint  )  const [protected, pure virtual]

Returns the point that follows a given point in the DSS

Parameters:
aPoint,a given point of the DSS.
Returns:
the next point.

Implemented in DGtal::ArithDSS4< Domain2D >.

template<typename Domain2D >
virtual Integer DGtal::ArithDSS< Domain2D >::norm ( const Integer x,
const Integer y 
) const [protected, pure virtual]

Computes the norm of the two components of a 2D vector.

Parameters:
x and y, two values.
Returns:
the norm of a 2D vector.

Implemented in DGtal::ArithDSS4< Domain2D >.

template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::operator!= ( const ArithDSS< Domain2D > &  other  )  const [inline]

Difference operator.

Parameters:
other the object to compare with.
Returns:
'false' if equal 'true' otherwise
template<typename Domain2D >
ArithDSS& DGtal::ArithDSS< Domain2D >::operator= ( const ArithDSS< Domain2D > &  other  )  [inline]
template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::operator== ( const ArithDSS< Domain2D > &  other  )  const [inline]

Equality operator.

Parameters:
other the object to compare with.
Returns:
'true' either if the points perfectly match or if the first points match to the last ones (same DSS scanned in the conversed way) and 'false' otherwise

References DGtal::ArithDSS< Domain2D >::myF, DGtal::ArithDSS< Domain2D >::myL, DGtal::ArithDSS< Domain2D >::myLf, DGtal::ArithDSS< Domain2D >::myLl, DGtal::ArithDSS< Domain2D >::myOmega, DGtal::ArithDSS< Domain2D >::myUf, and DGtal::ArithDSS< Domain2D >::myUl.

template<typename Domain2D >
PointD DGtal::ArithDSS< Domain2D >::project ( const Point m,
float  r 
) const

Projects the point [m] onto the straight line whose points have remainder [r].

Parameters:
m any point expressed in the local reference frame (may not be part of the segment).
r the remainder (may not be an integer).
Returns:
the projected point.
template<typename Domain2D >
PointD DGtal::ArithDSS< Domain2D >::project ( const Point m  )  const

Projects the point [m] onto the average straight line (ie (mu+nu)/2).

Parameters:
m any point expressed in the local reference frame (may not be part of the segment).
Returns:
the projected point.
template<typename Domain2D >
PointD DGtal::ArithDSS< Domain2D >::project ( const Point m,
const Point p 
) const

Projects the point [m] onto the straight line going through point [p].

Parameters:
m any point expressed in the local reference frame (may not be part of the segment).
p any point expressed in the local reference frame (may not be part of the segment).
Returns:
the projected point.
template<typename Domain2D >
double DGtal::ArithDSS< Domain2D >::projectedSegmentLength (  )  const

Defined as: norm( project(cp_n) - project(c_n) )

Returns:
the projected length of the segment.
See also:
projectRegularly
template<typename Domain2D >
std::vector<Point> DGtal::ArithDSS< Domain2D >::recover (  )  const

Computes the sequence of (connected) points belonging to the DSL(a,b,mu,omega) between the first and last point of the DSS Nb: in O(omega)

Returns:
the computed sequence of points.
template<typename Domain2D >
bool DGtal::ArithDSS< Domain2D >::removeBack (  ) 

Removes the first point of a DSS (located at the back with respect to the scan orientaion) if the DSS has more than two points

Returns:
'true' if the first point is removed, 'false' otherwise.
template<typename Domain2D >
virtual bool DGtal::ArithDSS< Domain2D >::sameQuadrant ( const Vector aVec  )  const [protected, pure virtual]

Checks whether the DSS lies in one quadrant or not

Parameters:
aVec,the last displacement vector.
Returns:
'true' if yes, 'false' otherwise.

Implemented in DGtal::ArithDSS4< Domain2D >.

template<typename Domain2D >
void DGtal::ArithDSS< Domain2D >::selfDisplay ( std::ostream &  out  ) 

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.
template<typename Domain2D >
void DGtal::ArithDSS< Domain2D >::selfDraw ( LibBoard::Board board  )  const [inline]

Draw the object on a LiBoard board

Parameters:
board the output board where the object is drawn.
Template Parameters:
Functor a Functor to specialize the Board style
template<typename Domain2D >
template<typename Functor >
void DGtal::ArithDSS< Domain2D >::selfDraw ( LibBoard::Board board  )  const

Draw the object on a LiBoard board

Parameters:
board the output board where the object is drawn.
Template Parameters:
Functor a Functor to specialize the Board style
template<typename Domain2D >
virtual Vector DGtal::ArithDSS< Domain2D >::vectorFrom0ToOmega (  )  const [protected, pure virtual]

Returns the 2D vector starting at a point of remainder 0 and pointing at a point of remainder omega

Returns:
the 2D vector.

Implemented in DGtal::ArithDSS4< Domain2D >.


Field Documentation

template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::myA [protected]
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::myB [protected]
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::myF [protected]
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::myL [protected]
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::myLf [protected]
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::myLl [protected]
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::myMu [protected]
template<typename Domain2D >
Integer DGtal::ArithDSS< Domain2D >::myOmega [protected]
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::myUf [protected]
template<typename Domain2D >
Point DGtal::ArithDSS< Domain2D >::myUl [protected]

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