Jpp  18.2.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JGEOMETRY2D::JOmega2D_t Struct Reference

Base class for direction set. More...

#include <JOmega2D.hh>

Inheritance diagram for JGEOMETRY2D::JOmega2D_t:
std::vector< JAngle2D > JGEOMETRY2D::JOmega2D

Public Member Functions

int find (const JAngle2D &dir) const
 Get index of direction closest to given direction. More...
 

Detailed Description

Base class for direction set.

Definition at line 28 of file JOmega2D.hh.

Member Function Documentation

int JGEOMETRY2D::JOmega2D_t::find ( const JAngle2D dir) const
inline

Get index of direction closest to given direction.

Parameters
dirdirection
Returns
index (-1 if error)

Definition at line 37 of file JOmega2D.hh.

38  {
39  double dot = -1.0;
40  int index = -1;
41 
42  for (const_iterator i = this->begin(); i != this->end(); ++i) {
43 
44  const double x = dir.getDot(*i);
45 
46  if (x > dot) {
47  dot = x;
48  index = std::distance(this->begin(), i);
49  }
50  }
51 
52  return index;
53  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
double getDot(const JAngle2D &angle) const
Get dot product.
Definition: JAngle2D.hh:189

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