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

DGtal::ArithmeticalDSS< TDSS > Class Template Reference

Aim: Recognition of a digital straight segment (DSS) defined as the sequence of connected points (x,y) such that mu <= ax - by < mu + omega. (see Debled and Reveilles (1995)). More...

#include <ArithmeticalDSS.h>

Collaboration diagram for DGtal::ArithmeticalDSS< TDSS >:
Collaboration graph
[legend]

Data Structures

struct  DefaultDrawStyleBB
struct  DefaultDrawStylePoints

Public Types

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

Public Member Functions

 ArithmeticalDSS ()
 ArithmeticalDSS (const Point &aFirstPoint, const Point &aSecondPoint)
 ArithmeticalDSS (const ArithmeticalDSS &other)
ArithmeticalDSSoperator= (const ArithmeticalDSS &other)
bool operator== (const ArithmeticalDSS &other) const
bool operator!= (const ArithmeticalDSS &other) const
 ~ArithmeticalDSS ()
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
bool isValid () const
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)
void selfDrawAsDigitalPoints (DGtalBoard &board) const
void selfDrawAsBoundingBox (DGtalBoard &board) const
DrawableWithDGtalBoarddefaultStyle (std::string mode="") const
std::string styleName () const
void selfDraw (DGtalBoard &board) const

Protected Attributes

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

Private Member Functions

Vector vectorFrom0ToOmega () const
Point next (const Point &aPoint) const

Detailed Description

template<typename TDSS>
class DGtal::ArithmeticalDSS< TDSS >

Aim: Recognition of a digital straight segment (DSS) defined as the sequence of connected points (x,y) such that mu <= ax - by < mu + omega. (see Debled and Reveilles (1995)).

Description of class 'ArithmeticalDSS'

For the classical naive and standard DSS, this class can be templated by one of two classes providing elementary services (such as the definition of the width paramater).

Here is a short example of how to use this class:

 typedef int Coordinate;
 typedef PointVector<2,Coordinate> Point;
 typedef ArithmeticalDSS<StandardBase<Coordinate> > DSS4;

 std::vector<Point> contour;
 contour.push_back(Point(0,0));
 contour.push_back(Point(1,0));
 contour.push_back(Point(1,1));
 contour.push_back(Point(2,1));
 contour.push_back(Point(3,1));
 
 DSS4 theDSS4(contour.at(0),contour.at(1));
 int i = 2;
 while (theDSS4.addFront(contour.at(i))) {
   i++;
 }
 HyperRectDomain<SpaceND<2> > domain( Point(  -10, -10  ), Point(  10, 10  ) );
 
 DGtalBoard board;
 board.setUnit(Board::UCentimeter);
 
 // Draw the domain as a grid, and the DSS (default draws both the bounding box and the set of points)
 board << DrawDomainGrid() << domain;
 board << theDSS4;
 
 board.saveSVG("DSS4.svg");
See also:
StandardBase
NaiveBase
Examples:

dgtalboard-5-greedy-dss.cpp.


Member Typedef Documentation

template<typename TDSS >
typedef TDSS::Integer DGtal::ArithmeticalDSS< TDSS >::Integer
template<typename TDSS >
typedef DGtal::PointVector<2,Integer> DGtal::ArithmeticalDSS< TDSS >::Point
template<typename TDSS >
typedef DGtal::PointVector<2,double> DGtal::ArithmeticalDSS< TDSS >::PointD
template<typename TDSS >
typedef DGtal::PointVector<2,Integer> DGtal::ArithmeticalDSS< TDSS >::Vector

Constructor & Destructor Documentation

template<typename TDSS >
DGtal::ArithmeticalDSS< TDSS >::ArithmeticalDSS (  ) 

Constructor.

template<typename TDSS >
DGtal::ArithmeticalDSS< TDSS >::ArithmeticalDSS ( const Point aFirstPoint,
const Point aSecondPoint 
)

Constructor.

Parameters:
aFirstPoint and aSecondPoint, two connected points for initialisation
template<typename TDSS >
DGtal::ArithmeticalDSS< TDSS >::ArithmeticalDSS ( const ArithmeticalDSS< TDSS > &  other  ) 

Copy constructor.

Parameters:
other the object to clone. Forbidden by default.
template<typename TDSS >
DGtal::ArithmeticalDSS< TDSS >::~ArithmeticalDSS (  )  [inline]

Destructor.


Member Function Documentation

template<typename TDSS >
bool DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
DrawableWithDGtalBoard* DGtal::ArithmeticalDSS< TDSS >::defaultStyle ( std::string  mode = ""  )  const

Default drawing style object.

Returns:
the dyn. alloc. default style for this object.
template<typename TDSS >
Integer DGtal::ArithmeticalDSS< TDSS >::getA (  )  const

myA accessor

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

myB accessor

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

Accessor to the first point of the DSS

Returns:
first point.
template<typename TDSS >
Point DGtal::ArithmeticalDSS< TDSS >::getL (  )  const

Accessor to the last point of the DSS

Returns:
last point.
template<typename TDSS >
Point DGtal::ArithmeticalDSS< TDSS >::getLf (  )  const

Accessor to the first lower leaning point

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

Accessor to the last lower leaning point

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

myMu accessor

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

myOmega accessor

Returns:
an Integer of value myOmega.
template<typename TDSS >
Integer DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
Point DGtal::ArithmeticalDSS< TDSS >::getUf (  )  const

Accessor to the first upper leaning point

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

Accessor to the last upper leaning point

Returns:
last upper leaning point.
template<typename TDSS >
bool DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
bool DGtal::ArithmeticalDSS< TDSS >::isInDSS ( const Point aPoint  )  const

Checks whether a point belongs to the DSS or not

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

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename TDSS >
Point DGtal::ArithmeticalDSS< TDSS >::next ( const Point aPoint  )  const [private]

Returns the point that follows a given point of a DSL

Parameters:
a,b,mu,omega,the parameters of the DSL and aPoint, a given point of the DSL.
Returns:
the next point.
template<typename TDSS >
bool DGtal::ArithmeticalDSS< TDSS >::operator!= ( const ArithmeticalDSS< TDSS > &  other  )  const

Difference operator.

Parameters:
other the object to compare with.
Returns:
'false' if equal 'true' otherwise
template<typename TDSS >
ArithmeticalDSS& DGtal::ArithmeticalDSS< TDSS >::operator= ( const ArithmeticalDSS< TDSS > &  other  ) 

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'. Forbidden by default.
template<typename TDSS >
bool DGtal::ArithmeticalDSS< TDSS >::operator== ( const ArithmeticalDSS< TDSS > &  other  )  const

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
template<typename TDSS >
PointD DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
PointD DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
PointD DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
double DGtal::ArithmeticalDSS< TDSS >::projectedSegmentLength (  )  const

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

Returns:
the projected length of the segment.
See also:
projectRegularly
template<typename TDSS >
std::vector<Point> DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
bool DGtal::ArithmeticalDSS< TDSS >::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 TDSS >
void DGtal::ArithmeticalDSS< TDSS >::selfDisplay ( std::ostream &  out  ) 

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.
template<typename TDSS >
void DGtal::ArithmeticalDSS< TDSS >::selfDraw ( DGtalBoard board  )  const

Draw the DSS on a LiBoard board as its bounding box and the polyline of its points

See also:
BoundingBoxDraw
DigitalPointsDraw
Parameters:
board the output board where the object is drawn.
template<typename TDSS >
void DGtal::ArithmeticalDSS< TDSS >::selfDrawAsBoundingBox ( DGtalBoard board  )  const

Draw the bounding box of the DSS 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 TDSS >
void DGtal::ArithmeticalDSS< TDSS >::selfDrawAsDigitalPoints ( DGtalBoard board  )  const

Draw the retrieved digital points of the DSS linked into a polygonal line 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 TDSS >
std::string DGtal::ArithmeticalDSS< TDSS >::styleName (  )  const
Returns:
the style name used for drawing this object.
template<typename TDSS >
Vector DGtal::ArithmeticalDSS< TDSS >::vectorFrom0ToOmega (  )  const [private]

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

Returns:
the 2D vector.

Field Documentation

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

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