DGtal  1.2.0
Public Types | Public Member Functions
DGtal::NaiveDSS8< TCoordinate, TInteger > Class Template Reference

Aim: This class represents a standard digital straight segment (DSS), ie. the sequence of simply 8-connected digital points contained in a naive digital straight line (DSL) between two points of it. This class is an alias of ArithmeticalDSS. More...

#include <DGtal/geometry/curves/ArithmeticalDSS.h>

Inheritance diagram for DGtal::NaiveDSS8< TCoordinate, TInteger >:
[legend]

Public Types

typedef ArithmeticalDSS< TCoordinate, TInteger, 8 > Super
 
typedef Super::Point Point
 
typedef Super::Coordinate Coordinate
 
typedef Super::DSL DSL
 
- Public Types inherited from DGtal::ArithmeticalDSS< TCoordinate, TCoordinate, 8 >
typedef TCoordinate Coordinate
 
typedef TCoordinate Integer
 
typedef ArithmeticalDSL< Coordinate, Integer, adjacency > DSL
 
typedef DSL::Space Space
 
typedef DSL::Point Point
 
typedef DSL::Vector Vector
 
typedef DSL::Steps Steps
 
typedef Coordinate Position
 
typedef DSL::ConstIterator ConstIterator
 
typedef DSL::ConstReverseIterator ConstReverseIterator
 
typedef DGtal::PointVector< 2, double > PointD
 

Public Member Functions

 NaiveDSS8 (const Coordinate &aA, const Coordinate &aB, const Point &aF, const Point &aL, const Point &aUf, const Point &aUl, const Point &aLf, const Point &aLl)
 
 NaiveDSS8 (const Point &aF, const Point &aL, const bool &isOnTheUpperLine=true)
 
 NaiveDSS8 (const DSL &aDSL, const Point &aF, const Point &aL)
 
 NaiveDSS8 (const NaiveDSS8 &aDSS, const Point &aF, const Point &aL)
 
template<typename Iterator >
 NaiveDSS8 (const Iterator &aItb, const Iterator &aIte)
 
 NaiveDSS8 (const NaiveDSS8 &aOther)
 
NaiveDSS8operator= (const NaiveDSS8 &aOther)
 
- Public Member Functions inherited from DGtal::ArithmeticalDSS< TCoordinate, TCoordinate, 8 >
 BOOST_CONCEPT_ASSERT ((concepts::CInteger< Coordinate >))
 
 BOOST_CONCEPT_ASSERT ((concepts::CInteger< Integer >))
 
 ArithmeticalDSS (const Point &aPoint)
 
 ArithmeticalDSS (const Coordinate &aA, const Coordinate &aB, const Integer &aLowerBound, const Integer &aUpperBound, const Point &aF, const Point &aL, const Point &aUf, const Point &aUl, const Point &aLf, const Point &aLl, const Steps &aSteps, const Vector &aShift)
 
 ArithmeticalDSS (const DSL &aDSL, const Point &aF, const Point &aL, const Point &aUf, const Point &aUl, const Point &aLf, const Point &aLl)
 
 ArithmeticalDSS (const Coordinate &aA, const Coordinate &aB, const Point &aF, const Point &aL, const Point &aUf, const Point &aUl, const Point &aLf, const Point &aLl)
 
 ArithmeticalDSS (const Point &aF, const Point &aL, const bool &areOnTheUpperLine=true)
 
 ArithmeticalDSS (const DSL &aDSL, const Point &aF, const Point &aL)
 
 ArithmeticalDSS (const ArithmeticalDSS &aDSS, const Point &aF, const Point &aL)
 
 ArithmeticalDSS (const Iterator &aItb, const Iterator &aIte)
 
 ArithmeticalDSS (const ArithmeticalDSS &aOther)
 
ArithmeticalDSSoperator= (const ArithmeticalDSS &aOther)
 
ArithmeticalDSS negate () const
 
bool equalsTo (const ArithmeticalDSS &aOther) const
 
bool operator== (const ArithmeticalDSS &aOther) const
 
bool operator!= (const ArithmeticalDSS &aOther) const
 
 ~ArithmeticalDSS ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
const DSLdsl () const
 
Coordinate a () const
 
Coordinate b () const
 
Integer mu () const
 
Integer omega () const
 
Vector shift () const
 
Steps steps () const
 
Point back () const
 
Point front () const
 
Point Uf () const
 
Point Ul () const
 
Point Lf () const
 
Point Ll () const
 
Integer remainder (const Point &aPoint) const
 
Integer orthogonalPosition (const Point &aPoint) const
 
Position position (const Point &aPoint) const
 
bool before (const Point &aP1, const Point &aP2) const
 
bool beforeOrEqual (const Point &aP1, const Point &aP2) const
 
bool isInDSL (const Point &aPoint) const
 
bool isInDSL (const DSL &aDSL) const
 
bool isInDSL (const DSL &aDSL, std::vector< Point > &Ulp, std::vector< Point > &Llp, Point &outP) const
 
bool isInDSS (const Point &aPoint) const
 
bool operator() (const Point &aPoint) const
 
ArithmeticalDSS computeUnion (const ArithmeticalDSS &aOther) const
 
ConstIterator begin () const
 
ConstIterator end () const
 
ConstReverseIterator rbegin () const
 
ConstReverseIterator rend () const
 
unsigned short int isExtendableFront (const Point &aNewPoint) const
 
unsigned short int isExtendableBack (const Point &aNewPoint) const
 
bool extendFront (const Point &aNewPoint)
 
bool extendBack (const Point &aNewPoint)
 
bool retractFront ()
 
bool retractBack ()
 
PointD project (const Point &aM, double aR) const
 
PointD project (const Point &aM, const Point &aP) const
 
std::string className () const
 

Additional Inherited Members

- Static Public Attributes inherited from DGtal::ArithmeticalDSS< TCoordinate, TCoordinate, 8 >
static const unsigned short foregroundAdjacency
 
- Protected Member Functions inherited from DGtal::ArithmeticalDSS< TCoordinate, TCoordinate, 8 >
bool retractUpdateLeaningPoints (const Vector &aDirection, const Point &aFirst, const Point &aLast, const Point &aBezout, const Point &aFirstAtOppositeSide, Point &aLastAtOppositeSide, Point &aFirstAtRemovalSide, const Point &aLastAtRemovalSide)
 
void retractUpdateParameters (const Vector &aNewDirection)
 
- Protected Attributes inherited from DGtal::ArithmeticalDSS< TCoordinate, TCoordinate, 8 >
Point myF
 
Point myL
 
Point myUf
 
Point myUl
 
Point myLf
 
Point myLl
 
DSL myDSL
 

Detailed Description

template<typename TCoordinate, typename TInteger = TCoordinate>
class DGtal::NaiveDSS8< TCoordinate, TInteger >

Aim: This class represents a standard digital straight segment (DSS), ie. the sequence of simply 8-connected digital points contained in a naive digital straight line (DSL) between two points of it. This class is an alias of ArithmeticalDSS.

A 8-connected naive DSS can be declared and constructed as follows:

// Construct a naive DSS
NaiveDSS8<Integer> segment( 5, 8, //slope
Point(0,0), Point(8,5), //ending points
Point(0,0), Point(8,5), //upper points
Point(3,1), Point(3,1) //lower points
);
Super::Point Point

You can iterate over the whole set of DSS points as follows:

// Trace the position and remainder of each point
it = segment.begin(),
ite = segment.end();
it != ite; ++it )
{
trace.info() << "("
<< segment.position( *it ) << ","
<< segment.remainder( *it )
<< ") ";
}
std::ostream & info()
Trace trace
Definition: Common.h:154

In addition, you can draw either the points of a DSS or its bounding box with Board2D:

Board2D board;
// Draw the grid
Domain domain( Point(0,0), Point(8,5) );
board << SetMode(domain.className(), "Grid")
<< domain;
//Draw the points of the DSS
board << SetMode("PointVector", "Both");
board << SetMode(segment.className(), "Points")
<< segment;
// Draw the bounding box
board << SetMode(segment.className(), "BoundingBox")
<< segment;
Domain domain
HyperRectDomain< Space > Domain

Extending a DSS to a point simply connected to its front is done as follows:

bool resExtention = S.extendFront( M );

This method implements the algorithm proposed in [Debled and Reveilles, 1995 : [39]].

The following code just undoes the previous extension:

bool resRetraction = S.retractFront();

This method implements the algorithm proposed in [Lachaud et. al., 2007 : [62]].

See Digital straight lines and segments
for further details.

Template Parameters
TCoordinatea model of integer for the DGtal point coordinates and the slope parameters.
TIntegera model of integer for the intercepts and the remainders that represents a larger range of integers than TCoordinate.

This class is a model of CPointFunctor and of CConstBidirectionalRange.

See also
ArithmeticalDSL NaiveDSL StandardDSL
exampleArithmeticalDSL.cpp exampleArithmeticalDSS.cpp

Definition at line 968 of file ArithmeticalDSS.h.

Member Typedef Documentation

◆ Coordinate

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef Super::Coordinate DGtal::NaiveDSS8< TCoordinate, TInteger >::Coordinate

Definition at line 974 of file ArithmeticalDSS.h.

◆ DSL

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef Super::DSL DGtal::NaiveDSS8< TCoordinate, TInteger >::DSL

Definition at line 975 of file ArithmeticalDSS.h.

◆ Point

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef Super::Point DGtal::NaiveDSS8< TCoordinate, TInteger >::Point

Definition at line 973 of file ArithmeticalDSS.h.

◆ Super

template<typename TCoordinate , typename TInteger = TCoordinate>
typedef ArithmeticalDSS<TCoordinate, TInteger, 8> DGtal::NaiveDSS8< TCoordinate, TInteger >::Super

Definition at line 972 of file ArithmeticalDSS.h.

Constructor & Destructor Documentation

◆ NaiveDSS8() [1/6]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSS8< TCoordinate, TInteger >::NaiveDSS8 ( const Coordinate aA,
const Coordinate aB,
const Point aF,
const Point aL,
const Point aUf,
const Point aUl,
const Point aLf,
const Point aLl 
)

Constructor. Minimal set of parameters to build the DSS in constant time. The user should be sure that the slope is consistent with the position of the leaning points.

Parameters
aAy-component of the direction vector
aBx-component of the direction vector
aFthe first point
aLthe last point
aUfthe first upper point
aUlthe last upper point
aLfthe first lower point
aLlthe last lower point

◆ NaiveDSS8() [2/6]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSS8< TCoordinate, TInteger >::NaiveDSS8 ( const Point aF,
const Point aL,
const bool &  isOnTheUpperLine = true 
)

Construction of a sequence of patterns (or reversed patterns) from two end points.

Parameters
aFthe first point
aLthe last point
isOnTheUpperLineboolean equal to 'true' if the two given end points are upper leaning points (pattern case, default), 'false' if they are lower leaning points (reversed pattern case).

NB: logarithmic-time in the greatest component of the vector starting from aF and pointing to aL

◆ NaiveDSS8() [3/6]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSS8< TCoordinate, TInteger >::NaiveDSS8 ( const DSL aDSL,
const Point aF,
const Point aL 
)

Construction as the subsegment of minimal parameters of a given DSL.

Parameters
aDSLbounding DSL
aFfirst point of the subsegment
aLlast point of the subsegment

NB: logarithmic-time in the greatest component of the direction vector of the subsegment. Uses smartCH algorithm.

◆ NaiveDSS8() [4/6]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSS8< TCoordinate, TInteger >::NaiveDSS8 ( const NaiveDSS8< TCoordinate, TInteger > &  aDSS,
const Point aF,
const Point aL 
)

Construction as the subsegment of minimal parameters of a greater DSS.

Parameters
aDSSbounding DSS
aFfirst point of the subsegment
aLlast point of the subsegment

NB: logarithmic-time in the greatest component of the direction vector of the subsegment. Uses reversedSmartCH algorithm.

See also
ArithmeticalDSSFactory

◆ NaiveDSS8() [5/6]

template<typename TCoordinate , typename TInteger = TCoordinate>
template<typename Iterator >
DGtal::NaiveDSS8< TCoordinate, TInteger >::NaiveDSS8 ( const Iterator &  aItb,
const Iterator &  aIte 
)

Construction from a range of iterators on points.

Parameters
aItbbegin iterator
aIteend iterator
Template Parameters
Iteratora model of forward iterator

NB: linear-time in the size of the range

◆ NaiveDSS8() [6/6]

template<typename TCoordinate , typename TInteger = TCoordinate>
DGtal::NaiveDSS8< TCoordinate, TInteger >::NaiveDSS8 ( const NaiveDSS8< TCoordinate, TInteger > &  aOther)

Copy constructor.

Parameters
aOtherthe object to clone.

Member Function Documentation

◆ operator=()

template<typename TCoordinate , typename TInteger = TCoordinate>
NaiveDSS8& DGtal::NaiveDSS8< TCoordinate, TInteger >::operator= ( const NaiveDSS8< TCoordinate, TInteger > &  aOther)

Assignment.

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

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