Logo ROOT  
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
31class TPoint {
32
33public: // 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
42public:
43 TPoint() : fX(0), fY(0) { }
46 SCoord_t GetX() const { return (SCoord_t)fX; }
47 SCoord_t GetY() const { return (SCoord_t)fY; }
48 void SetX(SCoord_t x) { fX = x; }
49 void SetY(SCoord_t y) { fY = y; }
50
51 friend bool operator==(const TPoint& p1, const TPoint& p2);
52 friend bool operator!=(const TPoint& p1, const TPoint& p2);
53};
54
55inline bool operator==(const TPoint& p1, const TPoint& p2)
56{
57 return p1.fX == p2.fX && p1.fY == p2.fY;
58}
59
60inline bool operator!=(const TPoint& p1, const TPoint& p2)
61{
62 return p1.fX != p2.fX || p1.fY != p2.fY;
63}
64
65#endif
short SCoord_t
Definition: RtypesCore.h:80
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
bool operator!=(const TPoint &p1, const TPoint &p2)
Definition: TPoint.h:60
bool operator==(const TPoint &p1, const TPoint &p2)
Definition: TPoint.h:55
Definition: TPoint.h:31
SCoord_t fY
Definition: TPoint.h:36
SCoord_t fX
Definition: TPoint.h:35
TPoint(SCoord_t x, SCoord_t y)
Definition: TPoint.h:45
friend bool operator!=(const TPoint &p1, const TPoint &p2)
Definition: TPoint.h:60
SCoord_t GetY() const
Definition: TPoint.h:47
TPoint()
Definition: TPoint.h:43
void SetX(SCoord_t x)
Definition: TPoint.h:48
void SetY(SCoord_t y)
Definition: TPoint.h:49
SCoord_t GetX() const
Definition: TPoint.h:46
TPoint(SCoord_t xy)
Definition: TPoint.h:44
friend bool operator==(const TPoint &p1, const TPoint &p2)
Definition: TPoint.h:55
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17