Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
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.
 

Detailed Description

Base class for direction set.

Definition at line 28 of file JOmega2D.hh.

Member Function Documentation

◆ find()

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 }

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