DGtal  0.9.4beta
Data Structures | Public Types | Public Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes
DGtal::StandardDSLQ0< TFraction > Class Template Reference

#include <DGtal/arithmetic/StandardDSLQ0.h>

Collaboration diagram for DGtal::StandardDSLQ0< TFraction >:
[legend]

Data Structures

struct  ConstIterator
 

Public Types

typedef TFraction Fraction
 
typedef StandardDSLQ0< TFraction > Self
 
typedef Fraction::Integer Integer
 
typedef Fraction::UnsignedInteger UnsignedInteger
 
typedef Fraction::Quotient Quotient
 
typedef IntegerComputer< IntegerIC
 
typedef IC::IntegerParamType IntegerParamType
 
typedef IC::Vector2I Vector2I
 
typedef IC::Point2I Point2I
 
typedef IC::Point2I Point
 

Public Member Functions

 ~StandardDSLQ0 ()
 
 StandardDSLQ0 ()
 
 StandardDSLQ0 (const StandardDSLQ0 &other)
 
StandardDSLQ0operator= (const StandardDSLQ0 &other)
 
 StandardDSLQ0 (Fraction aSlope, IntegerParamType aMu)
 
 StandardDSLQ0 (IntegerParamType a1, IntegerParamType b1, IntegerParamType mu1)
 
bool operator() (const Point &p) const
 
Fraction slope () const
 
const Integermu () const
 
Integer mup () const
 
Integer a () const
 
Integer b () const
 
Vector2I v () const
 
ConstIterator begin (Point p) const
 
ConstIterator end (Point p) const
 
const Pattern< Fraction > & pattern () const
 
Integer r (const Point &p) const
 
Point U () const
 
Point L () const
 
Point lowestY (IntegerParamType x) const
 
Point uppermostY (IntegerParamType x) const
 
Point lowestX (IntegerParamType y) const
 
Point uppermostX (IntegerParamType y) const
 
bool before (const Point &p1, const Point &p2) const
 
bool beforeOrEqual (const Point &p1, const Point &p2) const
 
Self reversedSmartDSS (const Point &A, const Point &B) const
 
Self reversedSmartDSS (Point U1, Point U2, const Point &A, const Point &B) const
 
Self DSSWithinTwoPatterns (Point U1, Point U2, const Point &A, const Point &B) const
 
Self smartDSS (const Point &A, const Point &B) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Protected Attributes

Pattern< FractionmyPattern
 
Integer myMu
 

Static Private Member Functions

static Fraction deepest (Fraction f1, Fraction f2, Fraction f3)
 
static Fraction deepest (Fraction f1, Fraction f2)
 

Private Attributes

IC ic
 

Detailed Description

template<typename TFraction>
class DGtal::StandardDSLQ0< TFraction >

Aim: Represents a digital straight line with slope in the first quadrant (Q0: x >= 0, y >= 0 ).

Description of template class 'StandardDSLQ0'

It is the 4-connected set of points (x,y) of Z2 satisfying:

\( mu <= ax - by < mu + a + b \)

You may move on it point by point with iterators ConstIterator. You can find upper and lower leaning points, find points on the DSL given one coordinate. You may extract subsegment with smartDSS() and reversedSmartDSS() algorithms.

Template Parameters
TFractionthe type chosen to represent fractions, a model of CFraction. You may use SternBrocot::Fraction for instance.

Model of boost::CopyConstructible, boost::Assignable, concepts::CPointPredicate

See also
The documentation about Digital straight lines and subsegments

Definition at line 79 of file StandardDSLQ0.h.

Member Typedef Documentation

template<typename TFraction>
typedef TFraction DGtal::StandardDSLQ0< TFraction >::Fraction

Definition at line 83 of file StandardDSLQ0.h.

template<typename TFraction>
typedef IntegerComputer<Integer> DGtal::StandardDSLQ0< TFraction >::IC

Definition at line 91 of file StandardDSLQ0.h.

template<typename TFraction>
typedef Fraction::Integer DGtal::StandardDSLQ0< TFraction >::Integer

Definition at line 85 of file StandardDSLQ0.h.

template<typename TFraction>
typedef IC::IntegerParamType DGtal::StandardDSLQ0< TFraction >::IntegerParamType

Definition at line 92 of file StandardDSLQ0.h.

template<typename TFraction>
typedef IC::Point2I DGtal::StandardDSLQ0< TFraction >::Point

Definition at line 97 of file StandardDSLQ0.h.

template<typename TFraction>
typedef IC::Point2I DGtal::StandardDSLQ0< TFraction >::Point2I

Definition at line 94 of file StandardDSLQ0.h.

template<typename TFraction>
typedef Fraction::Quotient DGtal::StandardDSLQ0< TFraction >::Quotient

Definition at line 87 of file StandardDSLQ0.h.

template<typename TFraction>
typedef StandardDSLQ0<TFraction> DGtal::StandardDSLQ0< TFraction >::Self

Definition at line 84 of file StandardDSLQ0.h.

template<typename TFraction>
typedef Fraction::UnsignedInteger DGtal::StandardDSLQ0< TFraction >::UnsignedInteger

Definition at line 86 of file StandardDSLQ0.h.

template<typename TFraction>
typedef IC::Vector2I DGtal::StandardDSLQ0< TFraction >::Vector2I

Definition at line 93 of file StandardDSLQ0.h.

Constructor & Destructor Documentation

template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::~StandardDSLQ0 ( )

Destructor.

template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::StandardDSLQ0 ( )

Constructor. Null DSL.

template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::StandardDSLQ0 ( const StandardDSLQ0< TFraction > &  other)

Copy constructor.

Parameters
otherthe object to clone.
template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::StandardDSLQ0 ( Fraction  aSlope,
IntegerParamType  aMu 
)

Creates the DSL(a,b,mu).

Parameters
aSlopethe slope a/b, where gcd(a,b)=1
aMuthe shift to origin.
template<typename TFraction>
DGtal::StandardDSLQ0< TFraction >::StandardDSLQ0 ( IntegerParamType  a1,
IntegerParamType  b1,
IntegerParamType  mu1 
)

Creates the DSL(a/g,b/g,mu), where g = gcd( a, b).

Parameters
a1any integer
b1any integer
mu1the shift to origin.

Member Function Documentation

template<typename TFraction>
Integer DGtal::StandardDSLQ0< TFraction >::a ( ) const
Returns
a the numerator of the slope.
template<typename TFraction>
Integer DGtal::StandardDSLQ0< TFraction >::b ( ) const
Returns
b the denominator of the slope.
template<typename TFraction>
bool DGtal::StandardDSLQ0< TFraction >::before ( const Point p1,
const Point p2 
) const
Returns
true if p1 is before p2 in the DSL.
template<typename TFraction>
bool DGtal::StandardDSLQ0< TFraction >::beforeOrEqual ( const Point p1,
const Point p2 
) const
Returns
true if p1 is before or equal to p2 in the DSL.
template<typename TFraction>
ConstIterator DGtal::StandardDSLQ0< TFraction >::begin ( Point  p) const
Parameters
pa point in the DSL.
Returns
an iterator on the DSL pointing on p.
template<typename TFraction>
static Fraction DGtal::StandardDSLQ0< TFraction >::deepest ( Fraction  f1,
Fraction  f2,
Fraction  f3 
)
staticprivate
template<typename TFraction>
static Fraction DGtal::StandardDSLQ0< TFraction >::deepest ( Fraction  f1,
Fraction  f2 
)
staticprivate
template<typename TFraction>
Self DGtal::StandardDSLQ0< TFraction >::DSSWithinTwoPatterns ( Point  U1,
Point  U2,
const Point A,
const Point B 
) const

Used by reversedSmartDSS. Computes the exact characteristics of the subsegment [A,B] of this DSL. Note that |U2-U1| = 2 * length().

Parameters
Aany point belonging to this DSL, A < B.
Bany point belonging to this DSL, A < B.
U1the first upper leaning point such that U1 <= A.
U2the second upper leaning point such that B <= U2.
Returns
the minimal DSL containing [A,B].
template<typename TFraction>
ConstIterator DGtal::StandardDSLQ0< TFraction >::end ( Point  p) const
Parameters
pa point in the DSL.
Returns
an iterator on the DSL pointing after p.
template<typename TFraction>
bool DGtal::StandardDSLQ0< TFraction >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.
template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::L ( ) const
Returns
the first lower leaning point of the DSL with greater x than U().
template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::lowestX ( IntegerParamType  y) const
Returns
the point on this DSL with this y coordinate and lowest x coordinate.
template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::lowestY ( IntegerParamType  x) const
Returns
the point on this DSL with this x coordinate and lowest y coordinate.
template<typename TFraction>
const Integer& DGtal::StandardDSLQ0< TFraction >::mu ( ) const
Returns
the shift to origin, which is also the lower diopantine constraint.
template<typename TFraction>
Integer DGtal::StandardDSLQ0< TFraction >::mup ( ) const
Returns
the upper diopantine constraint, ie. mu + a + b - 1
template<typename TFraction>
bool DGtal::StandardDSLQ0< TFraction >::operator() ( const Point p) const
Parameters
pany point in Z2.
Returns
'true' iff the point p belongs to this.
template<typename TFraction>
StandardDSLQ0& DGtal::StandardDSLQ0< TFraction >::operator= ( const StandardDSLQ0< TFraction > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.
template<typename TFraction>
const Pattern<Fraction>& DGtal::StandardDSLQ0< TFraction >::pattern ( ) const
Returns
the pattern of this DSL
template<typename TFraction>
Integer DGtal::StandardDSLQ0< TFraction >::r ( const Point p) const

Remainder a p.x - b p.y of point p in this DSL.

Parameters
pany point in Z2
Returns
a p.x - b p.y
template<typename TFraction>
Self DGtal::StandardDSLQ0< TFraction >::reversedSmartDSS ( const Point A,
const Point B 
) const

Algorithm ReversedSmartDSS. See M. Said and J.-O. Lachaud, DGCI2010.

Computes the exact characteristics of the subsegment [A,B] of this DSL in time O(log(|B-A|)). An even better bound in the output is achieved.

Parameters
Aany point belonging to this DSL, A < B.
Bany point belonging to this DSL, A < B.
Returns
the minimal DSL containing [A,B].
template<typename TFraction>
Self DGtal::StandardDSLQ0< TFraction >::reversedSmartDSS ( Point  U1,
Point  U2,
const Point A,
const Point B 
) const

Algorithm ReversedSmartDSS. See M. Said and J.-O. Lachaud, DGCI2010.

Computes the exact characteristics of the subsegment [A,B] of this DSL in time O(log(|B-A|)). An even better bound in the output is achieved.

Parameters
Aany point belonging to this DSL, A < B.
Bany point belonging to this DSL, A < B.
U1the first upper leaning point such that U1 <= A.
U2the second upper leaning point such that B <= U2.
Returns
the minimal DSL containing [A,B].
See also
reversedSmartDSS( const Point & A, const Point & B )
template<typename TFraction>
void DGtal::StandardDSLQ0< TFraction >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.
template<typename TFraction>
Fraction DGtal::StandardDSLQ0< TFraction >::slope ( ) const
Returns
the slope of this DSL, an irreducible fraction
template<typename TFraction>
Self DGtal::StandardDSLQ0< TFraction >::smartDSS ( const Point A,
const Point B 
) const

Algorithm SmartDSS. See M. Said and J.-O. Lachaud, DGCI2009.

Computes the exact characteristics of the subsegment [A,B] of this DSL in time O(sum_k u_k), where the continued fraction of this DSL slope a/b is [u_0; u_1, u_2, ... ]

Parameters
Aany point belonging to this DSL, A < B.
Bany point belonging to this DSL, A < B.
Returns
the minimal DSL containing [A,B].
template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::U ( ) const
Returns
the first upper leaning point of the DSL in the first quadrant (x >= 0).
template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::uppermostX ( IntegerParamType  y) const
Returns
the point on this DSL with this y coordinate and uppermost x coordinate.
template<typename TFraction>
Point DGtal::StandardDSLQ0< TFraction >::uppermostY ( IntegerParamType  x) const
Returns
the point on this DSL with this x coordinate and uppermost y coordinate.
template<typename TFraction>
Vector2I DGtal::StandardDSLQ0< TFraction >::v ( ) const
Returns
the vector for the pattern, ie ( slope().q(), slope().p() )

Field Documentation

template<typename TFraction>
IC DGtal::StandardDSLQ0< TFraction >::ic
private

Used in some computations.

Definition at line 386 of file StandardDSLQ0.h.

template<typename TFraction>
Integer DGtal::StandardDSLQ0< TFraction >::myMu
protected

the shift to origin.

Definition at line 381 of file StandardDSLQ0.h.

template<typename TFraction>
Pattern<Fraction> DGtal::StandardDSLQ0< TFraction >::myPattern
protected

the characteristic pattern of this DSL.

Definition at line 379 of file StandardDSLQ0.h.


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