DGtal  1.5.beta
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 
52 namespace 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 
83 
84  // ----------------------- Internal type -------------------------------
85  private:
101  {
105  ClosestGridPoint () = default;
106 
114  ClosestGridPoint (const GridPoint& aGridPoint,
115  const bool& aFirst, const bool& aSecond )
116  : myGridPoint(aGridPoint), myPair(std::make_pair(aFirst,aSecond)) {}
117 
121  std::pair<bool,bool> myPair;
123  };
124 
125  // ----------------------- Standard services ------------------------------
126  public:
131 
139  PlaneProbingLNeighborhood(Predicate const& aPredicate, Point const& aQ, Triangle const& aM);
140 
145 
151 
157 
164 
171 
172  // ----------------------- Plane-Probing services ------------------------------
173  public:
174 
182 
189 
190  // ------------------------- Protected Datas ------------------------------
191  protected:
192 
193  std::vector<ClosestGridPoint> myGrids;
195  // ------------------------- Helpers to find a closest point --------------
196  protected:
197 
205  ClosestGridPoint closestInGrid (const int& aIdx) const;
206 
214  void candidatesInGrid (const GridPoint& y1, const GridPoint& y2,
215  std::back_insert_iterator<std::vector<GridPoint> > out) const;
216 
225 
234 
242 
249  void updateGrid (const int& aIdx);
250 
257  Point direction (GridPoint const& aP) const;
258 
259  // ----------------------- Interface --------------------------------------
260  public:
261 
266  void selfDisplay ( std::ostream & out ) const;
267 
272  bool isValid() const;
273 
274  }; // end of class PlaneProbingLNeighborhood
275 
276 
283  template <typename TPredicate>
284  std::ostream&
285  operator<< ( std::ostream & out, const PlaneProbingLNeighborhood<TPredicate> & object );
286 
287 } // namespace DGtal
288 
289 
291  // Includes inline functions.
292 #include "DGtal/geometry/surfaces/estimation/PlaneProbingLNeighborhood.ih"
293 
294 // //
296 
297 #endif // !defined PlaneProbingLNeighborhood_h
298 
299 #undef PlaneProbingLNeighborhood_RECURSES
300 #endif // else defined(PlaneProbingLNeighborhood_RECURSES)
Aim: Represents a way to probe the L-neighborhood, see for details.
GridPointOnProbingRay closestOnBoundedRayLinearWithPredicate(GridPointOnProbingRay const &aRay, Integer const &aBound) const
typename PlaneProbingNeighborhood< TPredicate >::UpdateOperation UpdateOperation
BOOST_CONCEPT_ASSERT((DGtal::concepts::CPointPredicate< TPredicate >))
typename detail::PointOnProbingRay< Integer > PointOnProbingRay
void selfDisplay(std::ostream &out) const
PlaneProbingLNeighborhood & operator=(const PlaneProbingLNeighborhood &other)=delete
void updateGrid(const int &aIdx)
void candidatesInGrid(const GridPoint &y1, const GridPoint &y2, std::back_insert_iterator< std::vector< GridPoint > > out) const
PlaneProbingLNeighborhood(const PlaneProbingLNeighborhood &other)=delete
HexagonState hexagonState() override
typename detail::GridPoint< Integer > GridPoint
PlaneProbingLNeighborhood(Predicate const &aPredicate, Point const &aQ, Triangle const &aM)
PlaneProbingLNeighborhood(PlaneProbingLNeighborhood &&other)=delete
typename detail::GridPointOnProbingRay< Integer > GridPointOnProbingRay
UpdateOperation closestCandidate() override
Point direction(GridPoint const &aP) const
UpdateOperation getOperationFromGridPoint(GridPoint const &aClosest) const
GridPointOnProbingRay closestOnBoundedRayLogWithPredicate(GridPointOnProbingRay const &aRay, Integer const &aBound) const
ClosestGridPoint closestInGrid(const int &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 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 ATu0v1< TKSpace, TLinearAlgebra > &object)
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.
MyPointD Point
Definition: testClone2.cpp:383