DGtal 1.3.0
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>;
77
81 enum class HexagonState
82 {
83 Empty,
84 NonConvex,
85 NonPlanar,
86 Planar,
87 };
88
97 {
98 std::array<int, 3> sigma;
99 std::array<Integer, 3> coeffs;
100 };
101
102 // ----------------------- Standard services ------------------------------
103 public:
108
116 PlaneProbingNeighborhood(Predicate const& aPredicate, Point const& aQ, Triangle const& aM);
117
122
128
134
141
148
149 // ----------------------- Plane Probing services ------------------------------
150 public:
151 /*
152 * @param aNeighbors a list of rays to filter the candidates (if empty, there is no filtering).
153 */
154 void setNeighbors (std::vector<PointOnProbingRay> const& aNeighbors);
155
163
170
177 virtual UpdateOperation getOperation (PointOnProbingRay const& aClosest) const;
178
185 HexagonState classify (std::array<bool, 6> const& aState) const;
186
187 // ----------------------- Interface --------------------------------------
188 public:
189
194 void selfDisplay ( std::ostream & out ) const;
195
200 bool isValid() const;
201
202 // ------------------------- Protected Datas ------------------------------
203 protected:
205 Point const& myQ;
206 Triangle const& myM;
207 std::vector<PointOnProbingRay> myCandidates;
210 std::vector<PointOnProbingRay> myNeighbors;
212 // ------------------------- Private Datas --------------------------------
213 private:
214
215 // ------------------------- Hidden services ------------------------------
216 protected:
223 PointOnProbingRay closestPointInList (std::vector<PointOnProbingRay> const& aPoints) const;
224
232 bool isNeighbor (PointOnProbingRay const& aRay) const;
233
242 bool isSmallest (Point const& aX, Point const& aY) const;
243
251
259
260 // ------------------------- Internals ------------------------------------
261 private:
262
263 }; // end of class PlaneProbingNeighborhood
264
265
272 template <typename TPredicate>
273 std::ostream&
274 operator<< ( std::ostream & out, const PlaneProbingNeighborhood<TPredicate> & object );
275
276} // namespace DGtal
277
278
280// Includes inline functions.
281#include "DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.ih"
282
283// //
285
286#endif // !defined PlaneProbingNeighborhood_h
287
288#undef PlaneProbingNeighborhood_RECURSES
289#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
PlaneProbingNeighborhood & operator=(const PlaneProbingNeighborhood &other)=delete
void selfDisplay(std::ostream &out) const
std::vector< PointOnProbingRay > myCandidates
virtual UpdateOperation getOperation(PointOnProbingRay const &aClosest) const
PointOnProbingRay closestPointInList(std::vector< PointOnProbingRay > const &aPoints) const
PlaneProbingNeighborhood(PlaneProbingNeighborhood &&other)=delete
Point relativePoint(PointOnProbingRay const &aRay) const
bool isSmallest(Point const &aX, Point const &aY) const
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< TPredicate >))
PlaneProbingNeighborhood(const PlaneProbingNeighborhood &other)=delete
HexagonState classify(std::array< bool, 6 > const &aState) const
PlaneProbingNeighborhood(Predicate const &aPredicate, Point const &aQ, Triangle const &aM)
Point absolutePoint(PointOnProbingRay const &aRay) const
bool isNeighbor(PointOnProbingRay const &aRay) const
UpdateOperation closestCandidate()
std::vector< PointOnProbingRay > myNeighbors
void setNeighbors(std::vector< PointOnProbingRay > const &aNeighbors)
static const PointOnProbingRay myNeighborhood[6]
typename Point::Coordinate Integer
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.