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

Public Member Functions

 TruncatedEllipsoid (double r_x, double r_y, double r_z, double height, double dh)
 
 ~TruncatedEllipsoid ()
 
virtual std::vector< kvector_tvertices () const
 

Static Public Attributes

static const size_t N_Circle = 24
 

Protected Attributes

std::vector< kvector_tm_vertices
 

Detailed Description

Definition at line 20 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>(IShape::N_Circle) * height / 2.0 / r_z + 0.5)));
25  double h_step = (height - dh) / (n_heights - 1);
26  m_vertices.resize(n_heights * IShape::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: IShape.cpp:37
std::vector< kvector_t > m_vertices
List of vertices initialized during construction.
Definition: IShape.h:40
static const size_t N_Circle
Definition: IShape.h:36

References EllipseVertices(), anonymous_namespace{BoxCompositionBuilder.cpp}::height, IShape::m_vertices, and IShape::N_Circle.

Here is the call graph for this function:

◆ ~TruncatedEllipsoid()

TruncatedEllipsoid::~TruncatedEllipsoid ( )
default

Member Function Documentation

◆ vertices()

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

Retrieves a list of the vertices constituting this concrete shape.

Definition at line 23 of file IShape.cpp.

24 {
25  return m_vertices;
26 }

References IShape::m_vertices.

Member Data Documentation

◆ N_Circle

const size_t IShape::N_Circle = 24
staticinherited

Definition at line 36 of file IShape.h.

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

◆ m_vertices

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

List of vertices initialized during construction.

Definition at line 40 of file IShape.h.

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


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