DGtal  1.5.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)
35 #define PlaneProbingTetrahedronEstimator_RECURSES
36 
37 #if !defined PlaneProbingTetrahedronEstimator_h
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  L,
64  };
65 
73  inline
74  std::ostream& operator<< (std::ostream& aOs, ProbingMode const& aMode)
75  {
76  switch (aMode)
77  {
78  case ProbingMode::H:
79  aOs << "H";
80  break;
81 
82  case ProbingMode::R:
83  aOs << "R";
84  break;
85 
86  case ProbingMode::R1:
87  aOs << "R1";
88  break;
89 
90  case ProbingMode::L:
91  aOs << "L";
92  break;
93  }
94 
95  return aOs;
96  }
97 
99  // template class PlaneProbingTetrahedronEstimator
110  template <typename TPredicate, ProbingMode mode = ProbingMode::H>
112  {
114 
115  // ----------------------- Public types ------------------------------
116  public:
118  using Predicate = TPredicate;
119  using Point = typename Predicate::Point;
120  using Vector = Point;
123  using Integer = typename Point::Coordinate;
125  using Permutation = typename PointOnProbingRay::Permutation;
126  using Quantity = Vector;
129 
130  // ----------------------- Standard services ------------------------------
131  public:
136 
144  PlaneProbingTetrahedronEstimator (Point const& aPoint, Triangle const& aM, Predicate const& aPredicate);
145 
150 
156 
162 
169 
176 
177  // ----------------------- Plane Probing services ------------------------------
178  public:
183  Vector const& m (int aIndex) const;
184 
188  Point const& q () const;
189 
193  Point getOrigin () const;
194 
198  Triangle vertices () const;
199 
203  std::pair<Vector, Vector> getBasis() const;
204 
208  bool isReduced () const;
209 
213  Vector getNormal () const;
214 
224  std::pair<bool, UpdateOperation> advance (std::vector<PointOnProbingRay> const& aNeighbors);
225 
231  std::pair<bool, UpdateOperation> advance ();
232 
239  Quantity compute (std::vector<PointOnProbingRay> const& aNeighbors);
240 
247 
252 
258  void translateQ (Vector const& aTranslation);
259 
264  void translateQ ();
265 
271  void applyOperation (UpdateOperation const& aOp);
272 
273  // ----------------------- Interface --------------------------------------
274  public:
275 
280  void selfDisplay ( std::ostream & out ) const;
285  bool isValid() const;
291  bool isProjectedInside (Triangle const& aTriangle) const;
295  bool isProjectedInside () const;
301  bool isInside() const;
307  bool isUnimodular() const;
308 
309  // ------------------------- Protected Datas ------------------------------
310  protected:
311 
312  // ------------------------- Private Datas --------------------------------
313  private:
319  std::vector<UpdateOperation> myOperations;
321  // ------------------------- Hidden services ------------------------------
322  protected:
323 
324  // ------------------------- Internals ------------------------------------
325  private:
331  void update (UpdateOperation const& aOp);
332 
333  }; // end of class PlaneProbingTetrahedronEstimator
334 
335 
342  template <typename TPredicate, ProbingMode mode>
343  std::ostream&
344  operator<< ( std::ostream & out, const PlaneProbingTetrahedronEstimator<TPredicate, mode> & object );
345 } // namespace DGtal
346 
347 
349 // Includes inline functions.
350 #include "DGtal/geometry/surfaces/estimation/PlaneProbingTetrahedronEstimator.ih"
351 
352 // //
354 
355 #endif // !defined PlaneProbingTetrahedronEstimator_h
356 
357 #undef PlaneProbingTetrahedronEstimator_RECURSES
358 #endif // else defined(PlaneProbingTetrahedronEstimator_RECURSES)
Aim: A base virtual class that represents a way to probe a neighborhood, used in the plane probing ba...
detail::PointOnProbingRay< Integer, Index > PointOnProbingRay
Aim: A class that locally estimates a normal on a digital set using only a predicate "does a point x ...
void applyOperation(UpdateOperation const &aOp)
void translateQ(Vector const &aTranslation)
void update(UpdateOperation const &aOp)
Vector const & m(int aIndex) const
bool isProjectedInside(Triangle const &aTriangle) const
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< TPredicate >))
typename PointOnProbingRay::Permutation Permutation
PlaneProbingTetrahedronEstimator(const PlaneProbingTetrahedronEstimator &other)=delete
PlaneProbingTetrahedronEstimator(PlaneProbingTetrahedronEstimator &&other)=delete
std::pair< Vector, Vector > getBasis() const
std::pair< bool, UpdateOperation > advance(std::vector< PointOnProbingRay > const &aNeighbors)
typename Neighborhood::UpdateOperation UpdateOperation
PlaneProbingTetrahedronEstimator & operator=(const PlaneProbingTetrahedronEstimator &other)=delete
void selfDisplay(std::ostream &out) const
PlaneProbingTetrahedronEstimator(Point const &aPoint, Triangle const &aM, Predicate const &aPredicate)
Quantity compute(std::vector< PointOnProbingRay > const &aNeighbors)
std::pair< bool, UpdateOperation > advance()
typename Neighborhood::PointOnProbingRay PointOnProbingRay
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: Defines a predicate on a point.
MyPointD Point
Definition: testClone2.cpp:383
const Point aPoint(3, 4)