DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
MelkmanConvexHull.h
1
16
17
#pragma once
18
30
31
#if defined(MelkmanConvexHull_RECURSES)
32
#error Recursive header files inclusion detected in MelkmanConvexHull.h
33
#else
// defined(MelkmanConvexHull_RECURSES)
35
#define MelkmanConvexHull_RECURSES
36
37
#if !defined MelkmanConvexHull_h
39
#define MelkmanConvexHull_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/base/Alias.h"
46
#include "DGtal/base/CountedConstPtrOrConstPtr.h"
47
#include "DGtal/base/IteratorCirculatorTraits.h"
48
#include "DGtal/base/FrontInsertionSequenceToStackAdapter.h"
49
#include "DGtal/base/BackInsertionSequenceToStackAdapter.h"
50
51
#include "DGtal/geometry/tools/determinant/COrientationFunctor2.h"
52
#include "DGtal/geometry/tools/determinant/PredicateFromOrientationFunctor2.h"
53
54
#include "DGtal/geometry/tools/Hull2DHelpers.h"
56
57
namespace
DGtal
58
{
59
61
// template class MelkmanConvexHull
87
template
<
typename
TPoint,
88
typename
TOrientationFunctor >
89
class
MelkmanConvexHull
90
{
91
// ----------------------- Types ------------------------------------------
92
public
:
93
97
typedef
MelkmanConvexHull<TPoint, TOrientationFunctor>
Self
;
98
102
typedef
TPoint
Point
;
106
typedef
TOrientationFunctor
Functor
;
107
BOOST_CONCEPT_ASSERT
((
concepts::COrientationFunctor2<Functor>
));
108
//the two types of points must be the same
109
BOOST_STATIC_ASSERT
(( boost::is_same< Point, typename Functor::Point >::value ));
110
114
typedef
PredicateFromOrientationFunctor2<Functor,false,false>
BackwardPredicate
;
118
typedef
PredicateFromOrientationFunctor2<Functor,true,false>
ForwardPredicate
;
119
123
typedef
typename
std::deque<Point>::const_iterator
ConstIterator
;
124
125
// ----------------------- Standard services ------------------------------
126
public
:
127
128
MelkmanConvexHull
(
Alias<Functor>
aFunctor);
129
MelkmanConvexHull
();
130
136
MelkmanConvexHull
(
const
MelkmanConvexHull
& mch ) =
default
;
137
138
// ----------------------- Interface --------------------------------------
139
public
:
140
147
void
add
(
const
Point
&
aPoint
);
148
157
ConstIterator
begin
()
const
;
158
163
ConstIterator
end
()
const
;
164
169
void
selfDisplay
( std::ostream & out )
const
;
170
175
bool
isValid
()
const
;
176
183
Self
&
operator=
(
const
Self
& mch );
184
189
const
Point
&
operator[]
(
unsigned
int
i)
const
;
190
194
size_t
size
()
const
;
195
199
void
clear
();
200
207
void
reverse
();
208
209
210
// ------------------------- Private Data --------------------------------
211
private
:
215
Functor
myDefaultFunctor
{};
220
std::deque<Point>
myContainer
;
224
BackwardPredicate
myBackwardPredicate
;
228
ForwardPredicate
myForwardPredicate
;
232
Point
myFirstPoint
;
233
234
// ------------------------- Internals ------------------------------------
235
private
:
236
237
};
// end of class MelkmanConvexHull
238
245
template
<
typename
TPo
int
,
typename
TOrientationFunctor>
246
std::ostream&
247
operator<<
( std::ostream & out,
const
MelkmanConvexHull<TPoint, TOrientationFunctor>
&
object
);
248
249
namespace
functions
250
{
251
namespace
Hull2D
252
{
271
template
<
typename
ForwardIterator,
272
typename
OutputIterator,
273
typename
Functor
>
274
void
melkmanConvexHullAlgorithm
(
const
ForwardIterator& itb,
275
const
ForwardIterator& ite,
276
OutputIterator res,
277
Functor
& aFunctor );
278
}
//namespace Hull2D
279
}
//namespace functions
280
281
}
// namespace DGtal
282
283
285
// Includes inline functions.
286
#include "DGtal/geometry/tools/MelkmanConvexHull.ih"
287
288
// //
290
291
#endif
// !defined MelkmanConvexHull_h
292
293
#undef MelkmanConvexHull_RECURSES
294
#endif
// else defined(MelkmanConvexHull_RECURSES)
DGtal::Alias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition
Alias.h:183
DGtal::MelkmanConvexHull
Aim: This class implements the on-line algorithm of Melkman for the computation of the convex hull of...
Definition
MelkmanConvexHull.h:90
DGtal::MelkmanConvexHull::size
size_t size() const
DGtal::MelkmanConvexHull::MelkmanConvexHull
MelkmanConvexHull(const MelkmanConvexHull &mch)=default
DGtal::MelkmanConvexHull::MelkmanConvexHull
MelkmanConvexHull()
DGtal::ConstIterator::myBackwardPredicate
BackwardPredicate myBackwardPredicate
Definition
MelkmanConvexHull.h:224
DGtal::ConstIterator::myDefaultFunctor
Functor myDefaultFunctor
Definition
MelkmanConvexHull.h:215
DGtal::MelkmanConvexHull::end
ConstIterator end() const
DGtal::ConstIterator::myContainer
std::deque< Point > myContainer
Definition
MelkmanConvexHull.h:220
DGtal::MelkmanConvexHull::isValid
bool isValid() const
DGtal::MelkmanConvexHull::operator=
Self & operator=(const Self &mch)
DGtal::MelkmanConvexHull::MelkmanConvexHull
MelkmanConvexHull(Alias< Functor > aFunctor)
DGtal::MelkmanConvexHull::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::MelkmanConvexHull::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((boost::is_same< Point, typename Functor::Point >::value))
DGtal::ConstIterator::ForwardPredicate
PredicateFromOrientationFunctor2< Functor, true, false > ForwardPredicate
Definition
MelkmanConvexHull.h:118
DGtal::ConstIterator::Self
MelkmanConvexHull< InputPoint, Functor > Self
Definition
MelkmanConvexHull.h:97
DGtal::MelkmanConvexHull::add
void add(const Point &aPoint)
DGtal::ConstIterator::myFirstPoint
Point myFirstPoint
Definition
MelkmanConvexHull.h:232
DGtal::MelkmanConvexHull::begin
ConstIterator begin() const
DGtal::ConstIterator::BackwardPredicate
PredicateFromOrientationFunctor2< Functor, false, false > BackwardPredicate
Definition
MelkmanConvexHull.h:114
DGtal::ConstIterator::Point
InputPoint Point
Definition
MelkmanConvexHull.h:102
DGtal::ConstIterator::Functor
Functor Functor
Definition
MelkmanConvexHull.h:106
DGtal::MelkmanConvexHull::operator[]
const Point & operator[](unsigned int i) const
DGtal::ConstIterator::ConstIterator
std::deque< Point >::const_iterator ConstIterator
Definition
MelkmanConvexHull.h:123
DGtal::MelkmanConvexHull::clear
void clear()
DGtal::MelkmanConvexHull::reverse
void reverse()
DGtal::MelkmanConvexHull::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::COrientationFunctor2< Functor >))
DGtal::ConstIterator::myForwardPredicate
ForwardPredicate myForwardPredicate
Definition
MelkmanConvexHull.h:228
DGtal::PredicateFromOrientationFunctor2
Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate....
Definition
PredicateFromOrientationFunctor2.h:82
DGtal::functions::Hull2D::melkmanConvexHullAlgorithm
void melkmanConvexHullAlgorithm(const ForwardIterator &itb, const ForwardIterator &ite, OutputIterator res, Functor &aFunctor)
Procedure that retrieves the vertices of the hull of a set of 2D points given by the range [ itb ,...
DGtal::functions
functions namespace gathers all DGtal functionsxs.
Definition
ConstExpressions.h:50
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::concepts::COrientationFunctor2
Aim: This concept is a refinement of COrientationFunctor, useful for simple algebraic curves that can...
Definition
COrientationFunctor2.h:85
Functor
Definition
testFunctorHolder.cpp:45
aPoint
const Point aPoint(3, 4)
src
DGtal
geometry
tools
MelkmanConvexHull.h
Generated on
for DGtal by
1.18.0