Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
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 Types

typedef std::pair< double, double > range_type
 

Public Member Functions

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

Detailed Description

Direction set covering (part of) solid angle.


The set consists of approximately equally spaced directions.
In this, the spacing in azimuth angle is zenith angle dependent.

Definition at line 66 of file JOmega3D.hh.

Member Typedef Documentation

◆ range_type

Definition at line 32 of file JOmega3D.hh.

Constructor & Destructor Documentation

◆ JOmega3D() [1/4]

JGEOMETRY3D::JOmega3D::JOmega3D ( )
inline

Default constructor.

Definition at line 73 of file JOmega3D.hh.

73 :
74 JOmega3D_t()
75 {}

◆ JOmega3D() [2/4]

JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D & dir)
inline

Constructor.

Parameters
dirdirection

Definition at line 83 of file JOmega3D.hh.

83 :
84 JOmega3D_t()
85 {
86 push_back(dir);
87 }

◆ JOmega3D() [3/4]

JGEOMETRY3D::JOmega3D::JOmega3D ( const double grid)
inline

Constructor.

Parameters
gridangular spacing [rad]

Definition at line 95 of file JOmega3D.hh.

95 :
96 JOmega3D_t()
97 {
98 configure(JAngle3D(0.0,0.0), range_type(0.0,PI), grid);
99 }
void configure(const JAngle3D &dir, const range_type &theta, const double grid)
Configure direction set.
Definition JOmega3D.hh:126
std::pair< double, double > range_type
Definition JOmega3D.hh:32

◆ JOmega3D() [4/4]

JGEOMETRY3D::JOmega3D::JOmega3D ( const JAngle3D & dir,
const range_type & theta,
const double grid )
inline

Constructor.

Parameters
dirprincipal direction
thetapolar angle range [rad]
gridangular spacing [rad]

Definition at line 110 of file JOmega3D.hh.

112 :
113 JOmega3D_t()
114 {
115 configure(dir, theta, grid);
116 }

Member Function Documentation

◆ configure()

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

Configure direction set.

Parameters
dirprincipal direction
thetapolar angle range [rad]
gridangular spacing [rad]

Definition at line 126 of file JOmega3D.hh.

129 {
130 clear();
131
132 // sanity checks
133
134 double thetaMin = theta.first;
135 double thetaMax = theta.second;
136
137 if (thetaMin < 0.0) { thetaMin = 0.0; }
138 if (thetaMin > PI) { thetaMin = PI; }
139 if (thetaMax < 0.0) { thetaMax = 0.0; }
140 if (thetaMax > PI) { thetaMax = PI; }
141
142 if (thetaMax > thetaMin) {
143
144 const JRotation3D R(dir);
145
146 const double rad = thetaMax - thetaMin;
147 const double bin = rad / floor(rad/(1.4*grid) + 0.5); // polar angle step size
148 const double unit = 2.0 * sqrt(1.0 - cos(grid)); // azimuth angle unit step size
149
150 for (double theta = thetaMin; theta < thetaMax + 0.5*bin; theta += bin) {
151
152 double step;
153
154 if (theta > 0.5*bin && PI - theta > 0.5*bin)
155 step = PI / floor(PI*sin(theta)/unit + 0.5); // polar angle dependent step size
156 else
157 step = 2.0*PI; // pole
158
159 for (double phi = 0.0; phi < 2.0*PI - 0.5*step; phi += step) {
160 push_back(JDirection3D(JAngle3D(theta,phi)).rotate_back(R));
161 }
162 }
163 }
164 }

◆ find()

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 41 of file JOmega3D.hh.

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

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