Belle II Software  release-05-02-19
Vector2D.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/numerics/Quadratic.h>
13 
14 #include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
15 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
16 #include <tracking/trackFindingCDC/numerics/ERotation.h>
17 #include <tracking/trackFindingCDC/numerics/ESign.h>
18 
19 #include <utility>
20 #include <string>
21 #include <iosfwd>
22 #include <cmath>
23 
24 class TVector2;
25 
26 namespace Belle2 {
31  namespace TrackFindingCDC {
37  class Vector2D {
38 
39  public:
42  : m_x(0.0)
43  , m_y(0.0)
44  {
45  }
46 
48  explicit Vector2D(const TVector2& tVector2);
49 
51  Vector2D(const double x, const double y)
52  : m_x(x)
53  , m_y(y)
54  {
55  }
56 
63  Vector2D(const Vector2D& coordinateVec, const double parallelCoor, const double orthoCoor)
64  : m_x(coordinateVec.x() * parallelCoor - coordinateVec.y() * orthoCoor)
65  , m_y(coordinateVec.y() * parallelCoor + coordinateVec.x() * orthoCoor)
66  {
67  }
68 
70  Vector2D& operator=(const TVector2& tvector);
71 
73  static Vector2D Phi(const double phi)
74  {
75  return std::isnan(phi) ? Vector2D(0.0, 0.0) : Vector2D(cos(phi), sin(phi));
76  }
77 
80 
84  static Vector2D
85  compose(const Vector2D& coordinateVec, const double parallelCoor, const double orthoCoor)
86  {
87  return Vector2D(coordinateVec, parallelCoor, orthoCoor);
88  }
89 
91 
95  static Vector2D average(const Vector2D& one, const Vector2D& two)
96  {
97  if (one.hasNAN()) {
98  return two;
99  } else if (two.hasNAN()) {
100  return one;
101  } else {
102  return Vector2D((one.x() + two.x()) / 2.0, (one.y() + two.y()) / 2.0);
103  }
104  }
105 
107 
112  static Vector2D average(const Vector2D& one, const Vector2D& two, const Vector2D& three)
113  {
114 
115  if (one.hasNAN()) {
116  return average(two, three);
117  } else if (two.hasNAN()) {
118  return average(one, three);
119  } else if (three.hasNAN()) {
120  return average(one, two);
121  } else {
122  return Vector2D((one.x() + two.x() + three.x()) / 3.0,
123  (one.y() + two.y() + three.y()) / 3.0);
124  }
125  }
126 
128  operator const TVector2();
129 
131  bool operator==(const Vector2D& rhs) const
132  {
133  return x() == rhs.x() and y() == rhs.y();
134  }
135 
137 
143  bool operator<(const Vector2D& rhs) const
144  {
145  return normSquared() < rhs.normSquared() or
146  (normSquared() == rhs.normSquared() and (phi() < rhs.phi()));
147  }
148 
150 
152  {
153  return Vector2D(0.0, 0.0);
154  }
155 
157  bool isNull() const
158  {
159  return x() == 0.0 and y() == 0.0;
160  }
161 
163  bool hasNAN() const
164  {
165  return std::isnan(x()) or std::isnan(y());
166  }
167 
169  std::string __str__() const;
170 
172  double dot(const Vector2D& rhs) const
173  {
174  return x() * rhs.x() + y() * rhs.y();
175  }
177  double cross(const Vector2D& rhs) const
178  {
179  return x() * rhs.y() - y() * rhs.x();
180  }
181 
183  double normSquared() const
184  {
185  return x() * x() + y() * y();
186  }
187 
189  double norm() const
190  {
191  return hypot2(x(), y());
192  }
193 
199  double cosWith(const Vector2D& rhs) const
202  {
203  return dot(rhs) / (norm() * rhs.norm());
204  }
206  double sinWith(const Vector2D& rhs) const
207  {
208  return cross(rhs) / (norm() * rhs.norm());
209  }
211  double angleWith(const Vector2D& rhs) const
212  {
213  return atan2(cross(rhs), dot(rhs));
214  }
216 
218  double distance(const Vector2D& rhs = Vector2D(0.0, 0.0)) const
219  {
220  double deltaX = x() - rhs.x();
221  double deltaY = y() - rhs.y();
222  return hypot2(deltaX, deltaY);
223  }
224 
226  Vector2D& scale(const double factor)
227  {
228  m_x *= factor;
229  m_y *= factor;
230  return *this;
231  }
233  Vector2D& operator*=(const double factor)
234  {
235  return scale(factor);
236  }
237 
239  Vector2D scaled(const double factor) const
240  {
241  return Vector2D(x() * factor, y() * factor);
242  }
243 
245  friend Vector2D operator*(const Vector2D& vec2D, const double factor)
246  {
247  return vec2D.scaled(factor);
248  }
249 
251  Vector2D& divide(const double denominator)
252  {
253  m_x /= denominator;
254  m_y /= denominator;
255  return *this;
256  }
257 
259  Vector2D& operator/=(const double denominator)
260  {
261  return divide(denominator);
262  }
263 
265  Vector2D divided(const double denominator) const
266  {
267  return Vector2D(x() / denominator, y() / denominator);
268  }
270  Vector2D operator/(const double denominator) const
271  {
272  return divided(denominator);
273  }
274 
276  Vector2D& add(const Vector2D& rhs)
277  {
278  m_x += rhs.x();
279  m_y += rhs.y();
280  return *this;
281  }
282 
285  {
286  return add(rhs);
287  }
288 
291  {
292  m_x -= rhs.x();
293  m_y -= rhs.y();
294  return *this;
295  }
298  {
299  return subtract(rhs);
300  }
301 
304  {
305  return Vector2D(-y(), x());
306  }
307 
309  Vector2D orthogonal(const ERotation ccwInfo) const
310  {
311  return isValid(ccwInfo) ? Vector2D(-ccwInfo * y(), ccwInfo * x()) : Vector2D();
312  }
313 
315 
317  double normalize()
318  {
319  double originalLength = norm();
320  if (originalLength != 0.0) divide(originalLength);
321  return originalLength;
322  }
323 
325 
327  double normalizeTo(const double toLength)
328  {
329  double originalLength = norm();
330  if (originalLength != 0.0) scale(toLength / originalLength);
331  return originalLength;
332  }
333 
335  Vector2D unit() const
336  {
337  return isNull() ? Vector2D(0.0, 0.0) : divided(norm());
338  }
339 
342  {
343  scale(-1.0);
344  return *this;
345  }
346 
349  {
350  return scaled(-1.0);
351  }
354  {
355  return reversed();
356  }
357 
359  void flipFirst()
360  {
361  m_x = -x();
362  }
363 
365  void flipSecond()
366  {
367  m_y = -y();
368  }
369 
373  {
374  return Vector2D(-x(), y());
375  }
376 
380  {
381  return Vector2D(x(), -y());
382  }
383 
385  Vector2D flippedOver(const Vector2D& reflectionLine) const
386  {
387  return *this - orthogonalVector(reflectionLine) * 2;
388  }
389 
391  Vector2D flippedAlong(const Vector2D& flippingDirection) const
392  {
393  return *this - parallelVector(flippingDirection) * 2;
394  }
395 
397 
400  {
401  divide(normSquared());
402  }
403 
405 
408  {
409  return divided(normSquared());
410  }
411 
413  Vector2D operator+(const Vector2D& rhs) const
414  {
415  return Vector2D(x() + rhs.x(), y() + rhs.y());
416  }
417 
419  Vector2D operator-(const Vector2D& rhs) const
420  {
421  return Vector2D(x() - rhs.x(), y() - rhs.y());
422  }
423 
425  double parallelComp(const Vector2D& relativTo) const
426  {
427  return relativTo.dot(*this) / relativTo.norm();
428  }
429 
431  Vector2D parallelVector(const Vector2D& relativTo) const
432  {
433  return relativTo.scaled(relativTo.dot(*this) / relativTo.normSquared());
434  }
435 
437 
439  double unnormalizedParallelComp(const Vector2D& relativTo) const
440  {
441  return relativTo.dot(*this);
442  }
443 
445 
446  double orthogonalComp(const Vector2D& relativTo) const
447  {
448  return relativTo.cross(*this) / relativTo.norm();
449  }
450 
452  Vector2D orthogonalVector(const Vector2D& relativTo) const
453  {
454  return relativTo.scaled(relativTo.cross(*this) / relativTo.normSquared()).orthogonal();
455  }
456 
458 
460  double unnormalizedOrthogonalComp(const Vector2D& relativTo) const
461  {
462  return relativTo.cross(*this);
463  }
464 
468  {
469  return static_cast<ERightLeft>(-sign(unnormalizedOrthogonalComp(rhs)));
470  }
471 
473  bool isLeftOf(const Vector2D& rhs) const
474  {
475  return isRightOrLeftOf(rhs) == ERightLeft::c_Left;
476  }
477 
479  bool isRightOf(const Vector2D& rhs) const
480  {
481  return isRightOrLeftOf(rhs) == ERightLeft::c_Right;
482  }
483 
486  ERotation isCCWOrCWOf(const Vector2D& rhs) const
487  {
488  return static_cast<ERotation>(sign(unnormalizedOrthogonalComp(rhs)));
489  }
490 
493  bool isCCWOf(const Vector2D& rhs) const
494  {
495  return isCCWOrCWOf(rhs) == ERotation::c_CounterClockwise;
496  }
497 
500  bool isCWOf(const Vector2D& rhs) const
501  {
502  return isCCWOrCWOf(rhs) == ERotation::c_Clockwise;
503  }
504 
508  {
509  return static_cast<EForwardBackward>(sign(unnormalizedParallelComp(rhs)));
510  }
511 
514  bool isForwardOf(const Vector2D& rhs) const
515  {
516  return isForwardOrBackwardOf(rhs) == EForwardBackward::c_Forward;
517  }
518 
521  bool isBackwardOf(const Vector2D& rhs) const
522  {
523  return isForwardOrBackwardOf(rhs) == EForwardBackward::c_Backward;
524  }
525 
526  private:
528  static bool sameSign(float n1, float n2, float n3)
529  {
530  return ((n1 > 0 and n2 > 0 and n3 > 0) or (n1 < 0 and n2 < 0 and n3 < 0));
531  }
532 
533  public:
539  bool isBetween(const Vector2D& lower, const Vector2D& upper) const
540  {
541  // Set up a linear (nonorthogonal) transformation that maps
542  // lower -> (1, 0)
543  // upper -> (0, 1)
544  // Check whether this transformation is orientation conserving
545  // If yes this vector must lie in the first quadrant to be between lower and upper
546  // If no it must lie in some other quadrant.
547  double det = lower.cross(upper);
548  if (det == 0) {
549  // lower and upper are coaligned
550  return isRightOf(lower) and isLeftOf(upper);
551  } else {
552  bool flipsOrientation = det < 0;
553 
554  double transformedX = cross(upper);
555  double transformedY = -cross(lower);
556  bool inFirstQuadrant = sameSign(det, transformedX, transformedY);
557  if (flipsOrientation) {
558  inFirstQuadrant = not inFirstQuadrant;
559  }
560  return inFirstQuadrant;
561  }
562  }
563 
566  {
567  std::swap(m_x, m_y);
568  }
569 
571  double cylindricalR() const
572  {
573  return hypot2(x(), y());
574  }
575 
577  void setCylindricalR(const double cylindricalR)
578  {
579  scale(cylindricalR / norm());
580  }
581 
583  double phi() const
584  {
585  return isNull() ? NAN : atan2(y(), x());
586  }
587 
589  void passiveMoveBy(const Vector2D& by)
590  {
591  subtract(by);
592  }
593 
596  {
597  return *this - by;
598  }
599 
603  Vector2D passiveRotatedBy(const Vector2D& phiVec) const
604  {
606  }
607 
609  double x() const
610  {
611  return m_x;
612  }
614  void setX(const double x)
615  {
616  m_x = x;
617  }
619  double y() const
620  {
621  return m_y;
622  }
624  void setY(const double y)
625  {
626  m_y = y;
627  }
628 
630  void setXY(const double x, const double y)
631  {
632  setX(x);
633  setY(y);
634  }
636  void setXY(const Vector2D& xy)
637  {
638  m_x = xy.x();
639  m_y = xy.y();
640  }
641 
643  double first() const
644  {
645  return m_x;
646  }
648  void setFirst(const double first)
649  {
650  m_x = first;
651  }
653  double second() const
654  {
655  return m_y;
656  }
658  void setSecond(const double second)
659  {
660  m_y = second;
661  }
662 
664  void set(const double first, const double second)
665  {
666  setX(first);
667  setY(second);
668  }
670  void set(const Vector2D& both)
671  {
672  m_x = both.x();
673  m_y = both.y();
674  }
675 
676  private:
678  double m_x;
679 
681  double m_y;
682  };
683 
685  std::ostream& operator<<(std::ostream& output, const Vector2D& vector2D);
686  }
688 }
Belle2::TrackFindingCDC::Vector2D::isRightOf
bool isRightOf(const Vector2D &rhs) const
Indicates if the given vector is more right if you looked in the direction of this vector.
Definition: Vector2D.h:479
Belle2::TrackFindingCDC::Vector2D::sinWith
double sinWith(const Vector2D &rhs) const
Sine of the angle between this and rhs.
Definition: Vector2D.h:206
Belle2::TrackFindingCDC::Vector2D::conformalTransform
void conformalTransform()
Transforms the vector to conformal space inplace.
Definition: Vector2D.h:399
Belle2::TrackFindingCDC::Vector2D::setSecond
void setSecond(const double second)
Setter for the second coordinate.
Definition: Vector2D.h:658
Belle2::TrackFindingCDC::Vector2D::flippedOver
Vector2D flippedOver(const Vector2D &reflectionLine) const
Reflects this vector over line designated by the given vector.
Definition: Vector2D.h:385
Belle2::TrackFindingCDC::Vector2D::isBackwardOf
bool isBackwardOf(const Vector2D &rhs) const
Indicates if the given vector is more Reverse if you looked in the direction of this vector.
Definition: Vector2D.h:521
Belle2::TrackFindingCDC::Vector2D::orthogonal
Vector2D orthogonal() const
Orthogonal vector to the counterclockwise direction.
Definition: Vector2D.h:303
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::Vector2D::Vector2D
Vector2D(const Vector2D &coordinateVec, const double parallelCoor, const double orthoCoor)
Constructs a vector from a unit coordinate system vector and the coordinates in that system.
Definition: Vector2D.h:63
Belle2::TrackFindingCDC::Vector2D::setY
void setY(const double y)
Setter for the y coordinate.
Definition: Vector2D.h:624
Belle2::TrackFindingCDC::Vector2D::unit
Vector2D unit() const
Returns a unit vector colaligned with this.
Definition: Vector2D.h:335
Belle2::TrackFindingCDC::Vector2D::normalizeTo
double normalizeTo(const double toLength)
Normalizes the vector to the given length.
Definition: Vector2D.h:327
Belle2::TrackFindingCDC::Vector2D::flippedFirst
Vector2D flippedFirst() const
Makes a copy of the vector with the first coordinate flipped (no difference between active and passiv...
Definition: Vector2D.h:372
Belle2::TrackFindingCDC::Vector2D::average
static Vector2D average(const Vector2D &one, const Vector2D &two, const Vector2D &three)
Constructs the average of three vectors.
Definition: Vector2D.h:112
Belle2::TrackFindingCDC::Vector2D::isRightOrLeftOf
ERightLeft isRightOrLeftOf(const Vector2D &rhs) const
Indicates if the given vector is more left or more right if you looked in the direction of this vecto...
Definition: Vector2D.h:467
Belle2::TrackFindingCDC::Vector2D::operator=
Vector2D & operator=(const TVector2 &tvector)
Assignment translating from a TVector2 instance.
Definition: Vector2D.cc:26
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::Vector2D::normalize
double normalize()
Normalizes the vector to unit length.
Definition: Vector2D.h:317
Belle2::TrackFindingCDC::Vector2D::set
void set(const Vector2D &both)
Setter for both coordinate by an other vector.
Definition: Vector2D.h:670
Belle2::TrackFindingCDC::Vector2D::getLowest
static Vector2D getLowest()
Getter for the lowest possible vector.
Definition: Vector2D.h:151
Belle2::TrackFindingCDC::Vector2D::setCylindricalR
void setCylindricalR(const double cylindricalR)
Set the cylindrical radius while keeping the azimuth angle phi the same.
Definition: Vector2D.h:577
Belle2::TrackFindingCDC::Vector2D::normSquared
double normSquared() const
Calculates .
Definition: Vector2D.h:183
Belle2::TrackFindingCDC::Vector2D::y
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:619
Belle2::TrackFindingCDC::Vector2D::isBetween
bool isBetween(const Vector2D &lower, const Vector2D &upper) const
Checks if this vector is between two other vectors Between means here that when rotating the lower ve...
Definition: Vector2D.h:539
Belle2::TrackFindingCDC::Vector2D::passiveMoveBy
void passiveMoveBy(const Vector2D &by)
Passivelly moves the vector inplace by the given vector.
Definition: Vector2D.h:589
Belle2::TrackFindingCDC::Vector2D::second
double second() const
Getter for the second coordinate.
Definition: Vector2D.h:653
Belle2::TrackFindingCDC::Vector2D::isNull
bool isNull() const
Checks if the vector is the null vector.
Definition: Vector2D.h:157
Belle2::TrackFindingCDC::Vector2D::operator*=
Vector2D & operator*=(const double factor)
Same as scale()
Definition: Vector2D.h:233
Belle2::TrackFindingCDC::Vector2D::parallelComp
double parallelComp(const Vector2D &relativTo) const
Calculates the component parallel to the given vector.
Definition: Vector2D.h:425
Belle2::TrackFindingCDC::Vector2D::scaled
Vector2D scaled(const double factor) const
Returns a scaled copy of the vector.
Definition: Vector2D.h:239
Belle2::TrackFindingCDC::Vector2D::__str__
std::string __str__() const
Output operator for python.
Definition: Vector2D.cc:44
Belle2::TrackFindingCDC::Vector2D::operator-
Vector2D operator-() const
Same as reversed()
Definition: Vector2D.h:353
Belle2::TrackFindingCDC::Vector2D::flipSecond
void flipSecond()
Flips the first coordinate inplace (no difference between active and passive)
Definition: Vector2D.h:365
Belle2::TrackFindingCDC::Vector2D::operator+
Vector2D operator+(const Vector2D &rhs) const
Returns a new vector as sum of this and rhs.
Definition: Vector2D.h:413
Belle2::TrackFindingCDC::NForwardBackward::EForwardBackward
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: EForwardBackward.h:35
Belle2::TrackFindingCDC::Vector2D::add
Vector2D & add(const Vector2D &rhs)
Adds a vector to this in place.
Definition: Vector2D.h:276
Belle2::TrackFindingCDC::Vector2D::distance
double distance(const Vector2D &rhs=Vector2D(0.0, 0.0)) const
Calculates the distance of this point to the rhs.
Definition: Vector2D.h:218
Belle2::TrackFindingCDC::Vector2D::m_y
double m_y
Memory for the second coordinate.
Definition: Vector2D.h:681
Belle2::TrackFindingCDC::Vector2D::phi
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition: Vector2D.h:583
Belle2::TrackFindingCDC::Vector2D::isCWOf
bool isCWOf(const Vector2D &rhs) const
Indicates if the given vector is more clockwise if you looked in the direction of this vector.
Definition: Vector2D.h:500
Belle2::TrackFindingCDC::Vector2D::setXY
void setXY(const double x, const double y)
Setter for both coordinate.
Definition: Vector2D.h:630
Belle2::TrackFindingCDC::Vector2D::dot
double dot(const Vector2D &rhs) const
Calculates the two dimensional dot product.
Definition: Vector2D.h:172
Belle2::TrackFindingCDC::Vector2D::setFirst
void setFirst(const double first)
Setter for the first coordinate.
Definition: Vector2D.h:648
Belle2::TrackFindingCDC::Vector2D::passiveMovedBy
Vector2D passiveMovedBy(const Vector2D &by) const
Returns a transformed vector passivelly moved by the given vector.
Definition: Vector2D.h:595
Belle2::TrackFindingCDC::Vector2D::first
double first() const
Getter for the first coordinate.
Definition: Vector2D.h:643
Belle2::TrackFindingCDC::Vector2D::operator+=
Vector2D & operator+=(const Vector2D &rhs)
Same as add()
Definition: Vector2D.h:284
Belle2::TrackFindingCDC::Vector2D::cross
double cross(const Vector2D &rhs) const
Calculated the two dimensional cross product.
Definition: Vector2D.h:177
Belle2::TrackFindingCDC::Vector2D::hasNAN
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition: Vector2D.h:163
Belle2::TrackFindingCDC::Vector2D::operator*
friend Vector2D operator*(const Vector2D &vec2D, const double factor)
Same as scaled()
Definition: Vector2D.h:245
Belle2::TrackFindingCDC::Vector2D::isLeftOf
bool isLeftOf(const Vector2D &rhs) const
Indicates if the given vector is more left if you looked in the direction of this vector.
Definition: Vector2D.h:473
Belle2::TrackFindingCDC::Vector2D::operator<
bool operator<(const Vector2D &rhs) const
Total ordering based on cylindrical radius first and azimuth angle second.
Definition: Vector2D.h:143
Belle2::TrackFindingCDC::Vector2D::isCCWOf
bool isCCWOf(const Vector2D &rhs) const
Indicates if the given vector is more counterclockwise if you looked in the direction of this vector.
Definition: Vector2D.h:493
Belle2::TrackFindingCDC::Vector2D::orthogonalVector
Vector2D orthogonalVector(const Vector2D &relativTo) const
Calculates the part of this vector that is parallel to the given vector.
Definition: Vector2D.h:452
Belle2::TrackFindingCDC::Vector2D::orthogonalComp
double orthogonalComp(const Vector2D &relativTo) const
Calculates the component orthogonal to the given vector.
Definition: Vector2D.h:446
Belle2::TrackFindingCDC::Vector2D::Phi
static Vector2D Phi(const double phi)
Constucts a unit vector with azimuth angle equal to phi.
Definition: Vector2D.h:73
Belle2::TrackFindingCDC::Vector2D::operator/=
Vector2D & operator/=(const double denominator)
Same as divide()
Definition: Vector2D.h:259
Belle2::TrackFindingCDC::Vector2D::divided
Vector2D divided(const double denominator) const
Returns a copy where all coordinates got divided by a common denominator.
Definition: Vector2D.h:265
Belle2::TrackFindingCDC::Vector2D::reversed
Vector2D reversed() const
Returns a vector pointing in the opposite direction.
Definition: Vector2D.h:348
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::Vector2D::conformalTransformed
Vector2D conformalTransformed() const
Returns a copy of the vector transformed in conformal space.
Definition: Vector2D.h:407
Belle2::TrackFindingCDC::Vector2D::Vector2D
Vector2D(const double x, const double y)
Constructor from two coordinates.
Definition: Vector2D.h:51
Belle2::TrackFindingCDC::Vector2D::parallelVector
Vector2D parallelVector(const Vector2D &relativTo) const
Calculates the part of this vector that is parallel to the given vector.
Definition: Vector2D.h:431
Belle2::TrackFindingCDC::Vector2D::swapCoordinates
void swapCoordinates()
Swaps the coordinates in place.
Definition: Vector2D.h:565
Belle2::TrackFindingCDC::Vector2D::cylindricalR
double cylindricalR() const
Gives the cylindrical radius of the vector. Same as norm()
Definition: Vector2D.h:571
Belle2::TrackFindingCDC::Vector2D::reverse
Vector2D & reverse()
Reverses the direction of the vector in place.
Definition: Vector2D.h:341
Belle2::TrackFindingCDC::Vector2D::m_x
double m_x
Memory for the first coordinate.
Definition: Vector2D.h:678
Belle2::TrackFindingCDC::Vector2D::unnormalizedParallelComp
double unnormalizedParallelComp(const Vector2D &relativTo) const
Same as parallelComp() but assumes the given vector to be of unit length.
Definition: Vector2D.h:439
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::TrackFindingCDC::NRotation::ERotation
ERotation
Enumeration to represent the distinct possibilities of the right left passage information.
Definition: ERotation.h:35
Belle2::TrackFindingCDC::Vector2D::operator-=
Vector2D & operator-=(const Vector2D &rhs)
Same as subtract()
Definition: Vector2D.h:297
Belle2::TrackFindingCDC::Vector2D::cosWith
double cosWith(const Vector2D &rhs) const
Definition: Vector2D.h:201
Belle2::TrackFindingCDC::Vector2D::x
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:609
Belle2::TrackFindingCDC::Vector2D::orthogonal
Vector2D orthogonal(const ERotation ccwInfo) const
Orthogonal vector to the direction given by the counterclockwise info.
Definition: Vector2D.h:309
Belle2::TrackFindingCDC::Vector2D::setXY
void setXY(const Vector2D &xy)
Setter for both coordinate by an other vector.
Definition: Vector2D.h:636
Belle2::TrackFindingCDC::Vector2D::norm
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:189
Belle2::TrackFindingCDC::Vector2D::operator/
Vector2D operator/(const double denominator) const
Same as divided()
Definition: Vector2D.h:270
Belle2::TrackFindingCDC::Vector2D::flippedAlong
Vector2D flippedAlong(const Vector2D &flippingDirection) const
Reflects this vector along line designated by the given vector.
Definition: Vector2D.h:391
Belle2::TrackFindingCDC::Vector2D::isCCWOrCWOf
ERotation isCCWOrCWOf(const Vector2D &rhs) const
Indicates if the given vector is more counterclockwise or more clockwise if you looked in the directi...
Definition: Vector2D.h:486
Belle2::TrackFindingCDC::Vector2D::isForwardOrBackwardOf
EForwardBackward isForwardOrBackwardOf(const Vector2D &rhs) const
Indicates if the given vector is more coaligned or reverse if you looked in the direction of this vec...
Definition: Vector2D.h:507
Belle2::TrackFindingCDC::Vector2D::angleWith
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:211
Belle2::TrackFindingCDC::Vector2D::setX
void setX(const double x)
Setter for the x coordinate.
Definition: Vector2D.h:614
Belle2::TrackFindingCDC::Vector2D::compose
static Vector2D compose(const Vector2D &coordinateVec, const double parallelCoor, const double orthoCoor)
Constructs a vector from a unit coordinate system vector and the coordinates in that system.
Definition: Vector2D.h:85
Belle2::TrackFindingCDC::Vector2D::subtract
Vector2D & subtract(const Vector2D &rhs)
Subtracts a vector from this in place.
Definition: Vector2D.h:290
Belle2::TrackFindingCDC::Vector2D::flippedSecond
Vector2D flippedSecond() const
Makes a copy of the vector with the second coordinate flipped (no difference between active and passi...
Definition: Vector2D.h:379
Belle2::TrackFindingCDC::Vector2D::Vector2D
Vector2D()
Default constructor for ROOT compatibility.
Definition: Vector2D.h:41
Belle2::TrackFindingCDC::Vector2D::unnormalizedOrthogonalComp
double unnormalizedOrthogonalComp(const Vector2D &relativTo) const
Same as orthogonalComp() but assumes the given vector to be of unit length.
Definition: Vector2D.h:460
Belle2::TrackFindingCDC::Vector2D::sameSign
static bool sameSign(float n1, float n2, float n3)
Check if three values have the same sign.
Definition: Vector2D.h:528
Belle2::TrackFindingCDC::Vector2D::set
void set(const double first, const double second)
Setter for both coordinate.
Definition: Vector2D.h:664
Belle2::TrackFindingCDC::Vector2D::divide
Vector2D & divide(const double denominator)
Divides all coordinates by a common denominator in place.
Definition: Vector2D.h:251
Belle2::TrackFindingCDC::Vector2D::operator-
Vector2D operator-(const Vector2D &rhs) const
Returns a new vector as differenc of this and rhs.
Definition: Vector2D.h:419
Belle2::TrackFindingCDC::Vector2D::passiveRotatedBy
Vector2D passiveRotatedBy(const Vector2D &phiVec) const
Returns a transformed vector version rotated by the given vector.
Definition: Vector2D.h:603
Belle2::TrackFindingCDC::Vector2D::isForwardOf
bool isForwardOf(const Vector2D &rhs) const
Indicates if the given vector is more coaligned if you looked in the direction of this vector.
Definition: Vector2D.h:514
Belle2::TrackFindingCDC::Vector2D::scale
Vector2D & scale(const double factor)
Scales the vector in place by the given factor.
Definition: Vector2D.h:226
Belle2::TrackFindingCDC::Vector2D::flipFirst
void flipFirst()
Flips the first coordinate inplace (no difference between active and passive)
Definition: Vector2D.h:359
Belle2::TrackFindingCDC::Vector2D::average
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:95
Belle2::TrackFindingCDC::Vector2D::operator==
bool operator==(const Vector2D &rhs) const
Equality comparison with both coordinates.
Definition: Vector2D.h:131