DGtal  0.9.2
COBAGenericNaivePlaneComputer.h
1 
17 #pragma once
18 
33 #if defined(COBAGenericNaivePlaneComputer_RECURSES)
34 #error Recursive header files inclusion detected in COBAGenericNaivePlaneComputer.h
35 #else // defined(COBAGenericNaivePlaneComputer_RECURSES)
36 
37 #define COBAGenericNaivePlaneComputer_RECURSES
38 
39 #if !defined COBAGenericNaivePlaneComputer_h
40 
41 #define COBAGenericNaivePlaneComputer_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/COBANaivePlaneComputer.h"
55 
56 namespace DGtal
57 {
58 
60  // template class COBAGenericNaivePlaneComputer
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;
140 
141  // ----------------------- std public types ------------------------------
142  public:
143  typedef typename PointSet::const_iterator const_iterator;
144  typedef typename PointSet::const_pointer const_pointer;
145  typedef typename PointSet::const_reference const_reference;
146  typedef typename PointSet::value_type value_type;
147  typedef typename PointSet::difference_type difference_type;
148  typedef typename PointSet::size_type size_type;
149 
150  // ----------------------- internal types ------------------------------
151  private:
152  typedef std::vector<Dimension>::iterator AxisIterator;
153  typedef std::vector<Dimension>::const_iterator AxisConstIterator;
154  // ----------------------- Standard services ------------------------------
155  public:
156 
161 
167 
173 
180 
184  MyIntegerComputer & ic() const;
185 
189  Dimension active() const;
190 
195  void clear();
196 
214  void init( InternalInteger diameter,
215  InternalInteger widthNumerator = NumberTraits< InternalInteger >::ONE,
216  InternalInteger widthDenominator = NumberTraits< InternalInteger >::ONE );
217 
221  Size complexity() const;
222 
223  //-------------------- model of ForwardContainer -----------------------------
224  public:
225 
229  Size size() const;
230 
234  bool empty() const;
235 
239  ConstIterator begin() const;
240 
244  ConstIterator end() const;
245 
251  Size max_size() const;
252 
257  Size maxSize() const;
258 
259 
260  //-------------------- model of concepts::CPointPredicate -----------------------------
261  public:
262 
272  bool operator()( const Point & p ) const;
273 
274  //-------------------- model of CIncrementalPrimitiveComputer -----------------------------
275  public:
276 
286  bool extendAsIs( const Point & p );
287 
298  bool extend( const Point & p );
299 
310  bool isExtendable( const Point & p ) const;
311 
312  //-------------------- model of CAdditivePrimitiveComputer -----------------------------
313  public:
314 
328  template <typename TInputIterator>
329  bool extend( TInputIterator it, TInputIterator itE );
330 
345  template <typename TInputIterator>
346  bool isExtendable( TInputIterator it, TInputIterator itE ) const;
347 
348  //-------------------- Primitive services -----------------------------
349  public:
350 
361  Primitive primitive() const;
362 
363  //-------------------- Parameters services -----------------------------
364  public:
365 
372  template <typename Vector3D>
373  void getNormal( Vector3D & normal ) const;
374 
381  template <typename Vector3D>
382  void getUnitNormal( Vector3D & normal ) const;
383 
391  void getBounds( double & min, double & max ) const;
392 
399  const Point & minimalPoint() const;
400 
407  const Point & maximalPoint() const;
408 
409  // ----------------------- Interface --------------------------------------
410  public:
411 
416  void selfDisplay ( std::ostream & out ) const;
417 
422  bool isValid() const;
423 
424  // ------------------------- Private Datas --------------------------------
425  private:
426  std::vector<Dimension> myAxes;
427  COBAComputer myComputers[ 3 ];
428  mutable std::vector<Dimension> _axesToErase;
429  // ------------------------- Hidden services ------------------------------
430  protected:
431 
432 
433  // ------------------------- Internals ------------------------------------
434  private:
435  }; // end of class COBAGenericNaivePlaneComputer
436 
437 
444  template <typename TSpace, typename TInternalInteger>
445  std::ostream&
446  operator<< ( std::ostream & out, const COBAGenericNaivePlaneComputer<TSpace, TInternalInteger> & object );
447 
448 } // namespace DGtal
449 
450 
452 // Includes inline functions.
453 #include "DGtal/geometry/surfaces/COBAGenericNaivePlaneComputer.ih"
454 
455 // //
457 
458 #endif // !defined COBAGenericNaivePlaneComputer_h
459 
460 #undef COBAGenericNaivePlaneComputer_RECURSES
461 #endif // else defined(COBAGenericNaivePlaneComputer_RECURSES)
COBANaivePlaneComputer< Space, InternalInteger > COBAComputer
IntegerComputer< InternalInteger > MyIntegerComputer
Aim: A class that recognizes pieces of digital planes of given axis width. When the width is 1...
BOOST_STATIC_ASSERT((TSpace::dimension==3))
void init(InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE)
DGtal::uint32_t Dimension
Definition: Common.h:113
Aim: A parallel strip in the space is the intersection of two parallel half-planes such that each hal...
Definition: ParallelStrip.h:90
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
bool isExtendable(const Point &p) const
Aim: This class gathers several types and methods to make computation with integers.
std::vector< Dimension >::const_iterator AxisConstIterator
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:69
std::vector< Dimension >::iterator AxisIterator
void getUnitNormal(Vector3D &normal) const
DGtal is the top-level namespace which contains all DGtal functions and types.
const Point & minimalPoint() const
COBAGenericNaivePlaneComputer & operator=(const COBAGenericNaivePlaneComputer &other)
const Point & maximalPoint() const
void getBounds(double &min, double &max) const
void selfDisplay(std::ostream &out) const
void getNormal(Vector3D &normal) const
MyIntegerComputer & ic() const
bool operator()(const Point &p) const