DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
80  BOOST_STATIC_ASSERT(( Space::dimension == 3 ));
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 
179  inline
180  RealPoint nearestPoint( const RealPoint &aPoint,
181  const double accuracy,
182  const int maxIter ,
183  const double gamma ) const;
184 
185 
186 
187  // ----------------------- Interface --------------------------------------
188  public:
189 
194  void selfDisplay ( std::ostream & out ) const;
195 
200  bool isValid() const;
201 
202  // ------------------------- Protected Datas ------------------------------
203  private:
204  // ------------------------- Private Datas --------------------------------
205  private:
208 
209  // Partial deriatives
213 
217 
221 
225 
226 
227  // Precomputed Polynoms useful for curvature computations
230 
231 
232  // ------------------------- Hidden services ------------------------------
233  protected:
234 
240 
241  private:
242 
243 
244  }; // end of class ImplicitPolynomial3Shape
245 
246 
253  template <typename T>
254  std::ostream &
255  operator<< ( std::ostream & out, const ImplicitPolynomial3Shape<T> & object );
256 
257 } // namespace DGtal
258 
259 
261 // Includes inline functions.
262 #include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.ih"
263 
264 // //
266 
267 #endif // !defined ImplicitPolynomial3Shape_h
268 
269 #undef ImplicitPolynomial3Shape_RECURSES
270 #endif // else defined(ImplicitPolynomial3Shape_RECURSES)