Data structure for direction in two dimensions.
More...
#include <JDirection2D.hh>
Data structure for direction in two dimensions.
Definition at line 31 of file JDirection2D.hh.
◆ JDirection2D() [1/5]
JGEOMETRY2D::JDirection2D::JDirection2D |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 43 of file JDirection2D.hh.
43 :
45 {}
JVersor2D()
Default constructor.
◆ JDirection2D() [2/5]
JGEOMETRY2D::JDirection2D::JDirection2D |
( |
const JVersor2D & | dir | ) |
|
|
inline |
◆ JDirection2D() [3/5]
JGEOMETRY2D::JDirection2D::JDirection2D |
( |
const JAngle2D & | angle | ) |
|
|
inline |
◆ JDirection2D() [4/5]
JGEOMETRY2D::JDirection2D::JDirection2D |
( |
const JVector2D & | pos | ) |
|
|
inline |
◆ JDirection2D() [5/5]
JGEOMETRY2D::JDirection2D::JDirection2D |
( |
const double | dx, |
|
|
const double | dy ) |
|
inline |
◆ getDirection() [1/2]
const JDirection2D & JGEOMETRY2D::JDirection2D::getDirection |
( |
| ) |
const |
|
inline |
Get direction.
- Returns
- direction
Definition at line 95 of file JDirection2D.hh.
96 {
98 }
JDirection2D()
Default constructor.
◆ getDirection() [2/2]
◆ setDirection()
void JGEOMETRY2D::JDirection2D::setDirection |
( |
const JDirection2D & | dir | ) |
|
|
inline |
◆ operator JAngle2D()
JGEOMETRY2D::JDirection2D::operator JAngle2D |
( |
| ) |
const |
|
inline |
Type conversion operator.
- Returns
- angle
Definition at line 128 of file JDirection2D.hh.
129 {
131 }
double getDX() const
Get x direction.
double getDY() const
Get y direction.
◆ operator JVector2D()
JGEOMETRY2D::JDirection2D::operator JVector2D |
( |
| ) |
const |
|
inline |
◆ transform()
Transform.
- Parameters
-
- Returns
- this direction
Definition at line 151 of file JDirection2D.hh.
152 {
154
156
157 return *this;
158 }
JVersor2D & normalise()
Normalise versor.
◆ rotate()
Rotate.
- Parameters
-
- Returns
- this direction
Definition at line 167 of file JDirection2D.hh.
168 {
170
172
173 return *this;
174 }
◆ rotate_back()
Rotate back.
- Parameters
-
- Returns
- this direction
Definition at line 183 of file JDirection2D.hh.
184 {
186
188
189 return *this;
190 }
◆ getDot() [1/3]
double JGEOMETRY2D::JDirection2D::getDot |
( |
const JAngle2D & | angle | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 199 of file JDirection2D.hh.
200 {
201 return
202 getDX() * angle.getDX() +
203 getDY() * angle.getDY();
204 }
◆ getDot() [2/3]
double JGEOMETRY2D::JDirection2D::getDot |
( |
const JVector2D & | pos | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 213 of file JDirection2D.hh.
214 {
215 return
216 getDX() * pos.getX() +
217 getDY() * pos.getY();
218 }
◆ getPerpDot() [1/3]
double JGEOMETRY2D::JDirection2D::getPerpDot |
( |
const JAngle2D & | angle | ) |
const |
|
inline |
Get perpendicular dot product.
- Parameters
-
- Returns
- perpendicular dot product
Definition at line 227 of file JDirection2D.hh.
228 {
229 return
230 getDX() * angle.getDY() -
231 getDY() * angle.getDX();
232 }
◆ getPerpDot() [2/3]
double JGEOMETRY2D::JDirection2D::getPerpDot |
( |
const JVector2D & | pos | ) |
const |
|
inline |
Get perpendicular dot product.
- Parameters
-
- Returns
- perpendicular dot product
Definition at line 241 of file JDirection2D.hh.
242 {
243 return
244 getDX() * pos.getY() -
245 getDY() * pos.getX();
246 }
◆ getDot() [3/3]
double JGEOMETRY2D::JVersor2D::getDot |
( |
const JVersor2D & | versor | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 116 of file JVersor2D.hh.
117 {
118 return
119 getDX() * versor.getDX() +
120 getDY() * versor.getDY();
121 }
◆ getPerpDot() [3/3]
double JGEOMETRY2D::JVersor2D::getPerpDot |
( |
const JVersor2D & | versor | ) |
const |
|
inline |
Get perpendicular dot product.
- Parameters
-
- Returns
- perpendicular dot product
Definition at line 130 of file JVersor2D.hh.
131 {
132 return
133 getDX() * versor.getDY() -
134 getDY() * versor.getDX();
135 }
◆ getDX()
double JGEOMETRY2D::JVersor2D::getDX |
( |
| ) |
const |
|
inlineinherited |
Get x direction.
- Returns
- x direction
Definition at line 53 of file JVersor2D.hh.
◆ getDY()
double JGEOMETRY2D::JVersor2D::getDY |
( |
| ) |
const |
|
inlineinherited |
Get y direction.
- Returns
- y direction
Definition at line 64 of file JVersor2D.hh.
◆ getPhi()
double JGEOMETRY2D::JVersor2D::getPhi |
( |
| ) |
const |
|
inlineinherited |
Get phi angle.
- Returns
- phi angle [rad]
Definition at line 75 of file JVersor2D.hh.
◆ negate()
JVersor2D & JGEOMETRY2D::JVersor2D::negate |
( |
| ) |
|
|
inlineinherited |
Negate versor.
- Returns
- this versor
Definition at line 86 of file JVersor2D.hh.
87 {
90
91 return *this;
92 }
◆ equals()
bool JGEOMETRY2D::JVersor2D::equals |
( |
const JVersor2D & | 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 102 of file JVersor2D.hh.
104 {
105 return (fabs(
getDX() - versor.getDX()) <= precision &&
106 fabs(
getDY() - versor.getDY()) <= precision);
107 }
◆ normalise()
JVersor2D & JGEOMETRY2D::JVersor2D::normalise |
( |
| ) |
|
|
inlineinherited |
Normalise versor.
This operation may set the result to the unit y-vector.
- Returns
- this versor
Definition at line 144 of file JVersor2D.hh.
145 {
147
148 if (v != 0.0) {
151 } else {
154 }
155
156 return *this;
157 }
◆ operator>> [1/2]
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JDirection2D & | direction ) |
|
friend |
Read direction from input.
- Parameters
-
in | input stream |
direction | direction |
- Returns
- input stream
Definition at line 256 of file JDirection2D.hh.
257 {
258 in >> direction.__dx >> direction.__dy;
259
260 direction.normalise();
261
262 return in;
263 }
◆ operator<< [1/2]
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JDirection2D & | direction ) |
|
friend |
Write direction to output.
- Parameters
-
out | output stream |
direction | direction |
- Returns
- output stream
Definition at line 273 of file JDirection2D.hh.
274 {
276
277 out << format << direction.getDX() << ' '
278 << format << direction.getDY();
279
280 return out;
281 }
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 291 of file JDirection2D.hh.
292 {
293 in >> direction.__dx;
294 in >> direction.__dy;
295
296 return in;
297 }
◆ operator<< [2/2]
Write direction to output.
- Parameters
-
out | writer |
direction | direction |
- Returns
- writer
Definition at line 307 of file JDirection2D.hh.
308 {
309 out << direction.__dx;
310 out << direction.__dy;
311
312 return out;
313 }
◆ __dx
double JGEOMETRY2D::JVersor2D::__dx |
|
protectedinherited |
◆ __dy
double JGEOMETRY2D::JVersor2D::__dy |
|
protectedinherited |
The documentation for this class was generated from the following file: