DGtal 1.4.0
Loading...
Searching...
No Matches
AlphaThickSegmentComputer.h
1
17#pragma once
18
35#if defined(AlphaThickSegmentComputer_RECURSES)
36#error Recursive header files inclusion detected in AlphaThickSegmentComputer.h
37#else // defined(AlphaThickSegmentComputer_RECURSES)
39#define AlphaThickSegmentComputer_RECURSES
40
41#if !defined AlphaThickSegmentComputer_h
43#define AlphaThickSegmentComputer_h
44
46// Inclusions
47#include <iostream>
48#include "DGtal/base/Common.h"
49#include "DGtal/base/ReverseIterator.h"
50#include "DGtal/kernel/SpaceND.h"
51#include "DGtal/geometry/surfaces/ParallelStrip.h"
52#include "DGtal/geometry/tools/MelkmanConvexHull.h"
53#include "DGtal/geometry/tools/determinant/InHalfPlaneBySimple3x3Matrix.h"
55
56namespace DGtal
57{
58
60// class AlphaThickSegmentComputer
124template <typename TInputPoint,
125 typename TConstIterator = typename std::vector< TInputPoint >::const_iterator >
126
128{
129
130 // ----------------------- public types --------------------------------------
131 BOOST_STATIC_ASSERT(( TInputPoint::dimension == 2 ));
132 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<TConstIterator>));
133
134public:
138 typedef TInputPoint InputPoint;
139
143 typedef std::vector< InputPoint > InputPointContainer;
144 typedef typename InputPointContainer::size_type Size;
145 typedef typename InputPointContainer::const_iterator ContainerConstIterator;
147
148 typedef typename InputPointContainer::iterator Iterator;
149 typedef TConstIterator ConstIterator;
151
157
162
163 // ----------------------- internal types --------------------------------------
164
165private:
181
182
183 // ----------------------- Standard services ------------------------------
184public:
185
186
187
196 AlphaThickSegmentComputer(const double maximalThickness = 1.0,
198 const double thickCompPrecision=1e-6);
199
200
201
206
207
214
215
223
224
228 Self getSelf() const;
229
230
235
243 bool operator==( const AlphaThickSegmentComputer & other ) const;
244
251 bool operator!=( const AlphaThickSegmentComputer & other ) const;
252
253
254
255 //-------------------- model of ForwardContainer -----------------------------
256public:
257
263 Size size() const;
264
265
271 bool empty() const;
272
273
280
281
288
294
295
301
308
309
317
318
322 Size max_size() const;
323
324
325
326
327 //-------------------- model of CForwardSegmentComputer ----------------
328
329public:
330
338 void init(const ConstIterator &it);
339
340
353
354
365
366
377
378
391
392
393
394 //-------------------- Primitive services -----------------------------
395
396
403
404
405
406
407 // ----------------------- Interface --------------------------------------
408public:
409
410
415 bool isValid() const;
416
417
423 std::pair<InputPoint, InputPoint> getExtremityPoints() const;
424
425
434 std::pair<std::pair<InputPoint, InputPoint>, InputPoint>
436
437
445 void computeParallelStripParams(double &mu, PointD &N, double &nu) const;
446
447
455
456
460 double getThickness() const;
461
462
466 double getMu() const;
467
468
472 double getNu() const;
473
474
478 double getSegmentLength() const;
479
480
485
486
490 unsigned int getNumberSegmentPoints() const;
491
492
493
494 // ------------------------- Display services ------------------------------
495
496
500 std::vector<InputPoint> getConvexHull() const;
501
502
503
522 const InputPoint &aLastPt,
523 PointD &pt1LongestSegment1,
524 PointD &pt2LongestSegment1,
525 PointD &pt3LongestSegment2,
526 PointD &pt4LongestSegment2,
527 double minVisibleWidthBounds = 0.2) const;
528
529
548 void getBoundingBox(PointD &pt1LongestSegment1,
549 PointD &pt2LongestSegment1,
550 PointD &pt3LongestSegment2,
551 PointD &pt4LongestSegment2) const;
552
553
554
555
556
560 std::string className() const;
561
562
568 void selfDisplay ( std::ostream & out ) const;
569
570 // ------------------------- Protected Datas ------------------------------
571protected:
572
573
578
583
584
585
586
587 // ------------------------- Private Datas --------------------------------
588private:
589
594
599
604
605
610
611
616
621
623
628
629
630
631
632 // ------------------------- Hidden services ------------------------------
633protected:
634
635
636
641
642
652
653
654
665 template<typename TPoint, typename TPointD>
666 bool projectOnStraightLine(const TPoint & ptA, const TPoint & ptB,
667 const TPoint & ptC, TPointD & ptProjected) const;
668
669
681 template<typename TConstIteratorG>
682 void computeExtremaPoints(const TConstIteratorG & itBegin, const TConstIteratorG & itEnd,
683 InputPoint & aFirstExtrPt, InputPoint & aLastExtrPt) const;
684
685
686 // ------------------------- Internals ------------------------------------
687private:
688
689}; // end of class AlphaThickSegmentComputer
690
691
698template <typename TInputPoint, typename TConstIterator>
699std::ostream&
700operator<< ( std::ostream & out, const AlphaThickSegmentComputer<TInputPoint, TConstIterator> & object );
701
702
703} // namespace DGtal
704
705
707// Includes inline functions.
708#if !defined(BUILD_INLINE)
709#include "DGtal/geometry/curves/AlphaThickSegmentComputer.ih"
710#endif
711
712
713// //
715
716#endif // !defined AlphaThickSegmentComputer_h
717
718#undef AlphaThickSegmentComputer_RECURSES
719#endif // else defined(AlphaThickSegmentComputer_RECURSES)
Aim: This class is devoted to the recognition of alpha thick segments as described in FaureTangential...
AlphaThickSegmentComputer(const double maximalThickness=1.0, const ThicknessDef &thicknessDefinition=functions::Hull2D::HorizontalVerticalThickness, const double thickCompPrecision=1e-6)
ConstIterator end() const
std::pair< InputPoint, InputPoint > getExtremityPoints() const
AlphaThickSegmentComputer & operator=(const AlphaThickSegmentComputer &other)
InputPointContainer::const_iterator ContainerConstIterator
void getBoundingBox(PointD &pt1LongestSegment1, PointD &pt2LongestSegment1, PointD &pt3LongestSegment2, PointD &pt4LongestSegment2) const
InputPointContainer::iterator Iterator
std::vector< InputPoint > getConvexHull() const
AlphaThickSegmentComputer< InputPoint, ReverseIterator< ConstIterator > > Reverse
std::vector< InputPoint > InputPointContainer
ContainerConstIterator containerBegin() const
InputPointContainer::size_type Size
bool isExtendableFront(const InputPoint &aPoint)
void init(const ConstIterator &it)
bool extendFront(const InputPoint &aPoint)
ConvexhullConstIterator convexhullEnd() const
DGtal::InHalfPlaneBySimple3x3Matrix< InputPoint, typename InputPoint::Component > Functor
void computeExtremaPoints(const TConstIteratorG &itBegin, const TConstIteratorG &itEnd, InputPoint &aFirstExtrPt, InputPoint &aLastExtrPt) const
bool operator!=(const AlphaThickSegmentComputer &other) const
void selfDisplay(std::ostream &out) const
bool operator==(const AlphaThickSegmentComputer &other) const
AlphaThickSegmentComputer(const AlphaThickSegmentComputer &other)
std::string className() const
AlphaThickSegmentComputer< InputPoint, ConstIterator > Self
unsigned int getNumberSegmentPoints() const
DGtal::PointVector< 2, double > PointD
ConvexhullConstIterator convexhullBegin() const
BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator< TConstIterator >))
BOOST_STATIC_ASSERT((TInputPoint::dimension==2))
std::pair< std::pair< InputPoint, InputPoint >, InputPoint > getAntipodalLeaningPoints() const
bool projectOnStraightLine(const TPoint &ptA, const TPoint &ptB, const TPoint &ptC, TPointD &ptProjected) const
ParallelStrip< SpaceND< 2, DGtal::int32_t >,true, true > Primitive
ContainerConstIterator containerEnd() const
ConstIterator begin() const
void getBoundingBoxFromExtremPoints(const InputPoint &aFirstPt, const InputPoint &aLastPt, PointD &pt1LongestSegment1, PointD &pt2LongestSegment1, PointD &pt3LongestSegment2, PointD &pt4LongestSegment2, double minVisibleWidthBounds=0.2) const
DGtal::functions::Hull2D::ThicknessDefinition ThicknessDef
void computeParallelStripParams(double &mu, PointD &N, double &nu) const
DGtal::MelkmanConvexHull< InputPoint, Functor >::ConstIterator ConvexhullConstIterator
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: This class implements the on-line algorithm of Melkman for the computation of the convex hull of...
std::deque< Point >::const_iterator ConstIterator
Aim: A parallel strip in the space is the intersection of two parallel half-planes such that each hal...
Aim: Implements basic operations that will be used in Point and Vector classes.
ThicknessDefinition
The 2 thickness definitions.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::MelkmanConvexHull< InputPoint, Functor > melkmanCH
const Point aPoint(3, 4)