BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Ellipse.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Device/Mask/Ellipse.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_DEVICE_MASK_ELLIPSE_H
16 #define BORNAGAIN_DEVICE_MASK_ELLIPSE_H
17 
18 #include "Device/Mask/IShape2D.h"
19 
20 //! An ellipse, for use in detector masks.
21 //! @ingroup tools
22 
23 class Ellipse : public IShape2D {
24 public:
25  Ellipse(double xcenter, double ycenter, double xradius, double yradius, double theta = 0.0);
26  Ellipse* clone() const { return new Ellipse(m_xc, m_yc, m_xr, m_yr, m_theta); }
27 
28  bool contains(double x, double y) const;
29  bool contains(const Bin1D& binx, const Bin1D& biny) const;
30 
31  double getCenterX() const { return m_xc; }
32  double getCenterY() const { return m_yc; }
33  double getRadiusX() const { return m_xr; }
34  double getRadiusY() const { return m_yr; }
35  double getTheta() const { return m_theta; }
36 
37 private:
38  double m_xc, m_yc, m_xr, m_yr, m_theta;
39 };
40 
41 #endif // BORNAGAIN_DEVICE_MASK_ELLIPSE_H
Defines basic class for all 2D shapes.
An ellipse, for use in detector masks.
Definition: Ellipse.h:23
double getCenterY() const
Definition: Ellipse.h:32
double m_xc
Definition: Ellipse.h:38
double m_xr
Definition: Ellipse.h:38
double getTheta() const
Definition: Ellipse.h:35
bool contains(double x, double y) const
Returns true if point with given coordinates is inside or on border of the shape.
Definition: Ellipse.cpp:37
Ellipse * clone() const
Definition: Ellipse.h:26
double getRadiusY() const
Definition: Ellipse.h:34
double m_yc
Definition: Ellipse.h:38
double getCenterX() const
Definition: Ellipse.h:31
double m_yr
Definition: Ellipse.h:38
Ellipse(double xcenter, double ycenter, double xradius, double yradius, double theta=0.0)
Definition: Ellipse.cpp:23
double m_theta
Definition: Ellipse.h:38
double getRadiusX() const
Definition: Ellipse.h:33
Basic class for all shapes in 2D.
Definition: IShape2D.h:27
Definition: Bin.h:20