DGtal
1.5.beta
|
Aim: A class that computes tangency to a given digital set. It provides services to compute all the cotangent points to a given point, or to compute shortest paths. More...
#include <DGtal/geometry/volumes/TangencyComputer.h>
Data Structures | |
struct | ShortestPaths |
Public Types | |
typedef TangencyComputer< TKSpace > | Self |
typedef TKSpace | KSpace |
typedef KSpace::Space | Space |
typedef KSpace::Point | Point |
typedef KSpace::Vector | Vector |
typedef HyperRectDomain< Space > | Domain |
typedef std::size_t | Index |
typedef std::size_t | Size |
typedef std::vector< Index > | Path |
typedef CellGeometry< KSpace > | CellCover |
typedef LatticeSetByIntervals< Space > | LatticeCellCover |
Public Member Functions | |
Standard services (construction, initialization, assignment) | |
TangencyComputer ()=default | |
Constructor. The object is invalid. More... | |
TangencyComputer (const Self &other)=default | |
TangencyComputer (Self &&other)=default | |
Self & | operator= (const Self &other)=default |
Self & | operator= (Self &&other)=default |
TangencyComputer (Clone< KSpace > aK) | |
template<typename PointIterator > | |
void | init (PointIterator itB, PointIterator itE, bool use_lattice_cell_cover=false) |
Accessors services | |
const KSpace & | space () const |
Size | size () const |
const std::vector< Point > & | points () const |
const Point & | point (Index i) const |
Size | index (const Point &a) const |
const CellCover & | cellCover () const |
const LatticeCellCover & | latticeCellCover () const |
double | length (const Path &path) const |
Tangency services | |
bool | arePointsCotangent (const Point &a, const Point &b) const |
bool | arePointsCotangent (const Point &a, const Point &b, const Point &c) const |
std::vector< Index > | getCotangentPoints (const Point &a) const |
std::vector< Index > | getCotangentPoints (const Point &a, const std::vector< bool > &to_avoid) const |
Shortest paths services | |
ShortestPaths | makeShortestPaths (double secure=sqrt(KSpace::dimension)) const |
std::vector< Path > | shortestPaths (const std::vector< Index > &sources, const std::vector< Index > &targets, double secure=sqrt(KSpace::dimension), bool verbose=false) const |
Path | shortestPath (Index source, Index target, double secure=sqrt(KSpace::dimension), bool verbose=false) const |
Protected Attributes | |
KSpace | myK |
The cellular grid space where computations are done. More... | |
DigitalConvexity< KSpace > | myDConv |
The digital convexity object used to check full convexity. More... | |
std::vector< Vector > | myN |
The vector of all vectors to neighbors (8 in 2D, 26 in 3D, etc). More... | |
std::vector< double > | myDN |
std::vector< Point > | myX |
The vector of points defining the digital shape under study. More... | |
bool | myUseLatticeCellCover |
Tells if one must use CellCover or LatticeCellCover for computations. More... | |
CellCover | myCellCover |
LatticeCellCover | myLatticeCellCover |
std::unordered_map< Point, Index > | myPt2Index |
A map giving for each point its index. More... | |
Private Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CCellularGridSpaceND< TKSpace >)) | |
void | setUp () |
Precomputes some neighborhood tables at construction. More... | |
Friends | |
struct | ShortestPaths |
ShortestPaths may access to datas of TangencyComputer. More... | |
Aim: A class that computes tangency to a given digital set. It provides services to compute all the cotangent points to a given point, or to compute shortest paths.
Description of template class 'TangencyComputer'
TKSpace | an arbitrary model of CCellularGridSpaceND. |
Definition at line 73 of file TangencyComputer.h.
typedef CellGeometry< KSpace > DGtal::TangencyComputer< TKSpace >::CellCover |
Definition at line 87 of file TangencyComputer.h.
typedef HyperRectDomain< Space > DGtal::TangencyComputer< TKSpace >::Domain |
Definition at line 83 of file TangencyComputer.h.
typedef std::size_t DGtal::TangencyComputer< TKSpace >::Index |
Definition at line 84 of file TangencyComputer.h.
typedef TKSpace DGtal::TangencyComputer< TKSpace >::KSpace |
Definition at line 79 of file TangencyComputer.h.
typedef LatticeSetByIntervals< Space > DGtal::TangencyComputer< TKSpace >::LatticeCellCover |
Definition at line 88 of file TangencyComputer.h.
typedef std::vector< Index > DGtal::TangencyComputer< TKSpace >::Path |
Definition at line 86 of file TangencyComputer.h.
typedef KSpace::Point DGtal::TangencyComputer< TKSpace >::Point |
Definition at line 81 of file TangencyComputer.h.
typedef TangencyComputer< TKSpace > DGtal::TangencyComputer< TKSpace >::Self |
Definition at line 78 of file TangencyComputer.h.
typedef std::size_t DGtal::TangencyComputer< TKSpace >::Size |
Definition at line 85 of file TangencyComputer.h.
typedef KSpace::Space DGtal::TangencyComputer< TKSpace >::Space |
Definition at line 80 of file TangencyComputer.h.
typedef KSpace::Vector DGtal::TangencyComputer< TKSpace >::Vector |
Definition at line 82 of file TangencyComputer.h.
|
default |
Constructor. The object is invalid.
|
default |
Copy constructor.
other | the object to clone. |
|
default |
Move constructor.
other | the object to move |
DGtal::TangencyComputer< TKSpace >::TangencyComputer | ( | Clone< KSpace > | aK | ) |
Constructor from digital space.
aK | the input Khalimsky space, which is cloned. |
bool DGtal::TangencyComputer< TKSpace >::arePointsCotangent | ( | const Point & | a, |
const Point & | b | ||
) | const |
Tells if two points are cotangent with respect to the current digital set.
[in] | a | any point |
[in] | b | any point |
bool DGtal::TangencyComputer< TKSpace >::arePointsCotangent | ( | const Point & | a, |
const Point & | b, | ||
const Point & | c | ||
) | const |
Tells if three points are cotangent with respect to the current digital set.
[in] | a | any point |
[in] | b | any point |
[in] | c | any point |
|
private |
|
inline |
Definition at line 450 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myCellCover.
std::vector< Index > DGtal::TangencyComputer< TKSpace >::getCotangentPoints | ( | const Point & | a | ) | const |
Extracts cotangent points by a breadth-first traversal.
[in] | a | any point |
std::vector< Index > DGtal::TangencyComputer< TKSpace >::getCotangentPoints | ( | const Point & | a, |
const std::vector< bool > & | to_avoid | ||
) | const |
Extracts a subset of cotangent points by a breadth-first traversal.
[in] | a | any point |
[in] | to_avoid | if 'to_avoid[ i ]' is true, then the point of index i is not visited by the bft. |
|
inline |
a | any point |
size()
if the point is not in the object Definition at line 443 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myPt2Index, and DGtal::TangencyComputer< TKSpace >::size().
void DGtal::TangencyComputer< TKSpace >::init | ( | PointIterator | itB, |
PointIterator | itE, | ||
bool | use_lattice_cell_cover = false |
||
) |
Init the object with the points of the range itB, itE Points within this range are indexed in the same order.
PointIterator | any model of ForwardIterator on Point. |
[in] | itB | an iterator pointing at the beginning of the range. |
[in] | itE | an iterator pointing after the end of the range. |
[in] | use_lattice_cell_cover | if 'true' uses LatticeSetByIntervals to represent the cell geometry instead of CellGeometry. Generally a little bit slower for digital surfaces, but may be faster for volumetric objects. |
|
inline |
Definition at line 455 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myLatticeCellCover.
|
inline |
[in] | path | a sequence of point indices describing a valid path. |
Definition at line 460 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::point().
ShortestPaths DGtal::TangencyComputer< TKSpace >::makeShortestPaths | ( | double | secure = sqrt(KSpace::dimension) | ) | const |
Returns a ShortestPaths object that gives a lot of control when computing shortest paths. You should use it instead of TangencyComputer::shortestPaths or TangencyComputer::shortestPath when (1) you wish to compute distances to several sources, (2) you wish to store the result for further use, (4) and more generally if you wish to have more control on distance computations.
secure | This value is used to prune vertices in the bft. If it is greater or equal to \( \sqrt{d} \) where d is the dimension, the shortest path algorithm is guaranteed to output the correct result. If the value is smaller (down to 0.0), the algorithm is much faster but a few shortest path may be missed. |
|
default |
Assigment
other | the object to clone |
|
default |
Move assigment
other | the object to clone |
|
inline |
i | any valid point index (between 0 included and 'size()' excluded) |
Definition at line 437 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myX.
Referenced by DGtal::TangencyComputer< TKSpace >::length(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::point().
|
inline |
Definition at line 432 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myX.
|
private |
Precomputes some neighborhood tables at construction.
Path DGtal::TangencyComputer< TKSpace >::shortestPath | ( | Index | source, |
Index | target, | ||
double | secure = sqrt(KSpace::dimension) , |
||
bool | verbose = false |
||
) | const |
This function can be used to compute directly a shortest path from a source to a target, returned as a sequence of point indices, where the first is the source and the last is the target. It returns an empty sequence if there is no path between them.
[in] | source | the index of the source point. |
[in] | target | the index of the target point. |
secure | This value is used to prune vertices in the bft. If it is greater or equal to \( \sqrt{d} \) where d is the dimension, the shortest path algorithm is guaranteed to output the correct result. If the value is smaller (down to 0.0), the algorithm is much faster but a few shortest path may be missed. | |
[in] | verbose | when 'true' some information are displayed during computation. |
[source, ..., target]
, which form a valid path in the object.std::vector< Path > DGtal::TangencyComputer< TKSpace >::shortestPaths | ( | const std::vector< Index > & | sources, |
const std::vector< Index > & | targets, | ||
double | secure = sqrt(KSpace::dimension) , |
||
bool | verbose = false |
||
) | const |
This function can be used to compute directly several shortest paths from given sources to a set of targets. Each returned path starts from the source and ends at the closest target. The path is empty if there is no path between them.
[in] | sources | the indices of the n source points. |
[in] | targets | the indices of the possible target points. |
secure | This value is used to prune vertices in the bft. If it is greater or equal to \( \sqrt{d} \) where d is the dimension, the shortest path algorithm is guaranteed to output the correct result. If the value is smaller (down to 0.0), the algorithm is much faster but a few shortest path may be missed. | |
[in] | verbose | when 'true' some information are displayed during computation. |
n
shortest paths from each source point to the closest target point.
|
inline |
Definition at line 428 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myX.
Referenced by DGtal::TangencyComputer< TKSpace >::index(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
|
inline |
Definition at line 424 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::myK.
|
friend |
ShortestPaths may access to datas of TangencyComputer.
Definition at line 369 of file TangencyComputer.h.
|
protected |
The cell geometry representing all the cells touching the digital shape (uses UnorderedSetByBlock behind)
Definition at line 613 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::cellCover().
|
protected |
The digital convexity object used to check full convexity.
Definition at line 601 of file TangencyComputer.h.
|
protected |
The vector of all distances to neighbors (8 in 2D, 26 in 3D, etc), that is the norm of each value of myN.
Definition at line 606 of file TangencyComputer.h.
|
protected |
The cellular grid space where computations are done.
Definition at line 599 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::space().
|
protected |
The lattice cell geometry representing all the cells touching the digital shape (uses LatticeSetByIntervals behind).
Definition at line 616 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::latticeCellCover().
|
protected |
The vector of all vectors to neighbors (8 in 2D, 26 in 3D, etc).
Definition at line 603 of file TangencyComputer.h.
|
protected |
A map giving for each point its index.
Definition at line 619 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::index().
|
protected |
Tells if one must use CellCover or LatticeCellCover for computations.
Definition at line 610 of file TangencyComputer.h.
|
protected |
The vector of points defining the digital shape under study.
Definition at line 608 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::point(), DGtal::TangencyComputer< TKSpace >::points(), and DGtal::TangencyComputer< TKSpace >::size().