BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
TruncatedEllipsoid Class Reference
Inheritance diagram for TruncatedEllipsoid:
[legend]
Collaboration diagram for TruncatedEllipsoid:
[legend]

Public Member Functions

 TruncatedEllipsoid (double r_x, double r_y, double r_z, double height, double dh)
 
 ~TruncatedEllipsoid ()
 
virtual std::vector< kvector_tvertices () const
 Retrieves a list of the vertices constituting this concrete shape. More...
 

Static Public Attributes

static const size_t N_Circle = 24
 

Protected Attributes

std::vector< kvector_tm_vertices
 List of vertices initialized during construction. More...
 

Detailed Description

Definition at line 25 of file TruncatedEllipsoid.h.

Constructor & Destructor Documentation

◆ TruncatedEllipsoid()

TruncatedEllipsoid::TruncatedEllipsoid ( double  r_x,
double  r_y,
double  r_z,
double  height,
double  dh 
)

Definition at line 20 of file TruncatedEllipsoid.cpp.

21 {
22  static const int n_heights =
23  std::max(2, static_cast<int>(std::round(
24  static_cast<double>(IShape3D::N_Circle) * height / 2.0 / r_z + 0.5)));
25  double h_step = (height - dh) / (n_heights - 1);
26  m_vertices.resize(n_heights * IShape3D::N_Circle);
27  auto it = m_vertices.begin();
28  for (int i = 0; i < n_heights; ++i) {
29  double z = i * h_step;
30  double radius_factor = std::sqrt(1.0 - std::pow((z + r_z - height) / r_z, 2));
31  auto ellipse = EllipseVertices(radius_factor * r_x, radius_factor * r_y, i * h_step);
32  std::move(ellipse.begin(), ellipse.end(), it);
33  it = it + ellipse.size();
34  }
35 }
std::vector< kvector_t > EllipseVertices(double r_x, double r_y, double z)
Generate vertices of centered ellipse with given semi-axes at height z.
Definition: IShape3D.cpp:37
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

References EllipseVertices(), IShape3D::m_vertices, and IShape3D::N_Circle.

Here is the call graph for this function:

◆ ~TruncatedEllipsoid()

TruncatedEllipsoid::~TruncatedEllipsoid ( )
default

Member Function Documentation

◆ vertices()

std::vector< kvector_t > IShape3D::vertices ( ) const
virtualinherited

Retrieves a list of the vertices constituting this concrete shape.

Definition at line 23 of file IShape3D.cpp.

24 {
25  return m_vertices;
26 }

References IShape3D::m_vertices.

Member Data Documentation

◆ m_vertices

std::vector<kvector_t> IShape3D::m_vertices
protectedinherited

List of vertices initialized during construction.

Definition at line 44 of file IShape3D.h.

Referenced by Box::Box(), DoubleEllipse::DoubleEllipse(), RippleCosine::RippleCosine(), RippleSawtooth::RippleSawtooth(), TruncatedEllipsoid(), and IShape3D::vertices().

◆ N_Circle

const size_t IShape3D::N_Circle = 24
staticinherited

Definition at line 40 of file IShape3D.h.

Referenced by RippleCosine::RippleCosine(), TruncatedEllipsoid(), and EllipseVertices().


The documentation for this class was generated from the following files: