DGtal  1.5.beta
DGtal::StandardDSLQ0< TFraction > Class Template Reference

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

#include <DGtal/arithmetic/StandardDSLQ0.h>

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
 the characteristic pattern of this DSL. More...
 
Integer myMu
 the shift to origin. More...
 

Static Private Member Functions

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

Private Attributes

IC ic
 Used in some computations. More...
 

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

◆ Fraction

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

Definition at line 83 of file StandardDSLQ0.h.

◆ IC

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

Definition at line 91 of file StandardDSLQ0.h.

◆ Integer

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

Definition at line 85 of file StandardDSLQ0.h.

◆ IntegerParamType

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

Definition at line 92 of file StandardDSLQ0.h.

◆ Point

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

Definition at line 97 of file StandardDSLQ0.h.

◆ Point2I

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

Definition at line 94 of file StandardDSLQ0.h.

◆ Quotient

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

Definition at line 87 of file StandardDSLQ0.h.

◆ Self

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

Definition at line 84 of file StandardDSLQ0.h.

◆ UnsignedInteger

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

Definition at line 86 of file StandardDSLQ0.h.

◆ Vector2I

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

Definition at line 93 of file StandardDSLQ0.h.

Constructor & Destructor Documentation

◆ ~StandardDSLQ0()

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

Destructor.

◆ StandardDSLQ0() [1/4]

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

Constructor. Null DSL.

◆ StandardDSLQ0() [2/4]

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

Copy constructor.

Parameters
otherthe object to clone.

◆ StandardDSLQ0() [3/4]

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.

◆ StandardDSLQ0() [4/4]

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

◆ a()

template<typename TFraction >
Integer DGtal::StandardDSLQ0< TFraction >::a ( ) const
Returns
a the numerator of the slope.

◆ b()

template<typename TFraction >
Integer DGtal::StandardDSLQ0< TFraction >::b ( ) const
Returns
b the denominator of the slope.

◆ before()

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.

◆ beforeOrEqual()

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.

◆ begin()

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.

◆ deepest() [1/2]

template<typename TFraction >
static Fraction DGtal::StandardDSLQ0< TFraction >::deepest ( Fraction  f1,
Fraction  f2 
)
staticprivate

◆ deepest() [2/2]

template<typename TFraction >
static Fraction DGtal::StandardDSLQ0< TFraction >::deepest ( Fraction  f1,
Fraction  f2,
Fraction  f3 
)
staticprivate

◆ DSSWithinTwoPatterns()

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].

◆ end()

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.

◆ isValid()

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.

◆ L()

template<typename TFraction >
Point DGtal::StandardDSLQ0< TFraction >::L ( ) const
Returns
the first lower leaning point of the DSL with greater x than U().

◆ lowestX()

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.

◆ lowestY()

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.

◆ mu()

template<typename TFraction >
const Integer& DGtal::StandardDSLQ0< TFraction >::mu ( ) const
Returns
the shift to origin, which is also the lower diopantine constraint.

◆ mup()

template<typename TFraction >
Integer DGtal::StandardDSLQ0< TFraction >::mup ( ) const
Returns
the upper diopantine constraint, ie. mu + a + b - 1

◆ operator()()

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.

◆ operator=()

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

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ pattern()

template<typename TFraction >
const Pattern<Fraction>& DGtal::StandardDSLQ0< TFraction >::pattern ( ) const
Returns
the pattern of this DSL

◆ r()

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

◆ reversedSmartDSS() [1/2]

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].

◆ reversedSmartDSS() [2/2]

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 )

◆ selfDisplay()

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.

◆ slope()

template<typename TFraction >
Fraction DGtal::StandardDSLQ0< TFraction >::slope ( ) const
Returns
the slope of this DSL, an irreducible fraction

◆ smartDSS()

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].

◆ U()

template<typename TFraction >
Point DGtal::StandardDSLQ0< TFraction >::U ( ) const
Returns
the first upper leaning point of the DSL in the first quadrant (x >= 0).

◆ uppermostX()

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.

◆ uppermostY()

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.

◆ v()

template<typename TFraction >
Vector2I DGtal::StandardDSLQ0< TFraction >::v ( ) const
Returns
the vector for the pattern, ie ( slope().q(), slope().p() )

Field Documentation

◆ ic

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

Used in some computations.

Definition at line 386 of file StandardDSLQ0.h.

◆ myMu

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

the shift to origin.

Definition at line 381 of file StandardDSLQ0.h.

◆ myPattern

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: