DGtal 1.4.2
Loading...
Searching...
No Matches
PlaneProbingNeighborhood.h
1
17#pragma once
18
31#if defined(PlaneProbingNeighborhood_RECURSES)
32#error Recursive header files inclusion detected in PlaneProbingNeighborhood.h
33#else // defined(PlaneProbingNeighborhood_RECURSES)
35#define PlaneProbingNeighborhood_RECURSES
36
37#if !defined PlaneProbingNeighborhood_h
39#define PlaneProbingNeighborhood_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/kernel/CPointPredicate.h"
50
51namespace DGtal
52{
53
55 // template class PlaneProbingNeighborhood
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 using Index = std::size_t;
78
82 enum class HexagonState
83 {
84 Empty,
85 NonConvex,
86 NonPlanar,
87 Planar,
88 };
89
98 {
99 std::array<Index, 3> sigma;
100 std::array<Integer, 3> coeffs;
101 };
102
103 // ----------------------- Standard services ------------------------------
104 public:
109
117 PlaneProbingNeighborhood(Predicate const& aPredicate, Point const& aQ, Triangle const& aM);
118
123
129
135
142
149
150 // ----------------------- Plane Probing services ------------------------------
151 public:
152 /*
153 * @param aNeighbors a list of rays to filter the candidates (if empty, there is no filtering).
154 */
155 void setNeighbors (std::vector<PointOnProbingRay> const& aNeighbors);
156
164
171
179
186 HexagonState classify (std::array<bool, 6> const& aState) const;
187
188 // ----------------------- Interface --------------------------------------
189 public:
190
195 void selfDisplay ( std::ostream & out ) const;
196
201 bool isValid() const;
202
203 // ------------------------- Protected Datas ------------------------------
204 protected:
206 Point const& myQ;
207 Triangle const& myM;
208 std::vector<PointOnProbingRay> myCandidates;
211 std::vector<PointOnProbingRay> myNeighbors;
213 // ------------------------- Private Datas --------------------------------
214 private:
215
216 // ------------------------- Hidden services ------------------------------
217 protected:
225 template <class TPointAdapter>
226 TPointAdapter closestPointInList (std::vector<TPointAdapter> const& aPoints) const;
227
235 bool isNeighbor (PointOnProbingRay const& aRay) const;
236
245 bool isSmallest (Point const& aX, Point const& aY) const;
246
255 template <class TPointAdapter>
256 Point relativePoint (TPointAdapter const& aPoint) const;
257
266 template <class TPointAdapter>
267 Point absolutePoint (TPointAdapter const& aPoint) const;
268
269 // ------------------------- Internals ------------------------------------
270 private:
271
272 }; // end of class PlaneProbingNeighborhood
273
274
281 template <typename TPredicate>
282 std::ostream&
283 operator<< ( std::ostream & out, const PlaneProbingNeighborhood<TPredicate> & object );
284
285} // namespace DGtal
286
287
289// Includes inline functions.
290#include "DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.ih"
291
292// //
294
295#endif // !defined PlaneProbingNeighborhood_h
296
297#undef PlaneProbingNeighborhood_RECURSES
298#endif // else defined(PlaneProbingNeighborhood_RECURSES)
Aim: A base virtual class that represents a way to probe a neighborhood, used in the plane probing ba...
virtual HexagonState hexagonState()=0
virtual UpdateOperation closestCandidate()
PlaneProbingNeighborhood & operator=(const PlaneProbingNeighborhood &other)=delete
void selfDisplay(std::ostream &out) const
UpdateOperation getOperation(PointOnProbingRay const &aClosest) const
Point relativePoint(TPointAdapter const &aPoint) const
std::vector< PointOnProbingRay > myCandidates
PlaneProbingNeighborhood(PlaneProbingNeighborhood &&other)=delete
bool isSmallest(Point const &aX, Point const &aY) const
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< TPredicate >))
PlaneProbingNeighborhood(const PlaneProbingNeighborhood &other)=delete
Point absolutePoint(TPointAdapter const &aPoint) const
HexagonState classify(std::array< bool, 6 > const &aState) const
PlaneProbingNeighborhood(Predicate const &aPredicate, Point const &aQ, Triangle const &aM)
TPointAdapter closestPointInList(std::vector< TPointAdapter > const &aPoints) const
bool isNeighbor(PointOnProbingRay const &aRay) const
std::vector< PointOnProbingRay > myNeighbors
void setNeighbors(std::vector< PointOnProbingRay > const &aNeighbors)
static const PointOnProbingRay myNeighborhood[6]
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)
Aim: Defines a predicate on a point.
const Point aPoint(3, 4)