Belle II Software  release-08-01-10
Area2D.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #ifndef TRGArea2D_FLAG_
10 #define TRGArea2D_FLAG_
11 
12 #include "trg/trg/Point2D.h"
13 
14 namespace Belle2 {
21  class TRGArea2D {
22 
23  public:
25  TRGArea2D(const TRGPoint2D& leftBottom,
26  const TRGPoint2D& rightUpper);
27 
29  virtual ~TRGArea2D();
30 
31  public:
33  bool inArea(const TRGPoint2D& x) const;
34 
36  void cross(const TRGPoint2D& x0,
37  const TRGPoint2D& x1,
38  unsigned& nFound,
39  TRGPoint2D crossPoint[2]) const;
40 
41  private:
44  };
45 
46 //-----------------------------------------------------------------------------
47 
48  inline
49  bool
50  TRGArea2D::inArea(const TRGPoint2D& x) const
51  {
52  if ((x.x() >= _c[0].x()) && (x.x() <= _c[1].x()))
53  if ((x.y() >= _c[0].y()) && (x.y() <= _c[1].y()))
54  return true;
55  return false;
56  }
57 
59 } // namespace Belle2
60 
61 #endif /* TRGArea2D_FLAG_ */
A class to represent an 2D area.
Definition: Area2D.h:21
TRGPoint2D _c[2]
2D points
Definition: Area2D.h:43
A class to represent a point in 2D.
Definition: Point2D.h:27
double y(void) const
y of the point
Definition: Point2D.h:99
virtual ~TRGArea2D()
Destructor.
Definition: Area2D.cc:24
TRGArea2D(const TRGPoint2D &leftBottom, const TRGPoint2D &rightUpper)
Contructor.
Definition: Area2D.cc:17
double x(void) const
x of the point
Definition: Point2D.h:92
bool inArea(const TRGPoint2D &x) const
returns true if give point is in the area.
Definition: Area2D.h:50
void cross(const TRGPoint2D &x0, const TRGPoint2D &x1, unsigned &nFound, TRGPoint2D crossPoint[2]) const
returns cross-points.
Definition: Area2D.cc:29
Abstract base class for different kinds of events.