DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
COBAGenericNaivePlane.h
1 
17 #pragma once
18 
33 #if defined(COBAGenericNaivePlane_RECURSES)
34 #error Recursive header files inclusion detected in COBAGenericNaivePlane.h
35 #else // defined(COBAGenericNaivePlane_RECURSES)
36 
37 #define COBAGenericNaivePlane_RECURSES
38 
39 #if !defined COBAGenericNaivePlane_h
40 
41 #define COBAGenericNaivePlane_h
42 
44 // Inclusions
45 #include <iostream>
46 #include <set>
47 #include "DGtal/base/Common.h"
48 #include "DGtal/kernel/CInteger.h"
49 #include "DGtal/kernel/CSpace.h"
50 #include "DGtal/kernel/SpaceND.h"
51 #include "DGtal/kernel/PointVector.h"
52 #include "DGtal/arithmetic/IntegerComputer.h"
53 #include "DGtal/geometry/surfaces/COBANaivePlane.h"
55 
56 namespace DGtal
57 {
58 
60  // template class COBAGenericNaivePlane
119  template < typename TSpace,
120  typename TInternalInteger >
122  {
123 
126  BOOST_STATIC_ASSERT(( TSpace::dimension == 3 ));
127 
128  // ----------------------- public types ------------------------------
129  public:
130  typedef TSpace Space;
131  typedef typename Space::Point Point;
132  typedef std::set< Point > PointSet;
133  typedef typename PointSet::size_type Size;
134  typedef typename PointSet::const_iterator ConstIterator;
135  typedef typename PointSet::iterator Iterator;
136  typedef TInternalInteger InternalInteger;
138 
139  // ----------------------- std public types ------------------------------
140  public:
141  typedef typename PointSet::const_iterator const_iterator;
142  typedef typename PointSet::const_pointer const_pointer;
143  typedef typename PointSet::const_reference const_reference;
144  typedef typename PointSet::value_type value_type;
145  typedef typename PointSet::difference_type difference_type;
146  typedef typename PointSet::size_type size_type;
147 
148  // ----------------------- internal types ------------------------------
149  private:
151  typedef std::vector<Dimension>::iterator AxisIterator;
152  typedef std::vector<Dimension>::const_iterator AxisConstIterator;
153  // ----------------------- Standard services ------------------------------
154  public:
155 
160 
166 
172 
179 
183  MyIntegerComputer & ic() const;
184 
188  Dimension active() const;
189 
194  void clear();
195 
213  void init( InternalInteger diameter,
216 
220  Size complexity() const;
221 
222  //-------------------- model of ForwardContainer -----------------------------
223  public:
224 
228  Size size() const;
229 
233  bool empty() const;
234 
238  ConstIterator begin() const;
239 
243  ConstIterator end() const;
244 
250  Size max_size() const;
251 
256  Size maxSize() const;
257 
258 
259  //-------------------- model of CPointPredicate -----------------------------
260  public:
261 
271  bool operator()( const Point & p ) const;
272 
273  //-------------------- model of CIncrementalPrimitiveComputer -----------------------------
274  public:
275 
285  bool extendAsIs( const Point & p );
286 
297  bool extend( const Point & p );
298 
309  bool isExtendable( const Point & p ) const;
310 
311  //-------------------- model of CAdditivePrimitiveComputer -----------------------------
312  public:
313 
327  template <typename TInputIterator>
328  bool extend( TInputIterator it, TInputIterator itE );
329 
344  template <typename TInputIterator>
345  bool isExtendable( TInputIterator it, TInputIterator itE ) const;
346 
347  //-------------------- Parameters services -----------------------------
348  public:
349 
356  template <typename Vector3D>
357  void getNormal( Vector3D & normal ) const;
358 
365  template <typename Vector3D>
366  void getUnitNormal( Vector3D & normal ) const;
367 
375  void getBounds( double & min, double & max ) const;
376 
383  const Point & minimalPoint() const;
384 
391  const Point & maximalPoint() const;
392 
393  // ----------------------- Interface --------------------------------------
394  public:
395 
400  void selfDisplay ( std::ostream & out ) const;
401 
406  bool isValid() const;
407 
408  // ------------------------- Private Datas --------------------------------
409  private:
410  std::vector<Dimension> myAxes;
412  mutable std::vector<Dimension> _axesToErase;
413  // ------------------------- Hidden services ------------------------------
414  protected:
415 
416 
417  // ------------------------- Internals ------------------------------------
418  private:
419  }; // end of class COBAGenericNaivePlane
420 
421 
428  template <typename TSpace, typename TInternalInteger>
429  std::ostream&
430  operator<< ( std::ostream & out, const COBAGenericNaivePlane<TSpace, TInternalInteger> & object );
431 
432 } // namespace DGtal
433 
434 
436 // Includes inline functions.
437 #include "DGtal/geometry/surfaces/COBAGenericNaivePlane.ih"
438 
439 // //
441 
442 #endif // !defined COBAGenericNaivePlane_h
443 
444 #undef COBAGenericNaivePlane_RECURSES
445 #endif // else defined(COBAGenericNaivePlane_RECURSES)