BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Prism3.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/Prism3.cpp
6 //! @brief Implements class Prism3.
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 #include <iostream>
17 
18 Prism3::Prism3(const std::vector<double> P)
19  : IFormFactorPrism(P)
20  , m_base_edge(m_P[0])
21  , m_height(m_P[1])
22 {
23  checkNodeArgs();
24  double a = m_base_edge;
25  double as = a / 2;
26  double ac = a / sqrt(3) / 2;
27  double ah = a / sqrt(3);
28  std::vector<R3> V{{-ac, as, 0.}, {-ac, -as, 0.}, {ah, 0., 0.}};
29  setPrism(false, V);
30 }
31 
32 Prism3::Prism3(double base_edge, double height)
33  : Prism3(std::vector<double>{base_edge, height})
34 {
35 }
Defines class Prism3.
A prism with a polygonal base, for form factor computation.
void setPrism(bool symmetry_Ci, const std::vector< R3 > &vertices)
void checkNodeArgs() const
Raises exception if a parameter value is invalid.
Definition: INode.cpp:27
A prism based on an equilateral triangle.
Definition: Prism3.h:23
const double & m_base_edge
Definition: Prism3.h:42
Prism3(double base_edge, double height)
Definition: Prism3.cpp:32
double height() const override
Definition: Prism3.h:39