diff --git a/CHANGELOG b/CHANGELOG index 69f6db6ca2b7da49e997b1ef93f4a5b4734fab89..337b891cd748df3a9d4060097c8853b3a2ede339 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ BornAgain-20.2, released 2023.05.04 reported by Liz Margarita Montanez Huaman) * Repair GUI support for angular grazing scans (#574) * Consistently mention K-correlation model which is really used for roughness (#581) + * Correct vertical shift for multi-particle layouts (#584, reported by Timo Fuchs) > Dependencies * Adapt to libheinz-1.1.0 diff --git a/Resample/Processed/ReSample.cpp b/Resample/Processed/ReSample.cpp index fca9642005e7edf3973f3fea0b5802cdae8712b5..1dca4f6cd9d187dc4e7f5b077acbb5688b1bc229 100644 --- a/Resample/Processed/ReSample.cpp +++ b/Resample/Processed/ReSample.cpp @@ -243,7 +243,8 @@ ReLayout* makeReLayout(const ParticleLayout& layout, const SliceStack& slices, d OwningVector<IReParticle> terms; for (const auto* subparticle : particle->decompose()) { - const auto slice_indices = SliceIndexSpan(*subparticle, slices, z_ref); + double z_sub = z_ref; + const auto slice_indices = SliceIndexSpan(*subparticle, slices, z_sub); bool single_layer = (slice_indices.first == slice_indices.second); double z0 = slices.at(0).low(); std::unique_ptr<IParticle> myparticle(subparticle->clone()); @@ -251,8 +252,8 @@ ReLayout* makeReLayout(const ParticleLayout& layout, const SliceStack& slices, d for (size_t i = slice_indices.first; i < slice_indices.second + 1; ++i) { const Slice& slice = slices[i]; double z_top_i = i == 0 ? 0 : slice.hig() - z0; - R3 translation(0.0, 0.0, z_ref - z_top_i); - z_ref = z_top_i; // subparticle now has coordinates relative to z_top_i + R3 translation(0.0, 0.0, z_sub - z_top_i); + z_sub = z_top_i; // subparticle now has coordinates relative to z_top_i myparticle->translate(translation); // if subparticle is contained in this layer, set limits to infinite: