DGtal 1.4.0
|
#include <DGtal/geometry/volumes/TangencyComputer.h>
Data Structures | |
struct | Comparator |
Public Types | |
typedef std::tuple< Index, Index, double > | Node |
Type used for Dijkstra's algorithm queue (point, ancestor, distance). | |
Public Member Functions | |
ShortestPaths () | |
Default constructor. The object is not valid. | |
ShortestPaths (const ShortestPaths &other)=default | |
ShortestPaths (ShortestPaths &&other)=default | |
ShortestPaths & | operator= (const ShortestPaths &other)=default |
ShortestPaths & | operator= (ShortestPaths &&other)=default |
ShortestPaths (ConstAlias< TangencyComputer > tgcy_computer, double secure=sqrt(KSpace::dimension)) | |
const TangencyComputer * | tangencyComputerPtr () const |
Index | size () const |
void | clear () |
void | init (Index i) |
template<typename IndexFwdIterator > | |
void | init (IndexFwdIterator it, IndexFwdIterator itE) |
bool | finished () const |
const Node & | current () const |
void | expand () |
bool | isValid () const |
const Point & | point (Index i) const |
Index | ancestor (Index i) const |
double | distance (Index i) const |
bool | isVisited (Index i) const |
Path | pathToSource (Index i) const |
const std::vector< Index > & | ancestors () const |
const std::vector< double > & | distances () const |
const std::vector< bool > & | visitedPoints () const |
Static Public Member Functions | |
static double | infinity () |
Protected Member Functions | |
void | propagate (Index current) |
std::vector< Index > | getCotangentPoints (Index i) const |
Protected Attributes | |
const TangencyComputer * | myTgcyComputer |
A pointer toward the tangency computer. | |
double | mySecure |
std::vector< Index > | myAncestor |
std::vector< double > | myDistance |
Stores for each point its distance to the closest source. | |
std::vector< bool > | myVisited |
Remembers for each point if it is already visited. | |
std::priority_queue< Node, std::vector< Node >, Comparator > | myQ |
The queue of points being currently processed. | |
This structure is a state machine that computes shortest paths in a digital set. Internally, it references a TangencyComputer.
Definition at line 95 of file TangencyComputer.h.
typedef std::tuple< Index, Index, double > DGtal::TangencyComputer< TKSpace >::ShortestPaths::Node |
Type used for Dijkstra's algorithm queue (point, ancestor, distance).
Definition at line 97 of file TangencyComputer.h.
|
inline |
Default constructor. The object is not valid.
Definition at line 115 of file TangencyComputer.h.
|
default |
Copy constructor
other | the object to clone. |
|
default |
Move constructor
other | the object to clone. |
|
inline |
Constructs a ShorthestPaths object and references the given TangencyComputer tgcy_computer. It initialized the object so that it can start a new computation.
[in] | tgcy_computer | the tangency computer where shortest paths are computed. |
[in] | 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. |
Definition at line 150 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::clear().
|
inline |
[in] | i | any valid index |
isVisited(i)
is true, so after it was a current()
node and expand()
has been called. Definition at line 261 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myAncestor, and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::isVisited(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::pathToSource().
|
inline |
Definition at line 316 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myAncestor.
|
inline |
Clears the object and prepares it for a shortest path computation.
Definition at line 172 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myAncestor, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myDistance, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myQ, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myVisited, and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::ShortestPaths().
|
inline |
Definition at line 228 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::finished(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::myQ.
|
inline |
[in] | i | any valid index |
isVisited(i)
is true, so after it was a current()
node and expand()
has been called. Definition at line 273 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myDistance, and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
|
inline |
Definition at line 321 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myDistance.
void DGtal::TangencyComputer< TKSpace >::ShortestPaths::expand | ( | ) |
Goes to the next point in the bft.
|
inline |
Definition at line 217 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myQ.
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::current().
|
protected |
Extracts a subset of cotangent points by a breadth-first traversal. Used to update the queue when computing shortest paths.
[in] | i | the index of a point |
|
inlinestatic |
Definition at line 290 of file TangencyComputer.h.
|
inline |
Adds the point with index i as a source point
[in] | i | any valid index |
Definition at line 184 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myAncestor, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myDistance, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myQ, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myVisited, and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
|
inline |
Adds a range of indices as source points
[in] | it,itE | a range of valid indices, which are the indices of source points. |
Definition at line 200 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myAncestor, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myDistance, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myQ, DGtal::TangencyComputer< TKSpace >::ShortestPaths::myVisited, and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
|
inline |
Definition at line 242 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myTgcyComputer.
|
inline |
[in] | i | any valid index |
current()
node and expand()
has been called. Definition at line 284 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::ancestor(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::pathToSource().
|
default |
Assignment
other | the object to clone. |
|
default |
Move assignment
other | the object to clone. |
|
inline |
[in] | i | any valid point index |
Definition at line 300 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::ancestor(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::isVisited().
|
inline |
[in] | i | any valid index |
Definition at line 249 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myTgcyComputer, DGtal::TangencyComputer< TKSpace >::point(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::size().
|
protected |
Updates the queue with the cotangent points of the point given in parameter.
current | the index of the point where we determine its adjacent (here cotangent) to update the queue of the bft. |
|
inline |
Definition at line 165 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myTgcyComputer, and DGtal::TangencyComputer< TKSpace >::size().
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::ancestor(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::clear(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::distance(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::isVisited(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::point().
|
inline |
Definition at line 159 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myTgcyComputer.
|
inline |
Definition at line 326 of file TangencyComputer.h.
References DGtal::TangencyComputer< TKSpace >::ShortestPaths::myVisited.
|
protected |
Stores for each point its ancestor in the shortest path, or itself if it was a source.
Definition at line 341 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::ancestor(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::ancestors(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::clear(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::init().
|
protected |
Stores for each point its distance to the closest source.
Definition at line 343 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::clear(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::distance(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::distances(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::init().
|
protected |
The queue of points being currently processed.
Definition at line 347 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::clear(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::current(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::finished(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::init().
|
protected |
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.
Definition at line 338 of file TangencyComputer.h.
|
protected |
A pointer toward the tangency computer.
Definition at line 331 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::isValid(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::point(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::size(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::tangencyComputerPtr().
|
protected |
Remembers for each point if it is already visited.
Definition at line 345 of file TangencyComputer.h.
Referenced by DGtal::TangencyComputer< TKSpace >::ShortestPaths::clear(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), DGtal::TangencyComputer< TKSpace >::ShortestPaths::init(), and DGtal::TangencyComputer< TKSpace >::ShortestPaths::visitedPoints().