BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
TPoint2D Class Reference

A class to represent a point in 2D. More...

#include <TPoint2D.h>

Public Member Functions

 TPoint2D ()
 Constructors.
 
 TPoint2D (double, double)
 
 TPoint2D (const HepPoint3D &)
 
 TPoint2D (const HepVector3D &)
 
virtual ~TPoint2D ()
 Destructor.
 
double x (void) const
 
double y (void) const
 
double mag (void) const
 
double mag2 (void) const
 
double phi (void) const
 
double x (double)
 
double y (double)
 
double dot (const TPoint2D &) const
 
double cross (const TPoint2D &) const
 
TPoint2D unit (void) const
 
TPoint2D operator+ (const TPoint2D &) const
 
TPoint2D operator- (const TPoint2D &) const
 
TPoint2D operator- () const
 
bool operator== (const TPoint2D &) const
 

Detailed Description

A class to represent a point in 2D.

Definition at line 37 of file TPoint2D.h.

Constructor & Destructor Documentation

◆ TPoint2D() [1/4]

TPoint2D::TPoint2D ( )

Constructors.

Definition at line 19 of file TPoint2D.cxx.

19 {
20 _p[0] = 0.;
21 _p[1] = 0.;
22}

Referenced by operator+(), operator-(), and unit().

◆ TPoint2D() [2/4]

TPoint2D::TPoint2D ( double  x,
double  y 
)

Definition at line 24 of file TPoint2D.cxx.

24 {
25 _p[0] = x;
26 _p[1] = y;
27}
double y(void) const
Definition: TPoint2D.h:94
double x(void) const
Definition: TPoint2D.h:88

◆ TPoint2D() [3/4]

TPoint2D::TPoint2D ( const HepPoint3D a)

Definition at line 29 of file TPoint2D.cxx.

29 {
30 _p[0] = a.x();
31 _p[1] = a.y();
32}

◆ TPoint2D() [4/4]

TPoint2D::TPoint2D ( const HepVector3D a)

Definition at line 34 of file TPoint2D.cxx.

34 {
35 _p[0] = a.x();
36 _p[1] = a.y();
37}

◆ ~TPoint2D()

TPoint2D::~TPoint2D ( )
virtual

Destructor.

Definition at line 39 of file TPoint2D.cxx.

39 {
40}

Member Function Documentation

◆ cross()

double TPoint2D::cross ( const TPoint2D a) const
inline

Definition at line 139 of file TPoint2D.h.

139 {
140 return _p[0] * a.y() - a.x() * _p[1];
141}

Referenced by TTrackManager::salvageAssociateHits().

◆ dot()

double TPoint2D::dot ( const TPoint2D a) const
inline

Definition at line 133 of file TPoint2D.h.

133 {
134 return _p[0] * a.x() + _p[1] * a.y();
135}

Referenced by TTrack::stereoHitForCurl(), and TTrack::szPosition().

◆ mag()

double TPoint2D::mag ( void  ) const
inline

Definition at line 112 of file TPoint2D.h.

112 {
113 return sqrt(_p[0] * _p[0] + _p[1] * _p[1]);
114}

Referenced by TTrack::stereoHitForCurl(), and TTrack::szPosition().

◆ mag2()

double TPoint2D::mag2 ( void  ) const
inline

Definition at line 118 of file TPoint2D.h.

118 {
119 return _p[0] * _p[0] + _p[1] * _p[1];
120}

◆ operator+()

TPoint2D TPoint2D::operator+ ( const TPoint2D a) const
inline

Definition at line 145 of file TPoint2D.h.

145 {
146 return TPoint2D(_p[0] + a.x(), _p[1] + a.y());
147}
TPoint2D()
Constructors.
Definition: TPoint2D.cxx:19

◆ operator-() [1/2]

TPoint2D TPoint2D::operator- ( ) const
inline

Definition at line 157 of file TPoint2D.h.

157 {
158 return TPoint2D(- _p[0], - _p[1]);
159}

◆ operator-() [2/2]

TPoint2D TPoint2D::operator- ( const TPoint2D a) const
inline

Definition at line 151 of file TPoint2D.h.

151 {
152 return TPoint2D(_p[0] - a.x(), _p[1] - a.y());
153}

◆ operator==()

bool TPoint2D::operator== ( const TPoint2D a) const
inline

Definition at line 163 of file TPoint2D.h.

163 {
164 if (a.x() == _p[0] && a.y() == _p[1]) return true;
165 return false;
166}

◆ phi()

double TPoint2D::phi ( void  ) const
inline

Definition at line 124 of file TPoint2D.h.

124 {
125 if (_p[0] == 0.0 && _p[1] == 0.0) return 0.;
126 double a = atan2(_p[1], _p[0]);
127 if (a > 0) return a;
128 return a + 2. * M_PI;
129}
#define M_PI
Definition: TConstant.h:4

◆ unit()

TPoint2D TPoint2D::unit ( void  ) const
inline

Definition at line 170 of file TPoint2D.h.

170 {
171 double sum2 = _p[0] * _p[0] + _p[1] * _p[1];
172 if (sum2 == 0.) return TPoint2D(0., 0.);
173 double sum = sqrt(sum2);
174 return TPoint2D(_p[0] / sum, _p[1] / sum);
175}

◆ x() [1/2]

double TPoint2D::x ( double  a)
inline

Definition at line 100 of file TPoint2D.h.

100 {
101 return _p[0] = a;
102}

◆ x() [2/2]

double TPoint2D::x ( void  ) const
inline

Definition at line 88 of file TPoint2D.h.

88 {
89 return _p[0];
90}

Referenced by cross(), TLine2D::distance(), dot(), TLine2D::fit(), operator+(), operator-(), operator<<(), operator==(), TTrack::stereoHitForCurl(), and TPoint2D().

◆ y() [1/2]

double TPoint2D::y ( double  a)
inline

Definition at line 106 of file TPoint2D.h.

106 {
107 return _p[1] = a;
108}

◆ y() [2/2]

double TPoint2D::y ( void  ) const
inline

Definition at line 94 of file TPoint2D.h.

94 {
95 return _p[1];
96}

Referenced by cross(), TLine2D::distance(), dot(), TLine2D::fit(), operator+(), operator-(), operator<<(), operator==(), TTrack::stereoHitForCurl(), and TPoint2D().


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