DGtal  1.5.beta
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)
35 #define ImplicitPolynomial3Shape_RECURSES
36 
37 #if !defined ImplicitPolynomial3Shape_h
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 
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 
132 
137  inline
139 
140 // ------------------------------------------------------------ Added by Anis Benyoub
141 
152  inline
153  double meanCurvature( const RealPoint &aPoint ) const;
154 
155 
169  inline
170  double gaussianCurvature( const RealPoint &aPoint ) const;
171 
180  inline
182  double & k1, double & k2 ) const;
183 
197  inline
199  RealVector& d1, RealVector& d2 ) const;
200 
213  inline
215  const double accuracy = 0.0001,
216  const int maxIter = 20,
217  const double gamma = 0.5 ) const;
218 
219 
220 
221  // ----------------------- Interface --------------------------------------
222  public:
223 
228  void selfDisplay ( std::ostream & out ) const;
229 
234  bool isValid() const;
235 
236  // ------------------------- Protected Datas ------------------------------
237  private:
238  // ------------------------- Private Datas --------------------------------
239  private:
242 
243  // Partial deriatives
247 
251 
255 
259 
260 
261  // Precomputed Polynoms useful for curvature computations
264 
265 
266  // ------------------------- Hidden services ------------------------------
267  protected:
268 
274 
275  private:
276 
277 
278  }; // end of class ImplicitPolynomial3Shape
279 
280 
287  template <typename T>
288  std::ostream &
289  operator<< ( std::ostream & out, const ImplicitPolynomial3Shape<T> & object );
290 
291 } // namespace DGtal
292 
293 
295 // Includes inline functions.
296 #include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.ih"
297 
298 // //
300 
301 #endif // !defined ImplicitPolynomial3Shape_h
302 
303 #undef ImplicitPolynomial3Shape_RECURSES
304 #endif // else defined(ImplicitPolynomial3Shape_RECURSES)
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
RealVector gradient(const RealPoint &aPoint) const
ImplicitPolynomial3Shape(const Polynomial3 &poly)
Orientation orientation(const RealPoint &aPoint) const
BOOST_STATIC_ASSERT((Space::dimension==3))
void selfDisplay(std::ostream &out) const
ImplicitPolynomial3Shape< TSpace > Self
double gaussianCurvature(const RealPoint &aPoint) const
double meanCurvature(const RealPoint &aPoint) const
void principalCurvatures(const RealPoint &aPoint, double &k1, double &k2) const
bool isInside(const RealPoint &aPoint) const
double operator()(const RealPoint &aPoint) const
Polynomial3 myPolynomial
The 3-polynomial defining the implicit shape.
RealPoint nearestPoint(const RealPoint &aPoint, const double accuracy=0.0001, const int maxIter=20, const double gamma=0.5) const
void principalDirections(const RealPoint &aPoint, RealVector &d1, RealVector &d2) const
ImplicitPolynomial3Shape & operator=(const ImplicitPolynomial3Shape &other)
void init(const Polynomial3 &poly)
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: SpaceND.h:102
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Orientation
Definition: Common.h:141
const Point aPoint(3, 4)