Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
JGEOMETRY3D::JOmega3D Class Reference

Direction set covering (part of) solid angle. More...

#include <JOmega3D.hh>

Inheritance diagram for JGEOMETRY3D::JOmega3D:
JGEOMETRY3D::JOmega3D_t std::vector< JAngle3D >

Public Member Functions

 JOmega3D ()
 Default constructor. More...
 
 JOmega3D (const JAngle3D &dir)
 Constructor. More...
 
 JOmega3D (const double grid)
 Constructor. More...
 
 JOmega3D (const JAngle3D &dir, const JAngleRange &theta, const double grid)
 Constructor. More...
 
void configure (const JAngle3D &dir, const JAngleRange &theta, const double grid)
 Configure direction set. More...
 
int find (const JAngle3D &dir) const
 Get index of direction closest to given direction. More...
 

Detailed Description

Direction set covering (part of) solid angle.

Definition at line 62 of file JOmega3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JOmega3D::JOmega3D ( )
inline

Default constructor.

Definition at line 69 of file JOmega3D.hh.

69  :
70  JOmega3D_t()
71  {}
Base class for direction set.
Definition: JOmega3D.hh:30
JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D dir)
inline

Constructor.

Parameters
dirdirection

Definition at line 79 of file JOmega3D.hh.

79  :
80  JOmega3D_t()
81  {
82  push_back(dir);
83  }
Base class for direction set.
Definition: JOmega3D.hh:30
JGEOMETRY3D::JOmega3D::JOmega3D ( const double  grid)
inline

Constructor.

Parameters
gridangular step size [rad]

Definition at line 91 of file JOmega3D.hh.

91  :
92  JOmega3D_t()
93  {
94  configure(JAngle3D(0.0,0.0), JAngleRange(0.0,PI), grid);
95  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:30
void configure(const JAngle3D &dir, const JAngleRange &theta, const double grid)
Configure direction set.
Definition: JOmega3D.hh:122
JRange< double > JAngleRange
Type definition for angle range.
Definition: JAngleRange.hh:19
static const double PI
Constants.
Definition: JConstants.hh:20
Base class for direction set.
Definition: JOmega3D.hh:30
JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D dir,
const JAngleRange &  theta,
const double  grid 
)
inline

Constructor.

Parameters
dirprincipal direction
thetapolar angle range [rad]
gridangular step size [rad]

Definition at line 106 of file JOmega3D.hh.

108  :
109  JOmega3D_t()
110  {
111  configure(dir, theta, grid);
112  }
void configure(const JAngle3D &dir, const JAngleRange &theta, const double grid)
Configure direction set.
Definition: JOmega3D.hh:122
Base class for direction set.
Definition: JOmega3D.hh:30

Member Function Documentation

void JGEOMETRY3D::JOmega3D::configure ( const JAngle3D dir,
const JAngleRange &  theta,
const double  grid 
)
inline

Configure direction set.

Parameters
dirprincipal direction
thetapolar angle range [rad]
gridangular step size [rad]

Definition at line 122 of file JOmega3D.hh.

125  {
126  clear();
127 
128  // sanity checks
129 
130  double thetaMin = theta.getLowerLimit();
131  double thetaMax = theta.getUpperLimit();
132 
133  if (thetaMin < 0.0) { thetaMin = 0.0; }
134  if (thetaMin > PI) { thetaMin = PI; }
135  if (thetaMax < 0.0) { thetaMax = 0.0; }
136  if (thetaMax > PI) { thetaMax = PI; }
137 
138  if (thetaMax > thetaMin) {
139 
140  const JRotation3D R(dir);
141 
142  const double rad = thetaMax - thetaMin;
143  const double bin = rad / floor(rad/(1.4*grid) + 0.5); // polar angle step size
144  const double unit = 2.0 * sqrt(1.0 - cos(grid)); // azimuth angle unit step size
145 
146  for (double theta = thetaMin; theta < thetaMax + 0.5*bin; theta += bin) {
147 
148  double step;
149 
150  if (theta > 0.5*bin && PI - theta > 0.5*bin)
151  step = PI / floor(PI*sin(theta)/unit + 0.5); // polar angle dependent step size
152  else
153  step = 2.0*PI; // pole
154 
155  for (double phi = 0.0; phi < 2.0*PI - 0.5*step; phi += step) {
156  push_back(JDirection3D(JAngle3D(theta,phi)).rotate_back(R));
157  }
158  }
159  }
160  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:30
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
Rotation matrix.
Definition: JRotation3D.hh:108
static const double PI
Constants.
Definition: JConstants.hh:20
int JGEOMETRY3D::JOmega3D_t::find ( const JAngle3D dir) const
inlineinherited

Get index of direction closest to given direction.

Parameters
dirdirection
Returns
index (-1 if error)

Definition at line 39 of file JOmega3D.hh.

40  {
41  double dot = -1.0;
42  int index = -1;
43 
44  for (const_iterator i = this->begin(); i != this->end(); ++i) {
45 
46  const double x = dir.getDot(*i);
47 
48  if (x > dot) {
49  dot = x;
50  index = std::distance(this->begin(), i);
51  }
52  }
53 
54  return index;
55  }
double getDot(const JAngle3D &angle) const
Get dot product.
Definition: JAngle3D.hh:225

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