DGtal 1.3.0
Loading...
Searching...
No Matches
COBANaivePlaneComputer.h
1
17#pragma once
18
33#if defined(COBANaivePlaneComputer_RECURSES)
34#error Recursive header files inclusion detected in COBANaivePlaneComputer.h
35#else // defined(COBANaivePlaneComputer_RECURSES)
37#define COBANaivePlaneComputer_RECURSES
38
39#if !defined COBANaivePlaneComputer_h
41#define COBANaivePlaneComputer_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/arithmetic/LatticePolytope2D.h"
54#include "DGtal/geometry/surfaces/ParallelStrip.h"
56
57namespace DGtal
58{
59
61 // template class COBANaivePlaneComputer
127 template < typename TSpace,
128 typename TInternalInteger >
130 {
131
134 BOOST_STATIC_ASSERT(( TSpace::dimension == 3 ));
135
136 // ----------------------- public types ------------------------------
137 public:
138 typedef TSpace Space;
139 typedef typename Space::Point Point;
140 typedef std::set< Point > PointSet;
141 typedef typename PointSet::size_type Size;
142 typedef typename PointSet::const_iterator ConstIterator;
143 typedef typename PointSet::iterator Iterator;
144 typedef TInternalInteger InternalInteger;
148
149 // ----------------------- std public types ------------------------------
150 public:
151 typedef typename PointSet::const_iterator const_iterator;
152 typedef typename PointSet::const_pointer const_pointer;
153 typedef typename PointSet::const_reference const_reference;
154 typedef typename PointSet::value_type value_type;
155 typedef typename PointSet::difference_type difference_type;
156 typedef typename PointSet::size_type size_type;
157
158 // ----------------------- internal types ------------------------------
159 private:
165
171 struct State {
179 };
180
181 // ----------------------- Standard services ------------------------------
182 public:
183
188
194
200
207
212
217 void clear();
218
238 void init( Dimension axis, InternalInteger diameter,
241
246
247 //-------------------- model of ForwardContainer -----------------------------
248 public:
249
253 Size size() const;
254
258 bool empty() const;
259
264
269
275 Size max_size() const;
276
281 Size maxSize() const;
282
283
284 //-------------------- model of concepts::CPointPredicate -----------------------------
285 public:
286
296 bool operator()( const Point & p ) const;
297
298 //-------------------- model of CIncrementalPrimitiveComputer -----------------------------
299 public:
300
310 bool extendAsIs( const Point & p );
311
322 bool extend( const Point & p );
323
334 bool isExtendable( const Point & p ) const;
335
336 //-------------------- model of CAdditivePrimitiveComputer -----------------------------
337 public:
338
352 template <typename TInputIterator>
353 bool extend( TInputIterator it, TInputIterator itE );
354
369 template <typename TInputIterator>
370 bool isExtendable( TInputIterator it, TInputIterator itE ) const;
371
372 //-------------------- Primitive services -----------------------------
373 public:
374
386
387 //-------------------- Parameters services -----------------------------
388 public:
389
396 template <typename Vector3D>
397 void getNormal( Vector3D & normal ) const;
398
403
410 template <typename Vector3D>
411 void getUnitNormal( Vector3D & normal ) const;
412
420 void getBounds( double & min, double & max ) const;
421
428 const Point & minimalPoint() const;
429
436 const Point & maximalPoint() const;
437
438 // ----------------------- Interface --------------------------------------
439 public:
440
445 void selfDisplay ( std::ostream & out ) const;
446
451 bool isValid() const;
452
453 // ------------------------- Private Datas --------------------------------
454 private:
463 mutable State _state;
465 // ------------------------- Hidden services ------------------------------
466 protected:
467
468
469 // ------------------------- Internals ------------------------------------
470 private:
471
480 void computeCentroidAndNormal( State & state ) const;
481
495 void doubleCut( InternalPoint2 & grad, State & state ) const;
496
510 template <typename TInputIterator>
511 void computeMinMax( State & state, TInputIterator itB, TInputIterator itE ) const;
512
530 template <typename TInputIterator>
531 bool updateMinMax( State & state, TInputIterator itB, TInputIterator itE ) const;
532
542 bool checkPlaneWidth( const State & state ) const;
543
551 void computeGradient( InternalPoint2 & grad, const State & state ) const;
552
553 }; // end of class COBANaivePlaneComputer
554
555
562 template <typename TSpace, typename TInternalInteger>
563 std::ostream&
564 operator<< ( std::ostream & out, const COBANaivePlaneComputer<TSpace, TInternalInteger> & object );
565
566} // namespace DGtal
567
568
570// Includes inline functions.
571#include "DGtal/geometry/surfaces/COBANaivePlaneComputer.ih"
572
573// //
575
576#endif // !defined COBANaivePlaneComputer_h
577
578#undef COBANaivePlaneComputer_RECURSES
579#endif // else defined(COBANaivePlaneComputer_RECURSES)
Aim: A class that contains the COBA algorithm (Emilie Charrier, Lilian Buzer, DGCI2008) for recognizi...
SpaceND< 2, InternalInteger > InternalSpace2
PointSet::const_pointer const_pointer
bool extendAsIs(const Point &p)
void computeGradient(InternalPoint2 &grad, const State &state) const
bool operator()(const Point &p) const
void init(Dimension axis, InternalInteger diameter, InternalInteger widthNumerator=NumberTraits< InternalInteger >::ONE, InternalInteger widthDenominator=NumberTraits< InternalInteger >::ONE)
bool checkPlaneWidth(const State &state) const
void getBounds(double &min, double &max) const
BOOST_STATIC_ASSERT((TSpace::dimension==3))
ParallelStrip< Space, true, true > Primitive
void selfDisplay(std::ostream &out) const
void getNormal(Vector3D &normal) const
PointSet::const_iterator ConstIterator
void computeCentroidAndNormal(State &state) const
PointVector< 3, InternalInteger > InternalPoint3
void computeMinMax(State &state, TInputIterator itB, TInputIterator itE) const
ConstIterator end() const
PointVector< 3, InternalInteger > IntegerVector3
PointSet::const_iterator const_iterator
const IntegerVector3 & exactNormal() const
Primitive primitive() const
ConstIterator begin() const
PointSet::difference_type difference_type
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInternalInteger >))
bool extend(TInputIterator it, TInputIterator itE)
PointSet::const_reference const_reference
void getUnitNormal(Vector3D &normal) const
const Point & maximalPoint() const
const Point & minimalPoint() const
bool isExtendable(TInputIterator it, TInputIterator itE) const
COBANaivePlaneComputer(const COBANaivePlaneComputer &other)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
LatticePolytope2D< InternalSpace2 > ConvexPolygonZ2
ConvexPolygonZ2::HalfSpace HalfSpace
bool updateMinMax(State &state, TInputIterator itB, TInputIterator itE) const
bool isExtendable(const Point &p) const
void doubleCut(InternalPoint2 &grad, State &state) const
MyIntegerComputer & ic() const
bool extend(const Point &p)
IntegerComputer< InternalInteger > MyIntegerComputer
COBANaivePlaneComputer & operator=(const COBANaivePlaneComputer &other)
Aim: This class gathers several types and methods to make computation with integers.
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 ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Definition: Common.h:137
Aim: A half-space specified by a vector N and a constant c. The half-space is the set .
Aim: The traits class for all models of Cinteger.
Definition: NumberTraits.h:564
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
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)