DGtal  0.9.2
ImplicitPolynomial3Shape.h
1 
17 #pragma once
18 
31 #if defined(ImplicitPolynomial3Shape_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitPolynomial3Shape.h
33 #else // defined(ImplicitPolynomial3Shape_RECURSES)
34 
35 #define ImplicitPolynomial3Shape_RECURSES
36 
37 #if !defined ImplicitPolynomial3Shape_h
38 
39 #define ImplicitPolynomial3Shape_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/BasicFunctors.h"
46 #include "DGtal/base/CPredicate.h"
47 #include "DGtal/kernel/NumberTraits.h"
48 #include "DGtal/math/MPolynomial.h"
49 #include "DGtal/shapes/implicit/CImplicitFunction.h"
51 
52 namespace DGtal
53 {
54 
56 
66  template < typename TSpace >
68  {
69 
70  public:
72  typedef TSpace Space;
73  typedef typename Space::RealPoint RealPoint;
74  typedef typename Space::RealVector RealVector;
75  typedef typename RealPoint::Coordinate Ring;
76  typedef typename Space::Integer Integer;
78  typedef Ring Value;
79 
81 
88  ImplicitPolynomial3Shape( const Polynomial3 & poly );
89 
96 
101 
108  void init( const Polynomial3 & poly );
109 
110  // ----------------------- Interface --------------------------------------
111  public:
112 
117  double operator()(const RealPoint &aPoint) const;
118 
123  bool isInside(const RealPoint &aPoint) const;
124 
131  Orientation orientation(const RealPoint &aPoint) const;
132 
137  inline
138  RealVector gradient( const RealPoint &aPoint ) const;
139 
140 // ------------------------------------------------------------ Added by Anis Benyoub
141 
152  inline
153  double meanCurvature( const RealPoint &aPoint ) const;
154 
155 
163  inline
164  double gaussianCurvature( const RealPoint &aPoint ) const;
165 
174  inline
175  void principalCurvatures( const RealPoint &aPoint, double & k1, double & k2 ) const;
176 
190  inline
191  RealPoint nearestPoint( const RealPoint &aPoint,
192  const double accuracy,
193  const int maxIter ,
194  const double gamma ) const;
195 
196 
197 
198  // ----------------------- Interface --------------------------------------
199  public:
200 
205  void selfDisplay ( std::ostream & out ) const;
206 
211  bool isValid() const;
212 
213  // ------------------------- Protected Datas ------------------------------
214  private:
215  // ------------------------- Private Datas --------------------------------
216  private:
218  Polynomial3 myPolynomial;
219 
220  // Partial deriatives
221  Polynomial3 myFx;
222  Polynomial3 myFy;
223  Polynomial3 myFz;
224 
225  Polynomial3 myFxx;
226  Polynomial3 myFxy;
227  Polynomial3 myFxz;
228 
229  Polynomial3 myFyx;
230  Polynomial3 myFyy;
231  Polynomial3 myFyz;
232 
233  Polynomial3 myFzx;
234  Polynomial3 myFzy;
235  Polynomial3 myFzz;
236 
237 
238  // Precomputed Polynoms useful for curvature computations
239  Polynomial3 myUpPolynome;
240  Polynomial3 myLowPolynome;
241 
242 
243  // ------------------------- Hidden services ------------------------------
244  protected:
245 
251 
252  private:
253 
254 
255  }; // end of class ImplicitPolynomial3Shape
256 
257 
264  template <typename T>
265  std::ostream &
266  operator<< ( std::ostream & out, const ImplicitPolynomial3Shape<T> & object );
267 
268 } // namespace DGtal
269 
270 
272 // Includes inline functions.
273 #include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.ih"
274 
275 // //
277 
278 #endif // !defined ImplicitPolynomial3Shape_h
279 
280 #undef ImplicitPolynomial3Shape_RECURSES
281 #endif // else defined(ImplicitPolynomial3Shape_RECURSES)
static const Dimension dimension
static constants to store the dimension.
Definition: SpaceND.h:132
double gaussianCurvature(const RealPoint &aPoint) const
Polynomial3 myPolynomial
The 3-polynomial defining the implicit shape.
Component Coordinate
Type for Point elements.
Definition: PointVector.h:158
BOOST_STATIC_ASSERT((Space::dimension==3))
Orientation orientation(const RealPoint &aPoint) const
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
Orientation
Definition: Common.h:118
RealPoint nearestPoint(const RealPoint &aPoint, const double accuracy, const int maxIter, const double gamma) const
void principalCurvatures(const RealPoint &aPoint, double &k1, double &k2) const
double meanCurvature(const RealPoint &aPoint) const
double operator()(const RealPoint &aPoint) const
void init(const Polynomial3 &poly)
RealVector gradient(const RealPoint &aPoint) const
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
bool isInside(const RealPoint &aPoint) const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
void selfDisplay(std::ostream &out) const
DGtal is the top-level namespace which contains all DGtal functions and types.
ImplicitPolynomial3Shape & operator=(const ImplicitPolynomial3Shape &other)
ImplicitPolynomial3Shape< TSpace > Self