DGtal  1.2.beta
PlaneProbingTetrahedronEstimator.h
1 
17 #pragma once
18 
31 #if defined(PlaneProbingTetrahedronEstimator_RECURSES)
32 #error Recursive header files inclusion detected in PlaneProbingTetrahedronEstimator.h
33 #else // defined(PlaneProbingTetrahedronEstimator_RECURSES)
34 
35 #define PlaneProbingTetrahedronEstimator_RECURSES
36 
37 #if !defined PlaneProbingTetrahedronEstimator_h
38 
39 #define PlaneProbingTetrahedronEstimator_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/geometry/helpers/PlaneProbingEstimatorHelper.h"
47 #include "DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.h"
48 #include "DGtal/kernel/CPointPredicate.h"
50 
51 namespace DGtal
52 {
58  enum class ProbingMode
59  {
60  H,
61  R,
62  R1,
63  };
64 
72  inline
73  std::ostream& operator<< (std::ostream& aOs, ProbingMode const& aMode)
74  {
75  switch (aMode)
76  {
77  case ProbingMode::H:
78  aOs << "H";
79  break;
80 
81  case ProbingMode::R:
82  aOs << "R";
83  break;
84 
85  case ProbingMode::R1:
86  aOs << "R1";
87  break;
88  }
89 
90  return aOs;
91  }
92 
94  // template class PlaneProbingTetrahedronEstimator
105  template <typename TPredicate, ProbingMode mode = ProbingMode::H>
107  {
109 
110  // ----------------------- Public types ------------------------------
111  public:
113  using Predicate = TPredicate;
114  using Point = typename Predicate::Point;
115  using Vector = Point;
118  using Integer = typename Point::Coordinate;
120  using Permutation = typename PointOnProbingRay::Permutation;
121  using Quantity = Vector;
124 
125  // ----------------------- Standard services ------------------------------
126  public:
131 
139  PlaneProbingTetrahedronEstimator (Point const& aPoint, Triangle const& aM, Predicate const& aPredicate);
140 
145 
151 
157 
164 
171 
172  // ----------------------- Plane Probing services ------------------------------
173  public:
178  Vector const& m (int aIndex) const;
179 
183  Point const& q () const;
184 
188  Point getOrigin () const;
189 
193  Triangle vertices () const;
194 
198  std::pair<Vector, Vector> getBasis() const;
199 
203  bool isReduced () const;
204 
208  Vector getNormal () const;
209 
219  std::pair<bool, UpdateOperation> advance (std::vector<PointOnProbingRay> const& aNeighbors);
220 
226  std::pair<bool, UpdateOperation> advance ();
227 
234  Quantity compute (std::vector<PointOnProbingRay> const& aNeighbors);
235 
241  Quantity compute ();
242 
246  HexagonState hexagonState () const;
247 
253  void translateQ (Vector const& aTranslation);
254 
259  void translateQ ();
260 
266  void applyOperation (UpdateOperation const& aOp);
267 
268  // ----------------------- Interface --------------------------------------
269  public:
270 
275  void selfDisplay ( std::ostream & out ) const;
276 
281  bool isValid() const;
282 
283  // ------------------------- Protected Datas ------------------------------
284  protected:
285 
286  // ------------------------- Private Datas --------------------------------
287  private:
293  std::vector<UpdateOperation> myOperations;
295  // ------------------------- Hidden services ------------------------------
296  protected:
302  bool isProjectedInside (Triangle const& aTriangle) const;
303 
304  // ------------------------- Internals ------------------------------------
305  private:
311  void update (UpdateOperation const& aOp);
312 
313  }; // end of class PlaneProbingTetrahedronEstimator
314 
315 
322  template <typename TPredicate, ProbingMode mode>
323  std::ostream&
324  operator<< ( std::ostream & out, const PlaneProbingTetrahedronEstimator<TPredicate, mode> & object );
325 } // namespace DGtal
326 
327 
329 // Includes inline functions.
330 #include "DGtal/geometry/surfaces/estimation/PlaneProbingTetrahedronEstimator.ih"
331 
332 // //
334 
335 #endif // !defined PlaneProbingTetrahedronEstimator_h
336 
337 #undef PlaneProbingTetrahedronEstimator_RECURSES
338 #endif // else defined(PlaneProbingTetrahedronEstimator_RECURSES)
const Point aPoint(3, 4)
Aim: A base virtual class that represents a way to probe a neighborhood, used in the plane probing ba...
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
bool isProjectedInside(Triangle const &aTriangle) const
Aim: A class that locally estimates a normal on a digital set using only a predicate "does a point x ...
Aim: Defines a predicate on a point.
void update(UpdateOperation const &aOp)
void applyOperation(UpdateOperation const &aOp)
Vector const & m(int aIndex) const
detail::PointOnProbingRay< Integer > PointOnProbingRay
std::pair< Vector, Vector > getBasis() const
DGtal is the top-level namespace which contains all DGtal functions and types.
MyPointD Point
Definition: testClone2.cpp:383
std::pair< bool, UpdateOperation > advance()
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< TPredicate >))
void selfDisplay(std::ostream &out) const
PlaneProbingTetrahedronEstimator & operator=(const PlaneProbingTetrahedronEstimator &other)=delete