Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:30:14

0001 /* @(#)root/base:$Id$ */
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_TPoint
0012 #define ROOT_TPoint
0013 
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TPoint                                                               //
0018 //                                                                      //
0019 // TPoint implements a 2D screen (device) point (see also TPoints).     //
0020 //                                                                      //
0021 // Don't add in dictionary since that will add a virtual table pointer  //
0022 // and that will destroy the data layout of an array of TPoint's which  //
0023 // should match the layout of an array of XPoint's (so no extra copying //
0024 // needs to be done in the X11 drawing routines).                       //
0025 //                                                                      //
0026 //////////////////////////////////////////////////////////////////////////
0027 
0028 #include "RtypesCore.h"
0029 
0030 
0031 class TPoint {
0032 
0033 public:    // for easy access
0034 #if !defined(WIN32) && !defined(G__WIN32)
0035    SCoord_t    fX;         //X device coordinate
0036    SCoord_t    fY;         //Y device coordinate
0037 #else
0038    long        fX;         //X device coordinate
0039    long        fY;         //Y device coordinate
0040 #endif
0041 
0042 public:
0043    TPoint() : fX(0), fY(0) { }
0044    TPoint(SCoord_t xy) : fX(xy), fY(xy) { }
0045    TPoint(SCoord_t x, SCoord_t y) : fX(x), fY(y) { }
0046    SCoord_t    GetX() const { return (SCoord_t)fX; }
0047    SCoord_t    GetY() const { return (SCoord_t)fY; }
0048    void        SetX(SCoord_t x) { fX = x; }
0049    void        SetY(SCoord_t y) { fY = y; }
0050 
0051    friend bool operator==(const TPoint& p1, const TPoint& p2);
0052    friend bool operator!=(const TPoint& p1, const TPoint& p2);
0053 };
0054 
0055 inline bool operator==(const TPoint& p1, const TPoint& p2)
0056 {
0057    return p1.fX == p2.fX && p1.fY == p2.fY;
0058 }
0059 
0060 inline bool operator!=(const TPoint& p1, const TPoint& p2)
0061 {
0062    return p1.fX != p2.fX || p1.fY != p2.fY;
0063 }
0064 
0065 #endif