Data structure for direction in three dimensions.
More...
#include <JDirection3D.hh>
Data structure for direction in three dimensions.
Definition at line 33 of file JDirection3D.hh.
◆ JDirection3D() [1/6]
JGEOMETRY3D::JDirection3D::JDirection3D |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 43 of file JDirection3D.hh.
43 :
45 {}
JVersor3D()
Default constructor.
◆ JDirection3D() [2/6]
JGEOMETRY3D::JDirection3D::JDirection3D |
( |
const JVersor3D & | dir | ) |
|
|
inline |
◆ JDirection3D() [3/6]
JGEOMETRY3D::JDirection3D::JDirection3D |
( |
const JAngle3D & | angle | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 63 of file JDirection3D.hh.
63 :
64 JVersor3D(angle.getDX(), angle.getDY(), angle.getDZ())
65 {}
◆ JDirection3D() [4/6]
JGEOMETRY3D::JDirection3D::JDirection3D |
( |
const JVector3D & | pos | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 73 of file JDirection3D.hh.
73 :
74 JVersor3D(pos.getX(), pos.getY(), pos.getZ())
75 {}
◆ JDirection3D() [5/6]
JGEOMETRY3D::JDirection3D::JDirection3D |
( |
const JVersor3Z & | dir | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 83 of file JDirection3D.hh.
83 :
84 JVersor3D(dir.getDX(), dir.getDY(), dir.getDZ())
85 {}
◆ JDirection3D() [6/6]
JGEOMETRY3D::JDirection3D::JDirection3D |
( |
const double | dx, |
|
|
const double | dy, |
|
|
const double | dz ) |
|
inline |
Constructor.
- Parameters
-
dx | dx value |
dy | dy value |
dz | dz value |
Definition at line 95 of file JDirection3D.hh.
◆ getDirection() [1/2]
const JDirection3D & JGEOMETRY3D::JDirection3D::getDirection |
( |
| ) |
const |
|
inline |
Get direction.
- Returns
- direction
Definition at line 107 of file JDirection3D.hh.
108 {
110 }
JDirection3D()
Default constructor.
◆ getDirection() [2/2]
◆ setDirection()
void JGEOMETRY3D::JDirection3D::setDirection |
( |
const JDirection3D & | dir | ) |
|
|
inline |
◆ operator JAngle3D()
JGEOMETRY3D::JDirection3D::operator JAngle3D |
( |
| ) |
const |
|
inline |
Type conversion operator.
- Returns
- angle
Definition at line 140 of file JDirection3D.hh.
141 {
143 }
double getDY() const
Get y direction.
double getDX() const
Get x direction.
double getDZ() const
Get z direction.
◆ operator JVector3D()
JGEOMETRY3D::JDirection3D::operator JVector3D |
( |
| ) |
const |
|
inline |
◆ transform()
Transform.
- Parameters
-
- Returns
- this direction
Definition at line 163 of file JDirection3D.hh.
164 {
166
168
169 return *this;
170 }
JVersor3D & normalise()
Normalise versor.
◆ rotate() [1/5]
Rotate.
- Parameters
-
- Returns
- this direction
Definition at line 179 of file JDirection3D.hh.
180 {
182
184
185 return *this;
186 }
◆ rotate_back() [1/5]
Rotate back.
- Parameters
-
- Returns
- this direction
Definition at line 195 of file JDirection3D.hh.
196 {
198
200
201 return *this;
202 }
◆ rotate() [2/5]
Rotate around X-axis.
- Parameters
-
- Returns
- this direction
Definition at line 211 of file JDirection3D.hh.
212 {
214
216
217 return *this;
218 }
◆ rotate_back() [2/5]
Rotate back around X-axis.
- Parameters
-
- Returns
- this direction
Definition at line 227 of file JDirection3D.hh.
228 {
230
232
233 return *this;
234 }
◆ rotate() [3/5]
Rotate around Y-axis.
- Parameters
-
- Returns
- this direction
Definition at line 243 of file JDirection3D.hh.
244 {
246
248
249 return *this;
250 }
◆ rotate_back() [3/5]
Rotate back around Y-axis.
- Parameters
-
- Returns
- this direction
Definition at line 259 of file JDirection3D.hh.
260 {
262
264
265 return *this;
266 }
◆ rotate() [4/5]
Rotate around Z-axis.
- Parameters
-
- Returns
- this direction
Definition at line 275 of file JDirection3D.hh.
276 {
278
280
281 return *this;
282 }
◆ rotate_back() [4/5]
Rotate back around Z-axis.
- Parameters
-
- Returns
- this direction
Definition at line 291 of file JDirection3D.hh.
292 {
294
296
297 return *this;
298 }
◆ rotate() [5/5]
Rotate.
- Parameters
-
- Returns
- this position
Definition at line 307 of file JDirection3D.hh.
308 {
310
311 return *this;
312 }
◆ rotate_back() [5/5]
Rotate back.
- Parameters
-
- Returns
- this position
Definition at line 321 of file JDirection3D.hh.
322 {
324
325 return *this;
326 }
◆ getDot() [1/4]
double JGEOMETRY3D::JDirection3D::getDot |
( |
const JAngle3D & | angle | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 335 of file JDirection3D.hh.
336 {
337 return
338 getDX() * angle.getDX() +
339 getDY() * angle.getDY() +
340 getDZ() * angle.getDZ();
341 }
◆ getDot() [2/4]
double JGEOMETRY3D::JDirection3D::getDot |
( |
const JVector3D & | pos | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 350 of file JDirection3D.hh.
351 {
352 return
353 getDX() * pos.getX() +
354 getDY() * pos.getY() +
355 getDZ() * pos.getZ();
356 }
◆ getDot() [3/4]
double JGEOMETRY3D::JDirection3D::getDot |
( |
const JVersor3Z & | dir | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 365 of file JDirection3D.hh.
366 {
367 return
368 getDX() * dir.getDX() +
369 getDY() * dir.getDY() +
370 getDZ() * dir.getDZ();
371 }
◆ getDot() [4/4]
double JGEOMETRY3D::JVersor3D::getDot |
( |
const JVersor3D & | versor | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 156 of file JVersor3D.hh.
157 {
158 return
159 getDX() * versor.getDX() +
160 getDY() * versor.getDY() +
161 getDZ() * versor.getDZ();
162 }
◆ negate()
JVersor3D & JGEOMETRY3D::JVersor3D::negate |
( |
| ) |
|
|
inlineinherited |
Negate versor.
- Returns
- this versor
Definition at line 64 of file JVersor3D.hh.
65 {
69
70 return *this;
71 }
◆ equals()
bool JGEOMETRY3D::JVersor3D::equals |
( |
const JVersor3D & | versor, |
|
|
const double | precision = std::numeric_limits<double>::min() ) const |
|
inlineinherited |
Check equality.
- Parameters
-
versor | versor |
precision | precision |
- Returns
- true if versors are equal; else false
Definition at line 81 of file JVersor3D.hh.
83 {
84 return (fabs(
getDX() - versor.getDX()) <= precision &&
85 fabs(
getDY() - versor.getDY()) <= precision &&
86 fabs(
getDZ() - versor.getDZ()) <= precision);
87 }
◆ getDX()
double JGEOMETRY3D::JVersor3D::getDX |
( |
| ) |
const |
|
inlineinherited |
Get x direction.
- Returns
- x direction
Definition at line 95 of file JVersor3D.hh.
◆ getDY()
double JGEOMETRY3D::JVersor3D::getDY |
( |
| ) |
const |
|
inlineinherited |
Get y direction.
- Returns
- y direction
Definition at line 106 of file JVersor3D.hh.
◆ getDZ()
double JGEOMETRY3D::JVersor3D::getDZ |
( |
| ) |
const |
|
inlineinherited |
Get z direction.
- Returns
- z direction
Definition at line 117 of file JVersor3D.hh.
◆ getTheta()
double JGEOMETRY3D::JVersor3D::getTheta |
( |
| ) |
const |
|
inlineinherited |
Get theta angle.
- Returns
- theta angle [rad]
Definition at line 128 of file JVersor3D.hh.
129 {
131 return 0.0;
132 else if (
__dz < -1.0)
134 else
136 }
static const double PI
Mathematical constants.
◆ getPhi()
double JGEOMETRY3D::JVersor3D::getPhi |
( |
| ) |
const |
|
inlineinherited |
Get phi angle.
- Returns
- phi angle [rad]
Definition at line 144 of file JVersor3D.hh.
◆ getCross()
Get cross product.
Note that this versor should not overlap with the first or second versor,
- Parameters
-
first | first versor |
second | second versor |
- Returns
- this versor
Definition at line 173 of file JVersor3D.hh.
175 {
176 __dx = first .getDY() * second.getDZ() - second.getDY() * first .getDZ();
177 __dy = second.getDX() * first .getDZ() - first .getDX() * second.getDZ();
178 __dz = first .getDX() * second.getDY() - second.getDX() * first .getDY();
179
181
182 return *this;
183 }
◆ normalise()
JVersor3D & JGEOMETRY3D::JVersor3D::normalise |
( |
| ) |
|
|
inlineinherited |
Normalise versor.
This operation may set the result to the unit z-vector.
- Returns
- this versor
Definition at line 192 of file JVersor3D.hh.
193 {
195
196 if (v != 0.0) {
200 }
201
202 return *this;
203 }
◆ mul()
template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul |
( |
const JSecond_t & | object | ) |
|
|
inlineinherited |
Multiply with object.
- Parameters
-
- Returns
- result object
Definition at line 354 of file JMath.hh.
355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }
◆ operator>> [1/2]
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JDirection3D & | direction ) |
|
friend |
Read direction from input.
- Parameters
-
in | input stream |
direction | direction |
- Returns
- input stream
Definition at line 381 of file JDirection3D.hh.
382 {
383 in >> direction.__dx >> direction.__dy >> direction.__dz;
384
385 direction.normalise();
386
387 return in;
388 }
◆ operator<< [1/2]
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JDirection3D & | direction ) |
|
friend |
Write direction to output.
- Parameters
-
out | output stream |
direction | direction |
- Returns
- output stream
Definition at line 398 of file JDirection3D.hh.
399 {
401
402 out << format << direction.getDX() << ' '
403 << format << direction.getDY() << ' '
404 << format << direction.getDZ();
405
406 return out;
407 }
JFormat_t & getFormat()
Get format for given type.
◆ operator>> [2/2]
Read direction from input.
- Parameters
-
in | reader |
direction | direction |
- Returns
- reader
Definition at line 417 of file JDirection3D.hh.
418 {
419 return in >> direction.__dx >> direction.__dy >> direction.__dz;
420 }
◆ operator<< [2/2]
Write direction to output.
- Parameters
-
out | writer |
direction | direction |
- Returns
- writer
Definition at line 430 of file JDirection3D.hh.
431 {
432 return out << direction.__dx << direction.__dy << direction.__dz;
433 }
◆ __dx
double JGEOMETRY3D::JVersor3D::__dx |
|
protectedinherited |
◆ __dy
double JGEOMETRY3D::JVersor3D::__dy |
|
protectedinherited |
◆ __dz
double JGEOMETRY3D::JVersor3D::__dz |
|
protectedinherited |
The documentation for this class was generated from the following file: