DGtal  1.4.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  };
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 
242 
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;
280  bool isValid() const;
286  bool isProjectedInside (Triangle const& aTriangle) const;
290  bool isProjectedInside () const;
296  bool isInside() const;
302  bool isUnimodular() const;
303 
304  // ------------------------- Protected Datas ------------------------------
305  protected:
306 
307  // ------------------------- Private Datas --------------------------------
308  private:
314  std::vector<UpdateOperation> myOperations;
316  // ------------------------- Hidden services ------------------------------
317  protected:
318 
319  // ------------------------- Internals ------------------------------------
320  private:
326  void update (UpdateOperation const& aOp);
327 
328  }; // end of class PlaneProbingTetrahedronEstimator
329 
330 
337  template <typename TPredicate, ProbingMode mode>
338  std::ostream&
339  operator<< ( std::ostream & out, const PlaneProbingTetrahedronEstimator<TPredicate, mode> & object );
340 } // namespace DGtal
341 
342 
344 // Includes inline functions.
345 #include "DGtal/geometry/surfaces/estimation/PlaneProbingTetrahedronEstimator.ih"
346 
347 // //
349 
350 #endif // !defined PlaneProbingTetrahedronEstimator_h
351 
352 #undef PlaneProbingTetrahedronEstimator_RECURSES
353 #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 > 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)