Belle II Software  release-05-01-25
Area2D.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : TRGArea2D.h
5 // Section : TRG
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to represent a 2D area.
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGArea2D_FLAG_
15 #define TRGArea2D_FLAG_
16 
17 #include "trg/trg/Point2D.h"
18 
19 namespace Belle2 {
25  class TRGArea2D {
27 
28  public:
30  TRGArea2D(const TRGPoint2D& leftBottom,
31  const TRGPoint2D& rightUpper);
32 
34  virtual ~TRGArea2D();
35 
36  public:
38  bool inArea(const TRGPoint2D& x) const;
39 
41  void cross(const TRGPoint2D& x0,
42  const TRGPoint2D& x1,
43  unsigned& nFound,
44  TRGPoint2D crossPoint[2]) const;
45 
46  private:
49  };
50 
51 //-----------------------------------------------------------------------------
52 
53  inline
54  bool
55  TRGArea2D::inArea(const TRGPoint2D& x) const
56  {
57  if ((x.x() >= _c[0].x()) && (x.x() <= _c[1].x()))
58  if ((x.y() >= _c[0].y()) && (x.y() <= _c[1].y()))
59  return true;
60  return false;
61  }
62 
64 } // namespace Belle2
65 
66 #endif /* TRGArea2D_FLAG_ */
Belle2::TRGPoint2D
A class to represent a point in 2D.
Definition: Point2D.h:32
Belle2::TRGPoint2D::y
double y(void) const
y of the point
Definition: Point2D.h:103
Belle2::TRGPoint2D::x
double x(void) const
x of the point
Definition: Point2D.h:96
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGArea2D::_c
TRGPoint2D _c[2]
2D points
Definition: Area2D.h:48
Belle2::TRGArea2D::~TRGArea2D
virtual ~TRGArea2D()
Destructor.
Definition: Area2D.cc:29
Belle2::TRGArea2D::inArea
bool inArea(const TRGPoint2D &x) const
returns true if give point is in the area.
Definition: Area2D.h:55
Belle2::TRGArea2D::cross
void cross(const TRGPoint2D &x0, const TRGPoint2D &x1, unsigned &nFound, TRGPoint2D crossPoint[2]) const
returns cross-points.
Definition: Area2D.cc:34
Belle2::TRGArea2D::TRGArea2D
TRGArea2D(const TRGPoint2D &leftBottom, const TRGPoint2D &rightUpper)
Contructor.
Definition: Area2D.cc:22