ROOT logo
/* @(#)root/base:$Id: TPoint.h 22539 2008-03-08 14:36:37Z rdm $ */

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TPoint
#define ROOT_TPoint


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TPoint                                                               //
//                                                                      //
// TPoint implements a 2D screen (device) point (see also TPoints).     //
//                                                                      //
// Don't add in dictionary since that will add a virtual table pointer  //
// and that will destroy the data layout of an array of TPoint's which  //
// should match the layout of an array of XPoint's (so no extra copying //
// needs to be done in the X11 drawing routines).                       //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif


class TPoint {

public:    // for easy access
#if !defined(WIN32) && !defined(G__WIN32)
   SCoord_t    fX;         //X device coordinate
   SCoord_t    fY;         //Y device coordinate
#else
   long        fX;         //X device coordinate
   long        fY;         //Y device coordinate
#endif

public:
   TPoint() : fX(0), fY(0) { }
   TPoint(SCoord_t xy) : fX(xy), fY(xy) { }
   TPoint(SCoord_t x, SCoord_t y) : fX(x), fY(y) { }
   ~TPoint() { }
   SCoord_t    GetX() const { return (SCoord_t)fX; }
   SCoord_t    GetY() const { return (SCoord_t)fY; }
   void        SetX(SCoord_t x) { fX = x; }
   void        SetY(SCoord_t y) { fY = y; }

   TPoint& operator=(const TPoint& p) { fX = p.fX; fY = p.fY; return *this; }
   friend bool operator==(const TPoint& p1, const TPoint& p2);
   friend bool operator!=(const TPoint& p1, const TPoint& p2);
};

inline bool operator==(const TPoint& p1, const TPoint& p2)
{
   return p1.fX == p2.fX && p1.fY == p2.fY;
}

inline bool operator!=(const TPoint& p1, const TPoint& p2)
{
   return p1.fX != p2.fX || p1.fY != p2.fY;
}

#endif
 TPoint.h:1
 TPoint.h:2
 TPoint.h:3
 TPoint.h:4
 TPoint.h:5
 TPoint.h:6
 TPoint.h:7
 TPoint.h:8
 TPoint.h:9
 TPoint.h:10
 TPoint.h:11
 TPoint.h:12
 TPoint.h:13
 TPoint.h:14
 TPoint.h:15
 TPoint.h:16
 TPoint.h:17
 TPoint.h:18
 TPoint.h:19
 TPoint.h:20
 TPoint.h:21
 TPoint.h:22
 TPoint.h:23
 TPoint.h:24
 TPoint.h:25
 TPoint.h:26
 TPoint.h:27
 TPoint.h:28
 TPoint.h:29
 TPoint.h:30
 TPoint.h:31
 TPoint.h:32
 TPoint.h:33
 TPoint.h:34
 TPoint.h:35
 TPoint.h:36
 TPoint.h:37
 TPoint.h:38
 TPoint.h:39
 TPoint.h:40
 TPoint.h:41
 TPoint.h:42
 TPoint.h:43
 TPoint.h:44
 TPoint.h:45
 TPoint.h:46
 TPoint.h:47
 TPoint.h:48
 TPoint.h:49
 TPoint.h:50
 TPoint.h:51
 TPoint.h:52
 TPoint.h:53
 TPoint.h:54
 TPoint.h:55
 TPoint.h:56
 TPoint.h:57
 TPoint.h:58
 TPoint.h:59
 TPoint.h:60
 TPoint.h:61
 TPoint.h:62
 TPoint.h:63
 TPoint.h:64
 TPoint.h:65
 TPoint.h:66
 TPoint.h:67
 TPoint.h:68
 TPoint.h:69