DGtal  1.3.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;
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)
DGtal::PlaneProbingTetrahedronEstimator::hexagonState
HexagonState hexagonState() const
DGtal::PlaneProbingTetrahedronEstimator::isInside
bool isInside() const
DGtal::PlaneProbingTetrahedronEstimator::q
Point const & q() const
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Quantity
Vector Quantity
Definition: PlaneProbingTetrahedronEstimator.h:121
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Permutation
typename PointOnProbingRay::Permutation Permutation
Definition: PlaneProbingTetrahedronEstimator.h:120
DGtal::PlaneProbingNeighborhood::PointOnProbingRay
detail::PointOnProbingRay< Integer > PointOnProbingRay
Definition: PlaneProbingNeighborhood.h:76
DGtal::PlaneProbingTetrahedronEstimator::isProjectedInside
bool isProjectedInside() const
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::HexagonState
typename Neighborhood::HexagonState HexagonState
Definition: PlaneProbingTetrahedronEstimator.h:122
DGtal::PlaneProbingTetrahedronEstimator::PlaneProbingTetrahedronEstimator
PlaneProbingTetrahedronEstimator()=delete
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Predicate
NotAbovePredicate Predicate
Definition: PlaneProbingTetrahedronEstimator.h:113
DGtal::PlaneProbingTetrahedronEstimator::isValid
bool isValid() const
DGtal::PlaneProbingTetrahedronEstimator::myNeighborhood
Neighborhood * myNeighborhood
Definition: PlaneProbingTetrahedronEstimator.h:313
DGtal::PlaneProbingTetrahedronEstimator::myOperations
std::vector< UpdateOperation > myOperations
Definition: PlaneProbingTetrahedronEstimator.h:314
aPoint
const Point aPoint(3, 4)
DGtal::PlaneProbingNeighborhood::Triangle
std::array< Vector, 3 > Triangle
Definition: PlaneProbingNeighborhood.h:75
DGtal::PlaneProbingTetrahedronEstimator::myPredicate
Predicate const & myPredicate
Definition: PlaneProbingTetrahedronEstimator.h:310
DGtal::PlaneProbingTetrahedronEstimator::m
Vector const & m(int aIndex) const
DGtal::PlaneProbingNeighborhood
Aim: A base virtual class that represents a way to probe a neighborhood, used in the plane probing ba...
Definition: PlaneProbingNeighborhood.h:65
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Triangle
typename Neighborhood::Triangle Triangle
Definition: PlaneProbingTetrahedronEstimator.h:117
DGtal::ProbingMode::R
@ R
DGtal::PlaneProbingTetrahedronEstimator::getNormal
Vector getNormal() const
DGtal::PlaneProbingTetrahedronEstimator::update
void update(UpdateOperation const &aOp)
DGtal::PlaneProbingTetrahedronEstimator::isUnimodular
bool isUnimodular() const
DGtal::PlaneProbingTetrahedronEstimator::advance
std::pair< bool, UpdateOperation > advance()
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::PlaneProbingTetrahedronEstimator::applyOperation
void applyOperation(UpdateOperation const &aOp)
DGtal::PlaneProbingTetrahedronEstimator::getOrigin
Point getOrigin() const
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::UpdateOperation
typename Neighborhood::UpdateOperation UpdateOperation
Definition: PlaneProbingTetrahedronEstimator.h:123
DGtal::PlaneProbingNeighborhood::UpdateOperation
Definition: PlaneProbingNeighborhood.h:96
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::PlaneProbingTetrahedronEstimator::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::PlaneProbingTetrahedronEstimator::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< TPredicate >))
DGtal::ProbingMode::R1
@ R1
DGtal::PlaneProbingTetrahedronEstimator::myQ
Point myQ
Definition: PlaneProbingTetrahedronEstimator.h:312
DGtal::PlaneProbingTetrahedronEstimator::isReduced
bool isReduced() const
DGtal::PlaneProbingTetrahedronEstimator::operator=
PlaneProbingTetrahedronEstimator & operator=(const PlaneProbingTetrahedronEstimator &other)=delete
DGtal::PlaneProbingTetrahedronEstimator::vertices
Triangle vertices() const
DGtal::PlaneProbingTetrahedronEstimator::translateQ
void translateQ()
DGtal::PlaneProbingNeighborhood::HexagonState
HexagonState
Definition: PlaneProbingNeighborhood.h:81
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Vector
Point Vector
Definition: PlaneProbingTetrahedronEstimator.h:115
DGtal::PlaneProbingTetrahedronEstimator
Aim: A class that locally estimates a normal on a digital set using only a predicate "does a point x ...
Definition: PlaneProbingTetrahedronEstimator.h:106
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::PointOnProbingRay
typename Neighborhood::PointOnProbingRay PointOnProbingRay
Definition: PlaneProbingTetrahedronEstimator.h:119
DGtal::concepts::CPointPredicate
Aim: Defines a predicate on a point.
Definition: CPointPredicate.h:80
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Integer
typename Point::Coordinate Integer
Definition: PlaneProbingTetrahedronEstimator.h:118
DGtal::PlaneProbingTetrahedronEstimator::~PlaneProbingTetrahedronEstimator
~PlaneProbingTetrahedronEstimator()
DGtal::PlaneProbingTetrahedronEstimator::myS
Point myS
Definition: PlaneProbingTetrahedronEstimator.h:311
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::PlaneProbingTetrahedronEstimator< NotAbovePredicate, mode >::Point
typename Predicate::Point Point
Definition: PlaneProbingTetrahedronEstimator.h:114
DGtal::ProbingMode
ProbingMode
Definition: PlaneProbingTetrahedronEstimator.h:58
DGtal::PlaneProbingTetrahedronEstimator::compute
Quantity compute()
DGtal::ProbingMode::H
@ H
DGtal::PlaneProbingTetrahedronEstimator::getBasis
std::pair< Vector, Vector > getBasis() const
DGtal::PlaneProbingTetrahedronEstimator::myM
Triangle myM
Definition: PlaneProbingTetrahedronEstimator.h:309