Definition at line 78 of file IPositionBuilder.h.
◆ Lattice2DPositionBuilder()
Definition at line 122 of file IPositionBuilder.cpp.
InterferenceFunction2DLattice * clone() const override
Returns a clone of this ISampleNode object.
std::unique_ptr< InterferenceFunction2DLattice > m_iff
◆ ~Lattice2DPositionBuilder()
Lattice2DPositionBuilder::~Lattice2DPositionBuilder |
( |
| ) |
|
|
overridedefault |
◆ generatePositions()
std::vector< std::vector< double > > IPositionBuilder::generatePositions |
( |
double |
layer_size, |
|
|
double |
density = 0.0 |
|
) |
| const |
|
inherited |
Definition at line 28 of file IPositionBuilder.cpp.
35 std::random_device rd;
36 std::mt19937 gen(rd());
37 std::normal_distribution<double> dis(0.0, std::sqrt(pos_var));
38 for (
auto& position : positions) {
39 for (
auto& coordinate : position)
40 coordinate += dis(gen);
virtual std::vector< std::vector< double > > generatePositionsImpl(double layer_size, double density=0.0) const =0
virtual double positionVariance() const =0
References IPositionBuilder::generatePositionsImpl(), and IPositionBuilder::positionVariance().
◆ generatePositionsImpl()
std::vector< std::vector< double > > Lattice2DPositionBuilder::generatePositionsImpl |
( |
double |
layer_size, |
|
|
double |
density = 0.0 |
|
) |
| const |
|
overrideprivatevirtual |
Implements IPositionBuilder.
Definition at line 129 of file IPositionBuilder.cpp.
132 auto& lattice =
m_iff->lattice();
133 double l1 = lattice.length1();
134 double l2 = lattice.length2();
135 double alpha = lattice.latticeAngle();
136 double xi = lattice.rotationAngle();
141 double sina = std::abs(std::sin(alpha));
143 n1 = l1 == 0.0 ? 2 :
static_cast<unsigned>(2.0 * layer_size * std::sqrt(2.0) / l1);
144 n2 = l2 == 0.0 ? 2 :
static_cast<unsigned>(2.0 * layer_size * std::sqrt(2.0) / l2);
146 n1 = l1 == 0.0 ? 2 :
static_cast<unsigned>(2.0 * layer_size * std::sqrt(2.0) / l1 / sina);
147 n2 = l2 == 0.0 ? 2 :
static_cast<unsigned>(2.0 * layer_size * std::sqrt(2.0) / l2 / sina);
149 return Generate2DLatticePoints(l1, l2, alpha, xi, n1, n2);
References m_iff.
◆ positionVariance()
double Lattice2DPositionBuilder::positionVariance |
( |
| ) |
const |
|
overrideprivatevirtual |
◆ m_iff
The documentation for this class was generated from the following files: