Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Attributes | Static Protected Member Functions | List of all members
JGEOMETRY2D::JConvexHull2D Class Reference

Auxiliary class for convex hull determination in X-Y plane. More...

#include <JGeometry2DToolkit.hh>

Classes

struct  JLowerHull
 Auxiliary class for sorting elements. More...
 
struct  JUpperHull
 Auxiliary class for sorting elements. More...
 

Public Member Functions

 JConvexHull2D ()
 Default constructor. More...
 
template<class T >
std::pair< T, Toperator() (T __begin, T __end) const
 Get convex Hull. More...
 

Static Public Attributes

static const JLowerHull sortLowerHull
 Function object for sorting elements. More...
 
static const JUpperHull sortUpperHull
 Function object for sorting elements. More...
 

Static Protected Member Functions

template<class T , class JCompare_t >
static T getConvexHull2D (T __begin, T __end, JCompare_t compare)
 Partition half Hull. More...
 

Detailed Description

Auxiliary class for convex hull determination in X-Y plane.

Definition at line 119 of file JGeometry2DToolkit.hh.

Constructor & Destructor Documentation

JGEOMETRY2D::JConvexHull2D::JConvexHull2D ( )
inline

Default constructor.

Definition at line 216 of file JGeometry2DToolkit.hh.

217  {}

Member Function Documentation

template<class T , class JCompare_t >
static T JGEOMETRY2D::JConvexHull2D::getConvexHull2D ( T  __begin,
T  __end,
JCompare_t  compare 
)
inlinestaticprotected

Partition half Hull.

Parameters
__beginbegin of data
__endend of data
comparecomparator
Returns
end of data

Definition at line 130 of file JGeometry2DToolkit.hh.

133  {
134  using namespace std;
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 
152  l = j;
153  ++l;
154 
155  iter_swap(l,i);
156  }
157  }
158 
159  return l;
160 
161  } else {
162 
163  return __begin;
164  }
165  }
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
bool getCCW(const T &a, const T &b, const T &c)
Check sequence of three points in X-Y plane.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
int j
Definition: JPolint.hh:792
template<class T >
std::pair<T,T> JGEOMETRY2D::JConvexHull2D::operator() ( T  __begin,
T  __end 
) const
inline

Get convex Hull.

Parameters
__beginbegin of data
__endend of data
Returns
end of lower and upper Hull data

Definition at line 232 of file JGeometry2DToolkit.hh.

233  {
234  using namespace std;
235 
236  T __p = getConvexHull2D(__begin, __end, sortLowerHull); // make lower hull
237 
238  if (__p == __begin || __p == __end) {
239  return make_pair(__p, __p);
240  }
241 
242  // add first point of lower hull to upper hull
243 
244  reverse(__begin, __p);
245 
246  T __q = getConvexHull2D(--__p, __end, sortUpperHull); // make upper hull
247 
248  ++__q;
249 
250  // re-store order and keep the extra point
251 
252  reverse(__p, __q);
253  reverse(__begin, __q);
254 
255  const int n = distance(__p, __q);
256 
257  __p = __begin;
258 
259  advance(__p, n);
260 
261  return make_pair(__p, __q);
262  }
static T getConvexHull2D(T __begin, T __end, JCompare_t compare)
Partition half Hull.
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 JLowerHull sortLowerHull
Function object for sorting elements.
const int n
Definition: JPolint.hh:786
static const JUpperHull sortUpperHull
Function object for sorting elements.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.

Member Data Documentation

const JLowerHull JGEOMETRY2D::JConvexHull2D::sortLowerHull
static

Function object for sorting elements.

Definition at line 220 of file JGeometry2DToolkit.hh.

const JUpperHull JGEOMETRY2D::JConvexHull2D::sortUpperHull
static

Function object for sorting elements.

Definition at line 221 of file JGeometry2DToolkit.hh.


The documentation for this class was generated from the following file: