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 | Typedefs | Functions | Variables
JGEOMETRY2D Namespace Reference

Auxiliary classes and methods for 2D geometrical objects and operations. More...

Classes

class  JAngle2D
 Data structure for angle in two dimensions. More...
 
class  JAxis2D
 Axis object. More...
 
class  JCircle2D
 Data structure for circle in two dimensions. More...
 
class  JDirection2D
 Data structure for direction in two dimensions. More...
 
struct  JEigenValues2D
 Eigen values in 2D. More...
 
class  JCenter2D
 Center. More...
 
class  JConvexHull2D
 Auxiliary class for convex hull determination in X-Y plane. More...
 
class  JSmallestDistance2D
 Auxiliary class for determination of smallest distance between pair of 2D points. More...
 
struct  JOmega2D_t
 Base class for direction set. More...
 
class  JOmega2D
 Direction set covering (part of) circle. More...
 
class  JPosition2D
 Data structure for position in two dimensions. More...
 
class  JRotation2D
 Rotation matrix. More...
 
class  JRotator2D
 Rotation set. More...
 
class  JSegment2D
 Line segment in two dimensions. More...
 
class  JVector2D
 Data structure for vector in two dimensions. More...
 
class  JVersor2D
 Data structure for normalised vector in two dimensions. More...
 

Typedefs

typedef std::vector< JRotation2DJRotator2D_t
 Type definition of rotation set. More...
 
typedef std::pair< JPosition2D,
JPosition2D
JSegment2D_t
 Type definition of line segment in two dimensions. More...
 
typedef std::pair< double, double > JRangeX
 Type definition of range along x-axis. More...
 
typedef std::pair< double, double > JRangeY
 Type definition of range along y-axis. More...
 

Functions

void randomize (JPosition2D *p)
 Randomize position. More...
 
template<class T >
bool getCCW (const T &a, const T &b, const T &c)
 Check sequence of three points in X-Y plane. More...
 
template<class T >
double getArea2D (T __begin, T __end)
 Get area of a convex polygon. More...
 
template<class T >
bool inside2D (T __begin, T __end, const JVector2D &pos)
 Check if given point is inside a convex polygon. More...
 
template<class T >
bool inside2D (T __begin, T __end1, T __end2, const JVector2D &pos)
 Check if given point is inside a convex polygon. More...
 
bool getCCW (const JVector2D &a, const JVector2D &b, const JVector2D &c)
 Check sequence of three points. More...
 

Variables

static const JConvexHull2D getConvexHull2D
 Function object for convex hull determination. More...
 
static const JSmallestDistance2D getSmallestDistance2D
 Function object for smallest distance determination. More...
 
static const JVersor2D JVersor2X_t (1, 0)
 unit x-vector More...
 
static const JVersor2D JVersor2Y_t (0, 1)
 unit y-vector More...
 

Detailed Description

Auxiliary classes and methods for 2D geometrical objects and operations.

Author
mdejong

Typedef Documentation

Type definition of rotation set.

Definition at line 23 of file JRotator2D.hh.

Type definition of line segment in two dimensions.

Definition at line 29 of file JSegment2D.hh.

typedef std::pair<double, double> JGEOMETRY2D::JRangeX

Type definition of range along x-axis.

Definition at line 23 of file JVector2D.hh.

typedef std::pair<double, double> JGEOMETRY2D::JRangeY

Type definition of range along y-axis.

Definition at line 24 of file JVector2D.hh.

Function Documentation

void JGEOMETRY2D::randomize ( JPosition2D p)
inline

Randomize position.

Parameters
ppointer to valid object

Definition at line 28 of file JGeometry2DTestkit.hh.

29  {
30  new (p) JPosition2D(getRandom<double>(-1.0, +1.0),
31  getRandom<double>(-1.0, +1.0));
32  };
Data structure for position in two dimensions.
Definition: JPosition2D.hh:31
template<class T >
bool JGEOMETRY2D::getCCW ( const T a,
const T b,
const T c 
)
inline

Check sequence of three points in X-Y plane.

Parameters
a1st point
b2nd point
c3rd point
Returns
true if points a, b, c are counter clockwise; else false

Definition at line 36 of file JGeometry2DToolkit.hh.

39  {
40  const double A = a.getX() - b.getX();
41  const double B = a.getY() - b.getY();
42  const double C = c.getX() - b.getX();
43  const double D = c.getY() - b.getY();
44 
45  return A*D <= B*C;
46  }
static const double C
Physics constants.
then JCalibrateToT a
Definition: JTuneHV.sh:107
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
template<class T >
double JGEOMETRY2D::getArea2D ( T  __begin,
T  __end 
)
inline

Get area of a convex polygon.

Parameters
__beginbegin of data
__endend of data
Returns
area

Definition at line 280 of file JGeometry2DToolkit.hh.

281  {
282  using namespace std;
283 
284  if (distance(__begin,__end) >= 3) {
285 
286  double A = 0.0;
287 
288  T i, j, k;
289 
290  i = j = k = __begin;
291 
292  for (++j, ++(++k); k != __end; ++i, ++j, ++k) {
293  A += j->getX() * (k->getY() - i->getY());
294  }
295 
296  k = __begin;
297 
298  A += j->getX() * (k->getY() - i->getY());
299 
300  ++i;
301  j = k;
302  ++k;
303 
304  A += j->getX() * (k->getY() - i->getY());
305 
306  return 0.5 * fabs(A);
307 
308  } else {
309 
310  return 0.0;
311  }
312  }
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
int j
Definition: JPolint.hh:792
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
template<class T >
bool JGEOMETRY2D::inside2D ( T  __begin,
T  __end,
const JVector2D pos 
)
inline

Check if given point is inside a convex polygon.

Parameters
__beginbegin of data
__endend of data
posposition
Returns
true if inside; else false

Definition at line 324 of file JGeometry2DToolkit.hh.

325  {
326  using namespace std;
327 
328  if (distance(__begin,__end) >= 2) {
329 
330  T i = __begin, j = __begin;
331 
332  for (++j; j != __end; ++i, ++j) {
333 
334  if (!getCCW(*i, *j, pos)) {
335  return false;
336  }
337  }
338 
339  j = __begin;
340 
341  return getCCW(*i, *j, pos);
342 
343  } else {
344 
345  return false;
346  }
347  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
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 >
bool JGEOMETRY2D::inside2D ( T  __begin,
T  __end1,
T  __end2,
const JVector2D pos 
)
inline

Check if given point is inside a convex polygon.

Parameters
__beginbegin of data
__end1end of lower hull
__end2end of upper hull
posposition
Returns
true if inside; else false

Definition at line 360 of file JGeometry2DToolkit.hh.

361  {
362  using namespace std;
363 
364  if (distance(__begin,__end2) >= 3) {
365 
366  if (pos.getX() < __begin->getX()) {
367  return false;
368  }
369 
370  T i = lower_bound(__begin, __end1, pos, JConvexHull2D::sortUpperHull);
371 
372  if (i == __end1) {
373  return false;
374  }
375 
376  T j = i--;
377 
378  if (!getCCW(*i, *j, pos)) {
379  return false;
380  }
381 
382  i = lower_bound(__end1, __end2, pos, JConvexHull2D::sortLowerHull);
383  j = i--;
384 
385  if (j == __end2) {
386  j = __begin;
387  }
388 
389  return getCCW(*i, *j, pos);
390 
391  } else {
392 
393  return false;
394  }
395  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
bool getCCW(const T &a, const T &b, const T &c)
Check sequence of three points in X-Y plane.
double getX() const
Get x position.
Definition: JVector2D.hh:63
do set_variable OUTPUT_DIRECTORY $WORKDIR T
int j
Definition: JPolint.hh:792
bool JGEOMETRY2D::getCCW ( const JVector2D a,
const JVector2D b,
const JVector2D c 
)
inline

Check sequence of three points.

Parameters
a1st point
b2nd point
c3rd point
Returns
true if points a, b, c are counter clockwise; else false

Definition at line 270 of file JVector2D.hh.

273  {
274  const double A = a.getX() - b.getX();
275  const double B = a.getY() - b.getY();
276  const double C = c.getX() - b.getX();
277  const double D = c.getY() - b.getY();
278 
279  return A*D <= B*C;
280  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
static const double C
Physics constants.
double getX() const
Get x position.
Definition: JVector2D.hh:63
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
Definition: JDrawLED.sh:53

Variable Documentation

const JConvexHull2D JGEOMETRY2D::getConvexHull2D
static

Function object for convex hull determination.

Definition at line 269 of file JGeometry2DToolkit.hh.

const JSmallestDistance2D JGEOMETRY2D::getSmallestDistance2D
static

Function object for smallest distance determination.

Definition at line 660 of file JGeometry2DToolkit.hh.

const JVersor2D JGEOMETRY2D::JVersor2X_t(1, 0)
static

unit x-vector

const JVersor2D JGEOMETRY2D::JVersor2Y_t(0, 1)
static

unit y-vector