DGtal 1.4.2
Loading...
Searching...
No Matches
PlaneProbingLNeighborhood.h
1
17#pragma once
18
31#if defined(PlaneProbingLNeighborhood_RECURSES)
32#error Recursive header files inclusion detected in PlaneProbingLNeighborhood.h
33#else // defined(PlaneProbingLNeighborhood_RECURSES)
35#define PlaneProbingLNeighborhood_RECURSES
36
37#if !defined PlaneProbingLNeighborhood_h
39#define PlaneProbingLNeighborhood_h
40
42// Inclusions
43#include <cassert>
44#include <iostream>
45#include <vector>
46#include "DGtal/base/Common.h"
47#include "DGtal/geometry/helpers/PlaneProbingEstimatorHelper.h"
48#include "DGtal/geometry/surfaces/estimation/PlaneProbingRNeighborhood.h"
49#include "DGtal/kernel/CPointPredicate.h"
51
52namespace DGtal
53{
54
56 // template class PlaneProbingLNeighborhood
64 template <typename TPredicate>
66 {
68
69 // ----------------------- Public types ------------------------------
70 public:
71 using Predicate = TPredicate;
72 using Point = typename Predicate::Point;
73 using Vector = Point;
74 using Integer = typename Point::Coordinate;
75 using Triangle = std::array<Vector, 3>;
76
79
84
85 // ----------------------- Internal type -------------------------------
86 private:
102 {
106 ClosestGridPoint () = default;
107
115 ClosestGridPoint (const GridPoint& aGridPoint,
116 const bool& aFirst, const bool& aSecond )
117 : myGridPoint(aGridPoint), myPair(std::make_pair(aFirst,aSecond)) {}
118
122 std::pair<bool,bool> myPair;
124 };
125
126 // ----------------------- Standard services ------------------------------
127 public:
132
140 PlaneProbingLNeighborhood(Predicate const& aPredicate, Point const& aQ, Triangle const& aM);
141
146
152
158
165
172
173 // ----------------------- Plane-Probing services ------------------------------
174 public:
175
183
190
191 // ------------------------- Protected Datas ------------------------------
192 protected:
193
194 std::vector<ClosestGridPoint> myGrids;
196 // ------------------------- Helpers to find a closest point --------------
197 protected:
198
207
215 void candidatesInGrid (const GridPoint& y1, const GridPoint& y2,
216 std::back_insert_iterator<std::vector<GridPoint> > out) const;
217
226
235
243
250 void updateGrid (const Index& aIdx);
251
258 Point direction (GridPoint const& aP) const;
259
260 // ----------------------- Interface --------------------------------------
261 public:
262
267 void selfDisplay ( std::ostream & out ) const;
268
273 bool isValid() const;
274
275 }; // end of class PlaneProbingLNeighborhood
276
277
284 template <typename TPredicate>
285 std::ostream&
286 operator<< ( std::ostream & out, const PlaneProbingLNeighborhood<TPredicate> & object );
287
288} // namespace DGtal
289
290
292 // Includes inline functions.
293#include "DGtal/geometry/surfaces/estimation/PlaneProbingLNeighborhood.ih"
294
295// //
297
298#endif // !defined PlaneProbingLNeighborhood_h
299
300#undef PlaneProbingLNeighborhood_RECURSES
301#endif // else defined(PlaneProbingLNeighborhood_RECURSES)
Aim: Represents a way to probe the L-neighborhood, see lu2022 for details.
GridPointOnProbingRay closestOnBoundedRayLinearWithPredicate(GridPointOnProbingRay const &aRay, Integer const &aBound) const
typename PlaneProbingNeighborhood< TPredicate >::PointOnProbingRay PointOnProbingRay
typename PlaneProbingNeighborhood< TPredicate >::UpdateOperation UpdateOperation
BOOST_CONCEPT_ASSERT((DGtal::concepts::CPointPredicate< TPredicate >))
void updateGrid(const Index &aIdx)
typename detail::GridPoint< Integer, Index > GridPoint
void selfDisplay(std::ostream &out) const
void candidatesInGrid(const GridPoint &y1, const GridPoint &y2, std::back_insert_iterator< std::vector< GridPoint > > out) const
typename PlaneProbingNeighborhood< TPredicate >::HexagonState HexagonState
PlaneProbingLNeighborhood(const PlaneProbingLNeighborhood &other)=delete
HexagonState hexagonState() override
PlaneProbingLNeighborhood(Predicate const &aPredicate, Point const &aQ, Triangle const &aM)
PlaneProbingLNeighborhood(PlaneProbingLNeighborhood &&other)=delete
UpdateOperation closestCandidate() override
Point direction(GridPoint const &aP) const
typename PlaneProbingNeighborhood< TPredicate >::Index Index
typename detail::GridPointOnProbingRay< Integer, Index > GridPointOnProbingRay
UpdateOperation getOperationFromGridPoint(GridPoint const &aClosest) const
GridPointOnProbingRay closestOnBoundedRayLogWithPredicate(GridPointOnProbingRay const &aRay, Integer const &aBound) const
PlaneProbingLNeighborhood & operator=(const PlaneProbingLNeighborhood &other)=delete
ClosestGridPoint closestInGrid(const Index &aIdx) const
std::vector< ClosestGridPoint > myGrids
Aim: Represent a way to probe the R-neighborhood.
Aim: Represents a grid point along a discrete ray defined on a grid.
A grid point consists of a couple of nonnegative coordinates and an integer index that determines a...
A ray consists of a permutation and an integer index (position on the ray). For a triplet of vector...
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
STL namespace.
Aim: Used to store the closest grid point associated to a vertex of the triangle and two extra boolea...
ClosestGridPoint(const GridPoint &aGridPoint, const bool &aFirst, const bool &aSecond)
Aim: Defines a predicate on a point.