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>
|
|
| TangencyComputer ()=default |
| Constructor. The object is invalid.
|
|
| 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) |
|
|
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 |
|
|
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 |
|
|
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 |
|
template<typename TKSpace>
class DGtal::TangencyComputer< TKSpace >
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'
- See also
- moduleDigitalConvexityApplications
- Template Parameters
-
TKSpace | an arbitrary model of CCellularGridSpaceND. |
- Examples
- geometry/volumes/fullConvexityShortestPaths3D.cpp, and geometry/volumes/fullConvexitySphereGeodesics.cpp.
Definition at line 73 of file TangencyComputer.h.
◆ CellCover
template<typename TKSpace >
◆ Domain
template<typename TKSpace >
◆ Index
template<typename TKSpace >
◆ KSpace
template<typename TKSpace >
◆ LatticeCellCover
template<typename TKSpace >
◆ Path
template<typename TKSpace >
◆ Point
template<typename TKSpace >
◆ Self
template<typename TKSpace >
◆ Size
template<typename TKSpace >
◆ Space
template<typename TKSpace >
◆ Vector
template<typename TKSpace >
◆ TangencyComputer() [1/4]
template<typename TKSpace >
Constructor. The object is invalid.
◆ TangencyComputer() [2/4]
template<typename TKSpace >
Copy constructor.
- Parameters
-
other | the object to clone. |
◆ TangencyComputer() [3/4]
template<typename TKSpace >
Move constructor.
- Parameters
-
◆ TangencyComputer() [4/4]
template<typename TKSpace >
Constructor from digital space.
- Parameters
-
aK | the input Khalimsky space, which is cloned. |
◆ arePointsCotangent() [1/2]
template<typename TKSpace >
Tells if two points are cotangent with respect to the current digital set.
- Parameters
-
[in] | a | any point |
[in] | b | any point |
- Returns
- 'true' if and only if a and b are cotangent in this set.
◆ arePointsCotangent() [2/2]
template<typename TKSpace >
Tells if three points are cotangent with respect to the current digital set.
- Parameters
-
[in] | a | any point |
[in] | b | any point |
[in] | c | any point |
- Returns
- 'true' if and only if a and b are cotangent in this set.
◆ BOOST_CONCEPT_ASSERT()
template<typename TKSpace >
◆ cellCover()
template<typename TKSpace >
◆ getCotangentPoints() [1/2]
template<typename TKSpace >
Extracts cotangent points by a breadth-first traversal.
- Parameters
-
- Returns
- the indices of the other points of the shape that are cotangent to a.
◆ getCotangentPoints() [2/2]
template<typename TKSpace >
Extracts a subset of cotangent points by a breadth-first traversal.
- Parameters
-
[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. |
- Returns
- the indices of the other points of the shape that are cotangent to a.
◆ index()
template<typename TKSpace >
◆ init()
template<typename TKSpace >
template<typename PointIterator >
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.
- Template Parameters
-
PointIterator | any model of ForwardIterator on Point. |
- Parameters
-
[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. |
◆ latticeCellCover()
template<typename TKSpace >
◆ length()
template<typename TKSpace >
- Parameters
-
[in] | path | a sequence of point indices describing a valid path. |
- Returns
- its Euclidean length.
Definition at line 460 of file TangencyComputer.h.
461 {
462 auto eucl_d = [] (
const Point& p,
const Point& q )
463 { return ( p - q ).norm(); };
464 double l = 0.0;
465 for ( auto i = 1; i < path.size(); i++ )
466 l += eucl_d(
point( path[ i-1 ] ),
point( path[ i ] ) );
467 return l;
468 }
const Point & point(Index i) const
References DGtal::TangencyComputer< TKSpace >::point().
◆ makeShortestPaths()
template<typename TKSpace >
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.
- Parameters
-
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. |
- Returns
- a ShortestPaths object that allows shortest path computations.
◆ operator=() [1/2]
template<typename TKSpace >
Assigment
- Parameters
-
- Returns
- a reference to 'this'
◆ operator=() [2/2]
template<typename TKSpace >
Move assigment
- Parameters
-
- Returns
- a reference to 'this'
◆ point()
template<typename TKSpace >
◆ points()
template<typename TKSpace >
◆ setUp()
template<typename TKSpace >
Precomputes some neighborhood tables at construction.
◆ shortestPath()
template<typename TKSpace >
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.
- Parameters
-
[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. |
- Returns
- the sequence of point indices from source to target, i.e.
[source, ..., target]
, which form a valid path in the object.
- Note
- Builds two ShortestPaths objects and stops when they meet.
◆ shortestPaths()
template<typename TKSpace >
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.
- Parameters
-
[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. |
- Returns
- the
n
shortest paths from each source point to the closest target point.
- Note
- Builds one ShortestPaths object and stops when the bft is finished.
◆ size()
template<typename TKSpace >
◆ space()
template<typename TKSpace >
◆ ShortestPaths
template<typename TKSpace >
friend struct ShortestPaths |
|
friend |
◆ myCellCover
template<typename TKSpace >
◆ myDConv
template<typename TKSpace >
The digital convexity object used to check full convexity.
Definition at line 601 of file TangencyComputer.h.
◆ myDN
template<typename TKSpace >
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.
◆ myK
template<typename TKSpace >
◆ myLatticeCellCover
template<typename TKSpace >
◆ myN
template<typename TKSpace >
The vector of all vectors to neighbors (8 in 2D, 26 in 3D, etc).
Definition at line 603 of file TangencyComputer.h.
◆ myPt2Index
template<typename TKSpace >
◆ myUseLatticeCellCover
template<typename TKSpace >
Tells if one must use CellCover or LatticeCellCover for computations.
Definition at line 610 of file TangencyComputer.h.
◆ myX
template<typename TKSpace >
The documentation for this class was generated from the following file: