Logo ROOT   6.12/07
Reference Guide
TPadPos.hxx
Go to the documentation of this file.
1 /// \file ROOT/TPadPos.hxx
2 /// \ingroup Gpad ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2017-07-07
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6 /// is welcome!
7 
8 /*************************************************************************
9  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
10  * All rights reserved. *
11  * *
12  * For the licensing terms see $ROOTSYS/LICENSE. *
13  * For the list of contributors see $ROOTSYS/README/CREDITS. *
14  *************************************************************************/
15 
16 #ifndef ROOT7_TPadPos
17 #define ROOT7_TPadPos
18 
19 #include "ROOT/TPadExtent.hxx"
20 
21 namespace ROOT {
22 namespace Experimental {
23 
24 /** \class ROOT::Experimental::TPadPos
25  A position (horizontal and vertical) in a `TPad`.
26  */
29  TPadPos() = default;
30  TPadPos(const TPadExtent& extent): Internal::TPadHorizVert(extent) {}
31 
32  /// Add a `TPadExtent`.
33  friend TPadPos operator+(const TPadPos &lhs, const TPadExtent &rhs)
34  {
35  return TPadPos{lhs.fHoriz + rhs.fHoriz, lhs.fVert + rhs.fVert};
36  }
37 
38  /// Add to a `TPadExtent`.
39  friend TPadPos operator+(const TPadExtent &lhs, const TPadPos &rhs)
40  {
41  return TPadPos{lhs.fHoriz + rhs.fHoriz, lhs.fVert + rhs.fVert};
42  }
43 
44  /// Subtract a `TPadExtent`.
45  friend TPadPos operator-(const TPadPos &lhs, const TPadExtent &rhs)
46  {
47  return TPadPos{lhs.fHoriz - rhs.fHoriz, lhs.fVert - rhs.fVert};
48  }
49 
50  /// Subtract from a `TPadPos`s. Is this really needed?
51  /*
52  friend TPadPos operator-(const TPadExtent &rhs, const TPadPos &lhs)
53  {
54  return TPadPos{lhs.fHoriz - rhs.fHoriz, lhs.fVert - rhs.fVert};
55  }
56  */
57 
58  /// Add a `TPadExtent`.
60  {
61  fHoriz += rhs.fHoriz;
62  fVert += rhs.fVert;
63  return *this;
64  };
65 
66  /// Subtract a `TPadExtent`.
68  {
69  fHoriz -= rhs.fHoriz;
70  fVert -= rhs.fVert;
71  return *this;
72  };
73 
74  /** \class ScaleFactor
75  A scale factor (separate factors for horizontal and vertical) for scaling a `TPadCoord`.
76  */
77  struct ScaleFactor {
78  double fHoriz; ///< Horizontal scale factor
79  double fVert; ///< Vertical scale factor
80  };
81 
82  /// Scale a `TPadHorizVert` horizonally and vertically.
83  /// \param scale - the scale factor,
85  {
86  fHoriz *= scale.fHoriz;
87  fVert *= scale.fVert;
88  return *this;
89  };
90 };
91 
92 } // namespace Experimental
93 } // namespace ROOT
94 
95 #endif
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
TPadPos & operator+=(const TPadExtent &rhs)
Subtract from a TPadPoss. Is this really needed?
Definition: TPadPos.hxx:59
double fHoriz
Horizontal scale factor.
Definition: TPadPos.hxx:78
TPadPos(const TPadExtent &extent)
Definition: TPadPos.hxx:30
friend TPadPos operator-(const TPadPos &lhs, const TPadExtent &rhs)
Subtract a TPadExtent.
Definition: TPadPos.hxx:45
A position (horizontal and vertical) in a TPad.
Definition: TPadPos.hxx:27
double fVert
Vertical scale factor.
Definition: TPadPos.hxx:79
TPadPos & operator*=(const ScaleFactor &scale)
Scale a TPadHorizVert horizonally and vertically.
Definition: TPadPos.hxx:84
TPadCoord fVert
Vertical position.
Definition: TPadExtent.hxx:33
An extent / size (horizontal and vertical) in a TPad.
Definition: TPadExtent.hxx:44
TPadPos & operator-=(const TPadExtent &rhs)
Subtract a TPadExtent.
Definition: TPadPos.hxx:67
TPadCoord fHoriz
Horizontal position.
Definition: TPadExtent.hxx:32
friend TPadPos operator+(const TPadPos &lhs, const TPadExtent &rhs)
Add a TPadExtent.
Definition: TPadPos.hxx:33
A scale factor (separate factors for horizontal and vertical) for scaling a TPadCoord.
Definition: TPadPos.hxx:77
friend TPadPos operator+(const TPadExtent &lhs, const TPadPos &rhs)
Add to a TPadExtent.
Definition: TPadPos.hxx:39
A 2D (horizontal and vertical) combination of TPadCoords.
Definition: TPadExtent.hxx:31