BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Rectangle.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Device/Mask/Rectangle.h
6 //! @brief Defines class Rectangle.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_CORE_MASK_RECTANGLE_H
16 #define BORNAGAIN_CORE_MASK_RECTANGLE_H
17 
18 #include "Device/Mask/IShape2D.h"
19 
20 //! The rectangle shape having its axis aligned to the (non-rotated) coordinate system.
21 //! @ingroup mask
22 
23 class Rectangle : public IShape2D
24 {
25 public:
26  Rectangle(double xlow, double ylow, double xup, double yup);
27  Rectangle* clone() const { return new Rectangle(m_xlow, m_ylow, m_xup, m_yup); }
28 
29  bool contains(double x, double y) const;
30  bool contains(const Bin1D& binx, const Bin1D& biny) const;
31 
32  double getArea() const;
33 
34  double getXlow() const { return m_xlow; }
35  double getYlow() const { return m_ylow; }
36  double getXup() const { return m_xup; }
37  double getYup() const { return m_yup; }
38 
39 private:
40  double m_xlow, m_ylow, m_xup, m_yup;
41 };
42 
43 #endif // BORNAGAIN_CORE_MASK_RECTANGLE_H
Defines basic class for all 2D shapes.
Basic class for all shapes in 2D.
Definition: IShape2D.h:27
The rectangle shape having its axis aligned to the (non-rotated) coordinate system.
Definition: Rectangle.h:24
Rectangle * clone() const
Definition: Rectangle.h:27
double m_xup
Definition: Rectangle.h:40
double m_ylow
Definition: Rectangle.h:40
Rectangle(double xlow, double ylow, double xup, double yup)
Definition: Rectangle.cpp:23
double m_xlow
Definition: Rectangle.h:40
bool contains(double x, double y) const
Returns true if point with given coordinates is inside or on border of the shape.
Definition: Rectangle.cpp:43
double getXlow() const
Definition: Rectangle.h:34
double getXup() const
Definition: Rectangle.h:36
double getArea() const
Definition: Rectangle.cpp:53
double getYlow() const
Definition: Rectangle.h:35
double getYup() const
Definition: Rectangle.h:37
double m_yup
Definition: Rectangle.h:40
Definition: Bin.h:20