DGtal  1.5.beta
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)
35 #define ChordGenericNaivePlaneComputer_RECURSES
36 
37 #if !defined ChordGenericNaivePlaneComputer_h
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;
131  typedef typename InputVector::Component Component;
132  typedef typename InputPoint::Coordinate Coordinate;
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 
210 
211  //-------------------- model of ForwardContainer -----------------------------
212  public:
213 
217  Size size() const;
218 
222  bool empty() const;
223 
228 
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 
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;
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)
Aim: A class that recognizes pieces of digital planes of given axis width. When the width is 1,...
void getNormal(Vector3D &normal) const
ChordGenericNaivePlaneComputer & operator=(const ChordGenericNaivePlaneComputer &other)
void getBounds(double &min, double &max) const
bool isExtendable(TInputIterator it, TInputIterator itE) const
void getUnitNormal(Vector3D &normal) const
bool operator()(const Point &p) const
const InputPoint & maximalPoint() const
bool isExtendable(const InputPoint &p) const
ChordNaivePlaneComputer< Space, InputPoint, InternalScalar > ChordComputer
ChordGenericNaivePlaneComputer(const ChordGenericNaivePlaneComputer &other)
BOOST_STATIC_ASSERT((TInputPoint::dimension==3))
BOOST_STATIC_ASSERT((TSpace::dimension==3))
void init(InternalScalar widthNumerator=NumberTraits< InternalScalar >::ONE, InternalScalar widthDenominator=NumberTraits< InternalScalar >::ONE)
bool extend(const InputPoint &p)
void selfDisplay(std::ostream &out) const
bool extendAsIs(const InputPoint &p)
std::vector< Dimension >::iterator AxisIterator
const InputPoint & minimalPoint() const
BOOST_CONCEPT_ASSERT((concepts::CSignedNumber< TInternalScalar >))
bool extend(TInputIterator it, TInputIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
std::vector< Dimension >::const_iterator AxisConstIterator
Aim: A parallel strip in the space is the intersection of two parallel half-planes such that each hal...
Definition: ParallelStrip.h:91
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::uint32_t Dimension
Definition: Common.h:136
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:564
Aim: Concept checking for Signed Numbers. Models of this concept should be listed in NumberTraits cla...
Definition: CSignedNumber.h:98
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
Definition: CSpace.h:106
int max(int a, int b)