DGtal  1.0.0
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 
169  inline
170  double gaussianCurvature( const RealPoint &aPoint ) const;
171 
180  inline
181  void principalCurvatures( const RealPoint &aPoint, double & k1, double & k2 ) const;
182 
195  inline
197  const double accuracy = 0.0001,
198  const int maxIter = 20,
199  const double gamma = 0.5 ) const;
200 
201 
202 
203  // ----------------------- Interface --------------------------------------
204  public:
205 
210  void selfDisplay ( std::ostream & out ) const;
211 
216  bool isValid() const;
217 
218  // ------------------------- Protected Datas ------------------------------
219  private:
220  // ------------------------- Private Datas --------------------------------
221  private:
224 
225  // Partial deriatives
229 
233 
237 
241 
242 
243  // Precomputed Polynoms useful for curvature computations
246 
247 
248  // ------------------------- Hidden services ------------------------------
249  protected:
250 
256 
257  private:
258 
259 
260  }; // end of class ImplicitPolynomial3Shape
261 
262 
269  template <typename T>
270  std::ostream &
271  operator<< ( std::ostream & out, const ImplicitPolynomial3Shape<T> & object );
272 
273 } // namespace DGtal
274 
275 
277 // Includes inline functions.
278 #include "DGtal/shapes/implicit/ImplicitPolynomial3Shape.ih"
279 
280 // //
282 
283 #endif // !defined ImplicitPolynomial3Shape_h
284 
285 #undef ImplicitPolynomial3Shape_RECURSES
286 #endif // else defined(ImplicitPolynomial3Shape_RECURSES)
const Point aPoint(3, 4)
static const Dimension dimension
static constants to store the dimension.
Definition: SpaceND.h:132
Polynomial3 myPolynomial
The 3-polynomial defining the implicit shape.
Component Coordinate
Type for Point elements.
Definition: PointVector.h:617
RealPoint nearestPoint(const RealPoint &aPoint, const double accuracy=0.0001, const int maxIter=20, const double gamma=0.5) const
BOOST_STATIC_ASSERT((Space::dimension==3))
bool isInside(const RealPoint &aPoint) const
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
Orientation
Definition: Common.h:132
RealVector gradient(const RealPoint &aPoint) const
double gaussianCurvature(const RealPoint &aPoint) const
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
void init(const Polynomial3 &poly)
Aim: model of CEuclideanOrientedShape concepts to create a shape from a polynomial.
double meanCurvature(const RealPoint &aPoint) const
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.
ImplicitPolynomial3Shape & operator=(const ImplicitPolynomial3Shape &other)
void selfDisplay(std::ostream &out) const
double operator()(const RealPoint &aPoint) const
void principalCurvatures(const RealPoint &aPoint, double &k1, double &k2) const
ImplicitPolynomial3Shape< TSpace > Self
Orientation orientation(const RealPoint &aPoint) const