Auxiliary class for convex hull determination in X-Y plane.
More...
#include <JGeometry2DToolkit.hh>
|
template<class T , class JCompare_t > |
static T | getConvexHull2D (T __begin, T __end, JCompare_t compare) |
| Partition half Hull.
|
|
Auxiliary class for convex hull determination in X-Y plane.
Definition at line 119 of file JGeometry2DToolkit.hh.
◆ JConvexHull2D()
JGEOMETRY2D::JConvexHull2D::JConvexHull2D |
( |
| ) |
|
|
inline |
◆ getConvexHull2D()
template<class T , class JCompare_t >
static T JGEOMETRY2D::JConvexHull2D::getConvexHull2D |
( |
T | __begin, |
|
|
T | __end, |
|
|
JCompare_t | compare ) |
|
inlinestaticprotected |
Partition half Hull.
- Parameters
-
__begin | begin of data |
__end | end of data |
compare | comparator |
- Returns
- end of data
Definition at line 130 of file JGeometry2DToolkit.hh.
133 {
135
136 if (__begin != __end) {
137
138 sort(__begin, __end, compare);
139
140 T l = __begin;
141
142 if (++l != __end) {
143
144 T i = __begin;
145
146 ++(++i);
147
148 for (T j, k; i != __end; ++i) {
149
150 for (j = k = l;
j != __begin &&
getCCW(*i, *j, *--k); --
j) {}
151
153 ++l;
154
155 iter_swap(l,i);
156 }
157 }
158
159 return l;
160
161 } else {
162
163 return __begin;
164 }
165 }
bool getCCW(const T &a, const T &b, const T &c)
Check sequence of three points in X-Y plane.
◆ operator()()
template<class T >
std::pair< T, T > JGEOMETRY2D::JConvexHull2D::operator() |
( |
T | __begin, |
|
|
T | __end ) const |
|
inline |
Get convex Hull.
- Parameters
-
__begin | begin of data |
__end | end of data |
- Returns
- end of lower and upper Hull data
Definition at line 232 of file JGeometry2DToolkit.hh.
233 {
235
237
238 if (__p == __begin || __p == __end) {
239 return make_pair(__p, __p);
240 }
241
242
243
244 reverse(__begin, __p);
245
247
248 ++__q;
249
250
251
252 reverse(__p, __q);
253 reverse(__begin, __q);
254
256
257 __p = __begin;
258
260
261 return make_pair(__p, __q);
262 }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
static const JUpperHull sortUpperHull
Function object for sorting elements.
static const JLowerHull sortLowerHull
Function object for sorting elements.
static const JConvexHull2D getConvexHull2D
Function object for convex hull determination.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
◆ sortLowerHull
const JLowerHull JGEOMETRY2D::JConvexHull2D::sortLowerHull |
|
static |
◆ sortUpperHull
const JUpperHull JGEOMETRY2D::JConvexHull2D::sortUpperHull |
|
static |
The documentation for this class was generated from the following file: