BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IShape3D.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Shapes/IShape3D.h
6 //! @brief Defines interface IShape3D.
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_SAMPLE_SHAPES_ISHAPE3D_H
21 #define BORNAGAIN_SAMPLE_SHAPES_ISHAPE3D_H
22 
23 #include <heinz/Vectors3D.h>
24 #include <vector>
25 
26 //! Abstract base class for different shapes.
27 //!
28 //! In contrast to the form factors, these shapes only provide an interface
29 //! for returning a set of vertices.
30 
31 class IShape3D {
32 public:
33  IShape3D() = default;
34  virtual ~IShape3D() = default;
35 
36  //! Retrieves a list of the vertices constituting this concrete shape
37  virtual std::vector<R3> vertices() const;
38  static const size_t N_Circle;
39 
40 protected:
41  //! List of vertices initialized during construction
42  std::vector<R3> m_vertices;
43 };
44 
45 //! Helper functions to construct lists of vertices
46 //!
47 //! Generate vertices of centered rectangle at height z
48 std::vector<R3> RectangleVertices(double length, double width, double z);
49 
50 //! Generate vertices of centered horizontal ellipse with given semi-axes at height z
51 std::vector<R3> EllipseVerticesZ(double r_x, double r_y, double z);
52 
53 //! Generate vertices of centered vertical ellipse with given semi-axes at position x and truncation
54 //! heights z_b (bottom) and z_t (top)
55 std::vector<R3> EllipseVerticesXtrunc(double x, double r_y, double r_z, double z_b, double z_t);
56 
57 #endif // BORNAGAIN_SAMPLE_SHAPES_ISHAPE3D_H
58 #endif // USER_API
std::vector< R3 > EllipseVerticesXtrunc(double x, double r_y, double r_z, double z_b, double z_t)
Generate vertices of centered vertical ellipse with given semi-axes at position x and truncation heig...
Definition: IShape3D.cpp:50
std::vector< R3 > EllipseVerticesZ(double r_x, double r_y, double z)
Generate vertices of centered horizontal ellipse with given semi-axes at height z.
Definition: IShape3D.cpp:37
std::vector< R3 > RectangleVertices(double length, double width, double z)
Helper functions to construct lists of vertices.
Definition: IShape3D.cpp:28
Abstract base class for different shapes.
Definition: IShape3D.h:31
virtual std::vector< R3 > vertices() const
Retrieves a list of the vertices constituting this concrete shape.
Definition: IShape3D.cpp:23
std::vector< R3 > m_vertices
List of vertices initialized during construction.
Definition: IShape3D.h:42
virtual ~IShape3D()=default
static const size_t N_Circle
Definition: IShape3D.h:38
IShape3D()=default