DGtal  0.9.2
ChordGenericNaivePlaneComputer.h
1 
17 #pragma once
18 
31 #if defined(ChordGenericNaivePlaneComputer_RECURSES)
32 #error Recursive header files inclusion detected in ChordGenericNaivePlaneComputer.h
33 #else // defined(ChordGenericNaivePlaneComputer_RECURSES)
34 
35 #define ChordGenericNaivePlaneComputer_RECURSES
36 
37 #if !defined ChordGenericNaivePlaneComputer_h
38 
39 #define ChordGenericNaivePlaneComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <set>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/kernel/CInteger.h"
47 #include "DGtal/kernel/CSpace.h"
48 #include "DGtal/kernel/SpaceND.h"
49 #include "DGtal/kernel/PointVector.h"
50 #include "DGtal/arithmetic/IntegerComputer.h"
51 #include "DGtal/geometry/surfaces/ChordNaivePlaneComputer.h"
53 
54 namespace DGtal
55 {
56 
58  // template class ChordGenericNaivePlaneComputer
115  template < typename TSpace,
116  typename TInputPoint,
117  typename TInternalScalar >
119  {
122  BOOST_STATIC_ASSERT(( TSpace::dimension == 3 ));
123  BOOST_STATIC_ASSERT(( TInputPoint::dimension == 3 ));
124 
125  // ----------------------- public types ------------------------------
126  public:
127  typedef TSpace Space;
128  typedef TInputPoint InputPoint;
129  typedef TInternalScalar InternalScalar;
130  typedef InputPoint InputVector;
131  typedef typename InputVector::Component Component;
132  typedef typename InputPoint::Coordinate Coordinate;
133  typedef InternalScalar InternalVector[ 3 ];
134  typedef typename Space::Point Point;
137 
138  typedef std::set< InputPoint > InputPointSet;
139  typedef typename InputPointSet::size_type Size;
140  typedef typename InputPointSet::const_iterator ConstIterator;
141  typedef typename InputPointSet::iterator Iterator;
142 
143  // ----------------------- std public types ------------------------------
144  public:
145  typedef typename InputPointSet::const_iterator const_iterator;
146  typedef typename InputPointSet::const_pointer const_pointer;
147  typedef typename InputPointSet::const_reference const_reference;
148  typedef typename InputPointSet::value_type value_type;
149  typedef typename InputPointSet::difference_type difference_type;
150  typedef typename InputPointSet::size_type size_type;
151 
152  // ----------------------- internal types ------------------------------
153  private:
154  typedef std::vector<Dimension>::iterator AxisIterator;
155  typedef std::vector<Dimension>::const_iterator AxisConstIterator;
156  // ----------------------- Standard services ------------------------------
157  public:
158 
163 
169 
175 
182 
186  Dimension active() const;
187 
192  void clear();
193 
208  void init( InternalScalar widthNumerator = NumberTraits< InternalScalar >::ONE,
209  InternalScalar widthDenominator = NumberTraits< InternalScalar >::ONE );
210 
211  //-------------------- model of ForwardContainer -----------------------------
212  public:
213 
217  Size size() const;
218 
222  bool empty() const;
223 
227  ConstIterator begin() const;
228 
232  ConstIterator end() const;
233 
239  Size max_size() const;
240 
245  Size maxSize() const;
246 
247 
248  //-------------------- model of concepts::CPointPredicate -----------------------------
249  public:
250 
260  bool operator()( const Point & p ) const;
261 
262  //-------------------- model of CIncrementalPrimitiveComputer -----------------------------
263  public:
264 
274  bool extendAsIs( const InputPoint & p );
275 
286  bool extend( const InputPoint & p );
287 
298  bool isExtendable( const InputPoint & p ) const;
299 
300  //-------------------- model of CAdditivePrimitiveComputer -----------------------------
301  public:
302 
316  template <typename TInputIterator>
317  bool extend( TInputIterator it, TInputIterator itE );
318 
333  template <typename TInputIterator>
334  bool isExtendable( TInputIterator it, TInputIterator itE ) const;
335 
336  //-------------------- Primitive services -----------------------------
337  public:
338 
349  Primitive primitive() const;
350 
351  //-------------------- Parameters services -----------------------------
352  public:
353 
360  template <typename Vector3D>
361  void getNormal( Vector3D & normal ) const;
362 
369  template <typename Vector3D>
370  void getUnitNormal( Vector3D & normal ) const;
371 
379  void getBounds( double & min, double & max ) const;
380 
387  const InputPoint & minimalPoint() const;
388 
395  const InputPoint & maximalPoint() const;
396 
397  // ----------------------- Interface --------------------------------------
398  public:
399 
404  void selfDisplay ( std::ostream & out ) const;
405 
410  bool isValid() const;
411 
412  // ------------------------- Private Datas --------------------------------
413  private:
414  std::vector<Dimension> myAxes;
415  ChordComputer myComputers[ 3 ];
416  mutable std::vector<Dimension> _axesToErase;
417  // ------------------------- Hidden services ------------------------------
418  protected:
419 
420 
421  // ------------------------- Internals ------------------------------------
422  private:
423  }; // end of class ChordGenericNaivePlaneComputer
424 
425 
432  template <typename TSpace, typename TInputPoint, typename TInternalScalar>
433  std::ostream&
434  operator<< ( std::ostream & out,
436 
437 } // namespace DGtal
438 
439 
441 // Includes inline functions.
442 #include "DGtal/geometry/surfaces/ChordGenericNaivePlaneComputer.ih"
443 
444 // //
446 
447 #endif // !defined ChordGenericNaivePlaneComputer_h
448 
449 #undef ChordGenericNaivePlaneComputer_RECURSES
450 #endif // else defined(ChordGenericNaivePlaneComputer_RECURSES)
bool extendAsIs(const InputPoint &p)
bool operator()(const Point &p) const
DGtal::uint32_t Dimension
Definition: Common.h:113
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
Aim: A parallel strip in the space is the intersection of two parallel half-planes such that each hal...
Definition: ParallelStrip.h:90
std::vector< Dimension >::const_iterator AxisConstIterator
bool isExtendable(const InputPoint &p) const
void getBounds(double &min, double &max) const
void selfDisplay(std::ostream &out) const
BOOST_STATIC_ASSERT((TSpace::dimension==3))
void getUnitNormal(Vector3D &normal) const
const InputPoint & minimalPoint() const
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines...
Definition: CSpace.h:105
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
const InputPoint & maximalPoint() const
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:69
ChordNaivePlaneComputer< Space, InputPoint, InternalScalar > ChordComputer
void getNormal(Vector3D &normal) const
void init(InternalScalar widthNumerator=NumberTraits< InternalScalar >::ONE, InternalScalar widthDenominator=NumberTraits< InternalScalar >::ONE)
Aim: Concept checking for Signed Numbers. Models of this concept should be listed in NumberTraits cla...
Definition: CSignedNumber.h:97
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A class that recognizes pieces of digital planes of given axis width. When the width is 1...
bool extend(const InputPoint &p)
ChordGenericNaivePlaneComputer & operator=(const ChordGenericNaivePlaneComputer &other)
std::vector< Dimension >::iterator AxisIterator