DGtal 2.0.0
Loading...
Searching...
No Matches
DGtal::detail::GridPointOnProbingRay< Integer, Index > Class Template Reference

Aim: Represents a grid point along a discrete ray defined on a grid. More...

#include <DGtal/geometry/helpers/PlaneProbingEstimatorHelper.h>

Public Member Functions

 GridPointOnProbingRay ()=default
 GridPointOnProbingRay (const GridPoint< Integer, Index > &aGridPoint, const std::pair< Integer, Integer > &aDirection, const Integer &aIdx=0)
bool operator== (GridPointOnProbingRay const &other) const
bool operator!= (GridPointOnProbingRay const &other) const
GridPointOnProbingRay next (const Integer &aInc) const
GridPointOnProbingRay previous (const Integer &aDec) const
Integer index () const
GridPoint< Integer, IndexgridPoint () const
template<typename Point>
Point relativePoint (std::array< Point, 3 > const &aM) const

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CInteger< Integer >))

Private Attributes

GridPoint< Integer, IndexmyOrigin
std::pair< Integer, IntegermyDirection
Integer myIdx

Detailed Description

template<typename Integer = int, typename Index = std::size_t>
class DGtal::detail::GridPointOnProbingRay< Integer, Index >

Aim: Represents a grid point along a discrete ray defined on a grid.

Description of template class 'GridPointOnProbingRay'

More precisely, a ray consists of a starting point (represented as an instance of 'GridPoint') and a direction (respresented as a couple of coordinates for the basis of the underlying grid). A grid point along that ray is determined by an index, 0 being the starting point of the ray. The class provides several methods to compare and move points along the ray.

Template Parameters
Integerthe integer type, model of concepts::CInteger.

Definition at line 423 of file PlaneProbingEstimatorHelper.h.

Constructor & Destructor Documentation

◆ GridPointOnProbingRay() [1/2]

template<typename Integer = int, typename Index = std::size_t>
DGtal::detail::GridPointOnProbingRay< Integer, Index >::GridPointOnProbingRay ( )
default

Default constructor.

Referenced by next(), operator!=(), operator==(), and previous().

◆ GridPointOnProbingRay() [2/2]

template<typename Integer = int, typename Index = std::size_t>
DGtal::detail::GridPointOnProbingRay< Integer, Index >::GridPointOnProbingRay ( const GridPoint< Integer, Index > & aGridPoint,
const std::pair< Integer, Integer > & aDirection,
const Integer & aIdx = 0 )
inline

Constructor.

Parameters
aGridPointstarting point of the ray
aDirectiondirection of the ray
aIdxindex of the grid point along the ray

Definition at line 440 of file PlaneProbingEstimatorHelper.h.

References myDirection, myIdx, and myOrigin.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename Integer = int, typename Index = std::size_t>
DGtal::detail::GridPointOnProbingRay< Integer, Index >::BOOST_CONCEPT_ASSERT ( (concepts::CInteger< Integer >) )
private

◆ gridPoint()

template<typename Integer = int, typename Index = std::size_t>
GridPoint< Integer, Index > DGtal::detail::GridPointOnProbingRay< Integer, Index >::gridPoint ( ) const
inline
Returns
the current grid point as an instance of GridPoint.

Definition at line 503 of file PlaneProbingEstimatorHelper.h.

503 {
504 return myOrigin + myOrigin.getOnSameGrid(myDirection)*myIdx;
505 }

References myDirection, myIdx, and myOrigin.

Referenced by relativePoint().

◆ index()

template<typename Integer = int, typename Index = std::size_t>
Integer DGtal::detail::GridPointOnProbingRay< Integer, Index >::index ( ) const
inline
Returns
index of the current grid point on the ray.

Definition at line 496 of file PlaneProbingEstimatorHelper.h.

496 {
497 return myIdx;
498 }

References myIdx.

◆ next()

template<typename Integer = int, typename Index = std::size_t>
GridPointOnProbingRay DGtal::detail::GridPointOnProbingRay< Integer, Index >::next ( const Integer & aInc) const
inline

Returns a grid point lying after this one along the ray. The distance is given as an input parameter.

Parameters
aIncan increment.
Returns
a new grid point on the same ray, with index, the current index incremented by 'aInc'.

Definition at line 477 of file PlaneProbingEstimatorHelper.h.

References GridPointOnProbingRay(), myDirection, myIdx, and myOrigin.

◆ operator!=()

template<typename Integer = int, typename Index = std::size_t>
bool DGtal::detail::GridPointOnProbingRay< Integer, Index >::operator!= ( GridPointOnProbingRay< Integer, Index > const & other) const
inline

Difference test.

Parameters
otheranother instance of GridPointOnProbingRay
Returns
'true' if different, i.e. not equal, 'false' otherwise

Definition at line 465 of file PlaneProbingEstimatorHelper.h.

465 {
466 return !(*this == other);
467 }

References GridPointOnProbingRay().

◆ operator==()

template<typename Integer = int, typename Index = std::size_t>
bool DGtal::detail::GridPointOnProbingRay< Integer, Index >::operator== ( GridPointOnProbingRay< Integer, Index > const & other) const
inline

Equality test. The two objects are equal iff the underlying rays are the same and the indices are the same.

Parameters
otheranother instance of GridPointOnProbingRay
Returns
'true' if equal, 'false' otherwise

Definition at line 453 of file PlaneProbingEstimatorHelper.h.

453 {
454 return ( (myOrigin == other.myOrigin) &&
456 (myIdx == other.myIdx) );
457 }

References GridPointOnProbingRay(), myDirection, myIdx, and myOrigin.

◆ previous()

template<typename Integer = int, typename Index = std::size_t>
GridPointOnProbingRay DGtal::detail::GridPointOnProbingRay< Integer, Index >::previous ( const Integer & aDec) const
inline

Returns a grid point lying before this one along the ray. The distance is given as an input parameter.

Parameters
aDeca decrement.
Returns
a new grid point on the same ray, with index, the current index decremented by 'aDec'.

Definition at line 489 of file PlaneProbingEstimatorHelper.h.

489 {
491 }

References GridPointOnProbingRay(), myDirection, myIdx, and myOrigin.

◆ relativePoint()

template<typename Integer = int, typename Index = std::size_t>
template<typename Point>
Point DGtal::detail::GridPointOnProbingRay< Integer, Index >::relativePoint ( std::array< Point, 3 > const & aM) const
inline

Returns the geometric realization of this grid point.

Parameters
aMan array of three points.
Template Parameters
Pointa type for points.
Returns
the computed point.

Definition at line 515 of file PlaneProbingEstimatorHelper.h.

515 {
516 return gridPoint().relativePoint(aM);
517 }
GridPoint< Integer, Index > gridPoint() const
Point relativePoint(std::array< Point, 3 > const &aM) const

References gridPoint(), and DGtal::detail::GridPoint< Integer, Index >::relativePoint().

Field Documentation

◆ myDirection

template<typename Integer = int, typename Index = std::size_t>
std::pair<Integer, Integer> DGtal::detail::GridPointOnProbingRay< Integer, Index >::myDirection
private

direction of the ray

Definition at line 522 of file PlaneProbingEstimatorHelper.h.

Referenced by gridPoint(), GridPointOnProbingRay(), next(), operator==(), and previous().

◆ myIdx

template<typename Integer = int, typename Index = std::size_t>
Integer DGtal::detail::GridPointOnProbingRay< Integer, Index >::myIdx
private

index of the point along the ray

Definition at line 523 of file PlaneProbingEstimatorHelper.h.

Referenced by gridPoint(), GridPointOnProbingRay(), index(), next(), operator==(), and previous().

◆ myOrigin

template<typename Integer = int, typename Index = std::size_t>
GridPoint<Integer, Index> DGtal::detail::GridPointOnProbingRay< Integer, Index >::myOrigin
private

starting point of the ray

Definition at line 521 of file PlaneProbingEstimatorHelper.h.

Referenced by gridPoint(), GridPointOnProbingRay(), next(), operator==(), and previous().


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