BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RippleCosine.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Shapes/RippleCosine.cpp
6 //! @brief Implements class RippleCosine.
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 
16 
17 #include <cmath>
18 
19 RippleCosine::RippleCosine(double length, double width, double height)
20 {
21  size_t n_y = IShape3D::N_Circle + 1;
22  double y_step = width / (IShape3D::N_Circle);
23  m_vertices.resize(2 * n_y);
24  for (size_t i = 0; i < n_y; ++i) {
25  double y = i * y_step - width / 2.0;
26  double z = height * (1.0 + std::cos(2.0 * M_PI * y / width)) / 2.0;
27  m_vertices[i] = kvector_t(length / 2.0, y, z);
28  m_vertices[n_y + i] = kvector_t(-length / 2.0, y, z);
29  }
30 }
31 
32 RippleCosine::~RippleCosine() = default;
#define M_PI
Definition: Constants.h:44
Defines class RippleCosine.
BasicVector3D< double > kvector_t
Definition: Vectors3D.h:21
static const size_t N_Circle
Definition: IShape3D.h:40
std::vector< kvector_t > m_vertices
List of vertices initialized during construction.
Definition: IShape3D.h:44
RippleCosine(double length, double width, double height)