Logo ROOT   6.12/07
Reference Guide
TPoint.h
Go to the documentation of this file.
1 /* @(#)root/base:$Id$ */
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TPoint
12 #define ROOT_TPoint
13 
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TPoint //
18 // //
19 // TPoint implements a 2D screen (device) point (see also TPoints). //
20 // //
21 // Don't add in dictionary since that will add a virtual table pointer //
22 // and that will destroy the data layout of an array of TPoint's which //
23 // should match the layout of an array of XPoint's (so no extra copying //
24 // needs to be done in the X11 drawing routines). //
25 // //
26 //////////////////////////////////////////////////////////////////////////
27 
28 #include "Rtypes.h"
29 
30 
31 class TPoint {
32 
33 public: // for easy access
34 #if !defined(WIN32) && !defined(G__WIN32)
35  SCoord_t fX; //X device coordinate
36  SCoord_t fY; //Y device coordinate
37 #else
38  long fX; //X device coordinate
39  long fY; //Y device coordinate
40 #endif
41 
42 public:
43  TPoint() : fX(0), fY(0) { }
44  TPoint(SCoord_t xy) : fX(xy), fY(xy) { }
45  TPoint(SCoord_t x, SCoord_t y) : fX(x), fY(y) { }
46  ~TPoint() { }
47  SCoord_t GetX() const { return (SCoord_t)fX; }
48  SCoord_t GetY() const { return (SCoord_t)fY; }
49  void SetX(SCoord_t x) { fX = x; }
50  void SetY(SCoord_t y) { fY = y; }
51 
52  TPoint& operator=(const TPoint& p) { fX = p.fX; fY = p.fY; return *this; }
53  friend bool operator==(const TPoint& p1, const TPoint& p2);
54  friend bool operator!=(const TPoint& p1, const TPoint& p2);
55 };
56 
57 inline bool operator==(const TPoint& p1, const TPoint& p2)
58 {
59  return p1.fX == p2.fX && p1.fY == p2.fY;
60 }
61 
62 inline bool operator!=(const TPoint& p1, const TPoint& p2)
63 {
64  return p1.fX != p2.fX || p1.fY != p2.fY;
65 }
66 
67 #endif
TPoint(SCoord_t x, SCoord_t y)
Definition: TPoint.h:45
void SetX(SCoord_t x)
Definition: TPoint.h:49
friend bool operator!=(const TPoint &p1, const TPoint &p2)
Definition: TPoint.h:62
SCoord_t fX
Definition: TPoint.h:35
TPoint & operator=(const TPoint &p)
Definition: TPoint.h:52
SCoord_t fY
Definition: TPoint.h:36
SCoord_t GetY() const
Definition: TPoint.h:48
SCoord_t GetX() const
Definition: TPoint.h:47
void SetY(SCoord_t y)
Definition: TPoint.h:50
Double_t x[n]
Definition: legend1.C:17
short SCoord_t
Definition: RtypesCore.h:80
static double p2(double t, double a, double b, double c)
Definition: TPoint.h:31
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
friend bool operator==(const TPoint &p1, const TPoint &p2)
Definition: TPoint.h:57
static double p1(double t, double a, double b)
TPoint(SCoord_t xy)
Definition: TPoint.h:44
TPoint()
Definition: TPoint.h:43
Double_t y[n]
Definition: legend1.C:17
~TPoint()
Definition: TPoint.h:46