TPoint2D Class Reference

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

#include <TPoint2D.h>

List of all members.

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

Private Attributes

double _p [2]


Detailed Description

A class to represent a point in 2D.

Definition at line 37 of file TPoint2D.h.


Constructor & Destructor Documentation

TPoint2D::TPoint2D (  ) 

Constructors.

Definition at line 19 of file TPoint2D.cxx.

References _p.

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

00019                    {
00020     _p[0] = 0.;
00021     _p[1] = 0.;
00022 }

TPoint2D::TPoint2D ( double  ,
double   
)

Definition at line 24 of file TPoint2D.cxx.

References _p.

00024                                      {
00025     _p[0] = x;
00026     _p[1] = y;
00027 }

TPoint2D::TPoint2D ( const HepPoint3D  ) 

Definition at line 29 of file TPoint2D.cxx.

References _p.

00029                                        {
00030     _p[0] = a.x();
00031     _p[1] = a.y();
00032 }

TPoint2D::TPoint2D ( const HepVector3D  ) 

Definition at line 34 of file TPoint2D.cxx.

References _p.

00034                                         {
00035     _p[0] = a.x();
00036     _p[1] = a.y();
00037 }

TPoint2D::~TPoint2D (  )  [virtual]

Destructor.

Definition at line 39 of file TPoint2D.cxx.

00039                     {
00040 }


Member Function Documentation

double TPoint2D::cross ( const TPoint2D  )  const [inline]

Definition at line 139 of file TPoint2D.h.

References _p, x(), and y().

Referenced by TConformalFinder::crossPoints(), TTrackManager::salvageAssociateHits(), and TConformalFinder::trackSide().

00139                                         {
00140     return _p[0] * a.y() - a.x() * _p[1];
00141 }

double TPoint2D::dot ( const TPoint2D  )  const [inline]

Definition at line 133 of file TPoint2D.h.

References _p, x(), and y().

00133                                       {
00134     return _p[0] * a.x() + _p[1] * a.y();
00135 }

double TPoint2D::mag ( void   )  const [inline]

Definition at line 112 of file TPoint2D.h.

References _p.

00112                         {
00113     return sqrt(_p[0] * _p[0] + _p[1] * _p[1]);
00114 }

double TPoint2D::mag2 ( void   )  const [inline]

Definition at line 118 of file TPoint2D.h.

References _p.

Referenced by TConformalFinder::crossPoints().

00118                          {
00119     return _p[0] * _p[0] + _p[1] * _p[1];
00120 }

TPoint2D TPoint2D::operator+ ( const TPoint2D  )  const [inline]

Definition at line 145 of file TPoint2D.h.

References _p, TPoint2D(), x(), and y().

00145                                               {
00146     return TPoint2D(_p[0] + a.x(), _p[1] + a.y());
00147 }

TPoint2D TPoint2D::operator- (  )  const [inline]

Definition at line 157 of file TPoint2D.h.

References _p, and TPoint2D().

00157                             {
00158     return TPoint2D(- _p[0], - _p[1]);
00159 }

TPoint2D TPoint2D::operator- ( const TPoint2D  )  const [inline]

Definition at line 151 of file TPoint2D.h.

References _p, TPoint2D(), x(), and y().

00151                                               {
00152     return TPoint2D(_p[0] - a.x(), _p[1] - a.y());
00153 }

bool TPoint2D::operator== ( const TPoint2D  )  const [inline]

Definition at line 163 of file TPoint2D.h.

References _p, x(), and y().

00163                                                {
00164     if (a.x() == _p[0] && a.y() == _p[1]) return true;
00165     return false;
00166 }

double TPoint2D::phi ( void   )  const [inline]

Definition at line 124 of file TPoint2D.h.

References _p, and M_PI.

Referenced by TConformalFinder::stereoSegmentsFromBadHits().

00124                         {
00125     if (_p[0] == 0.0 && _p[1] == 0.0) return 0.;
00126     double a = atan2(_p[1], _p[0]);
00127     if (a > 0) return a;
00128     return a + 2. * M_PI;
00129 }

TPoint2D TPoint2D::unit ( void   )  const [inline]

Definition at line 170 of file TPoint2D.h.

References _p, and TPoint2D().

00170                          {
00171     double sum2 = _p[0] * _p[0] + _p[1] * _p[1];
00172     if (sum2 == 0.) return TPoint2D(0., 0.);
00173     double sum = sqrt(sum2);
00174     return TPoint2D(_p[0] / sum, _p[1] / sum);
00175 }

double TPoint2D::x ( double   )  [inline]

Definition at line 100 of file TPoint2D.h.

References _p.

00100                     {
00101     return _p[0] = a;
00102 }

double TPoint2D::x ( void   )  const [inline]

Definition at line 88 of file TPoint2D.h.

References _p.

Referenced by cross(), TConformalFinder::crossPoints(), TLine2D::distance(), dot(), operator+(), operator-(), operator<<(), and operator==().

00088                       {
00089     return _p[0];
00090 }

double TPoint2D::y ( double   )  [inline]

Definition at line 106 of file TPoint2D.h.

References _p.

00106                     {
00107     return _p[1] = a;
00108 }

double TPoint2D::y ( void   )  const [inline]

Definition at line 94 of file TPoint2D.h.

References _p.

Referenced by cross(), TConformalFinder::crossPoints(), TLine2D::distance(), dot(), operator+(), operator-(), operator<<(), and operator==().

00094                       {
00095     return _p[1];
00096 }


Member Data Documentation

double TPoint2D::_p[2] [private]

Definition at line 70 of file TPoint2D.h.

Referenced by cross(), dot(), mag(), mag2(), operator+(), operator-(), operator==(), phi(), TPoint2D(), unit(), x(), and y().


Generated on Tue Nov 29 23:36:09 2016 for BOSS_7.0.2 by  doxygen 1.4.7