DGtal 1.3.0
Loading...
Searching...
No Matches
StarShaped3D.h
1
17#pragma once
18
31#if defined(StarShaped3D_RECURSES)
32#error Recursive header files inclusion detected in StarShaped3D.h
33#else // defined(StarShaped3D_RECURSES)
35#define StarShaped3D_RECURSES
36
37#if !defined StarShaped3D_h
39#define StarShaped3D_h
40
42// Inclusions
43#include <iostream>
44#include "DGtal/base/Common.h"
45#include "DGtal/kernel/NumberTraits.h"
47
48namespace DGtal
49{
50
52 // template class StarShaped3D
70 template <typename TSpace>
72 {
73
74 public:
75 typedef TSpace Space;
76 typedef typename Space::RealPoint RealPoint;
77 typedef std::pair<double,double> AngularCoordinates;
78
82 StarShaped3D() = default;
83
90 StarShaped3D & operator= ( const StarShaped3D & other ) = delete;
91
95 virtual ~StarShaped3D() = default;
96
97 // ------------------------- Implemented services -------------------------
98 public:
102 virtual RealPoint interiorPoint() const
103 {
104 return center();
105 }
106
107 // ------------------------- Abstract services ----------------------------
108 public:
109
114 virtual RealPoint getLowerBound() const = 0;
115
120 virtual RealPoint getUpperBound() const = 0;
121
125 virtual RealPoint center() const = 0;
126
131 virtual void moveTo( const RealPoint& newCenter ) = 0;
132
139 virtual AngularCoordinates parameter( const RealPoint& p ) const = 0;
140
148 virtual RealPoint x( const AngularCoordinates& t ) const = 0;
149
156 virtual RealPoint gradient( const AngularCoordinates& t ) const = 0;
157
164 virtual RealPoint rt( const AngularCoordinates& t ) const = 0;
165
172 virtual RealPoint rp( const AngularCoordinates& t ) const = 0;
173
181 virtual RealPoint rtt( const AngularCoordinates& t ) const = 0;
182
190 virtual RealPoint rpp( const AngularCoordinates& t ) const = 0;
191
199 virtual RealPoint rtp( const AngularCoordinates& t ) const = 0;
200
201 // ------------------------- star-shaped services -------------------------
202 public:
203
211 virtual Orientation orientation( const RealPoint& p ) const;
212
213 /*
214 * @param t is a couple of Teta && Phi wich are 2 angles
215 respectivly between [0,2PI] and [0,Pi].
216 *
217 * @return the vector (x'(t),y'(t),z'(t)) made unitary which is
218 * the unit tangent to the shape boundary.
219 */
220 /*
221 virtual RealPoint tangent( AngularCoordinates t ) const;
222 */
223
231 virtual RealPoint normal( const AngularCoordinates& t ) const;
232
241 virtual double gaussianCurvature( const AngularCoordinates& t ) const;
242
243
252 virtual double meanCurvature( const AngularCoordinates& t ) const;
253
254
265 virtual double arclength( const AngularCoordinates& t1,
267 unsigned int nb ) const;
268
269
280 virtual double surfacelength( const AngularCoordinates& t1,
282 unsigned int nb ) const;
283
284
285
286 // ----------------------- Interface --------------------------------------
287 public:
288
293 void selfDisplay( std::ostream & out ) const;
294
299 bool isValid() const;
300
301 // ------------------------- Hidden services ------------------------------
302 private:
303
307 template <typename T>
308 inline
309 bool isAlmostEqual( T x, T y ) const
310 {
311 return std::abs(x - y) <= std::numeric_limits<T>::epsilon();
312 }
313
314 }; // end of class StarShaped3D
315
316
323 template <typename T>
324 std::ostream&
325 operator<< ( std::ostream & out, const StarShaped3D<T> & object );
326
327} // namespace DGtal
328
329
331// Includes inline functions.
332#include "StarShaped3D.ih"
333
334// //
336
337#endif // !defined StarShaped3D_h
338
339#undef StarShaped3D_RECURSES
340#endif // else defined(StarShaped3D_RECURSES)
PointVector< dim, double > RealPoint
Definition: SpaceND.h:117
virtual RealPoint rtp(const AngularCoordinates &t) const =0
StarShaped3D()=default
virtual RealPoint rpp(const AngularCoordinates &t) const =0
virtual RealPoint getLowerBound() const =0
virtual double meanCurvature(const AngularCoordinates &t) const
bool isAlmostEqual(T x, T y) const
Definition: StarShaped3D.h:309
std::pair< double, double > AngularCoordinates
Definition: StarShaped3D.h:77
virtual RealPoint rp(const AngularCoordinates &t) const =0
virtual double arclength(const AngularCoordinates &t1, AngularCoordinates t2, unsigned int nb) const
Space::RealPoint RealPoint
Definition: StarShaped3D.h:76
virtual void moveTo(const RealPoint &newCenter)=0
virtual double gaussianCurvature(const AngularCoordinates &t) const
virtual Orientation orientation(const RealPoint &p) const
virtual RealPoint gradient(const AngularCoordinates &t) const =0
virtual RealPoint interiorPoint() const
Definition: StarShaped3D.h:102
bool isValid() const
virtual double surfacelength(const AngularCoordinates &t1, AngularCoordinates t2, unsigned int nb) const
virtual AngularCoordinates parameter(const RealPoint &p) const =0
virtual RealPoint center() const =0
virtual ~StarShaped3D()=default
virtual RealPoint normal(const AngularCoordinates &t) const
virtual RealPoint rt(const AngularCoordinates &t) const =0
virtual RealPoint rtt(const AngularCoordinates &t) const =0
StarShaped3D & operator=(const StarShaped3D &other)=delete
virtual RealPoint getUpperBound() const =0
virtual RealPoint x(const AngularCoordinates &t) const =0
void selfDisplay(std::ostream &out) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Orientation
Definition: Common.h:142