BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
TruncatedEllipsoidNet Class Reference

Description

Definition at line 25 of file TruncatedEllipsoidNet.h.

Inheritance diagram for TruncatedEllipsoidNet:
[legend]
Collaboration diagram for TruncatedEllipsoidNet:
[legend]

Public Member Functions

 TruncatedEllipsoidNet (double r_x, double r_y, double r_z, double height, double dh)
 
 ~TruncatedEllipsoidNet () override
 
virtual std::vector< R3 > vertices () 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< R3 > m_vertices
 List of vertices initialized during construction. More...
 

Constructor & Destructor Documentation

◆ TruncatedEllipsoidNet()

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

Definition at line 20 of file TruncatedEllipsoidNet.cpp.

22 {
23  static const int n_heights =
24  std::max(2, static_cast<int>(std::round(
25  static_cast<double>(IShape3D::N_Circle) * height / 2.0 / r_z + 0.5)));
26  double h_step = (height - dh) / (n_heights - 1);
27  m_vertices.resize(n_heights * IShape3D::N_Circle);
28  auto it = m_vertices.begin();
29  for (int i = 0; i < n_heights; ++i) {
30  double z = i * h_step;
31  double radius_factor = std::sqrt(1.0 - std::pow((z + r_z - height) / r_z, 2));
32  auto ellipse = EllipseVerticesZ(radius_factor * r_x, radius_factor * r_y, i * h_step);
33  std::move(ellipse.begin(), ellipse.end(), it);
34  it = it + ellipse.size();
35  }
36 }
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 > m_vertices
List of vertices initialized during construction.
Definition: IShape3D.h:42
static const size_t N_Circle
Definition: IShape3D.h:38

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

Here is the call graph for this function:

◆ ~TruncatedEllipsoidNet()

TruncatedEllipsoidNet::~TruncatedEllipsoidNet ( )
overridedefault

Member Function Documentation

◆ vertices()

std::vector< R3 > 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<R3> IShape3D::m_vertices
protectedinherited

◆ N_Circle

const size_t IShape3D::N_Circle = 24
staticinherited

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