diff --git a/Resample/Processed/Slicer.cpp b/Resample/Processed/Slicer.cpp index 9841a2b78dda051bdf1d912ebf1400299aa7743f..b3b1a5f0b554bf67bddf0f7e486576d8bf0f37dd 100644 --- a/Resample/Processed/Slicer.cpp +++ b/Resample/Processed/Slicer.cpp @@ -256,7 +256,23 @@ IReParticle* processBasis(const IParticle* basis, const Material& ambientMat) throw std::runtime_error("Mesocrystal with CoreAndShell basis not yet supported"); } // Remaining case: the basis is a single particle. - return Compute::Slicing::particlesInSlice(basis, {}, ambientMat).release_back(); + const auto* p = dynamic_cast<const Particle*>(basis); + ASSERT(p); + const IRotation* rot = p->rotation(); + auto particleSlice = std::make_unique<ReParticle>( + *p->pFormfactor(), new const R3(p->particlePosition()), + rot && !rot->isIdentity() ? std::move(new const RotMatrix(rot->rotMatrix())) : nullptr); + if (!particleSlice) + return {}; + double volume = particleSlice->volume(); + Material transformed_material(p->rotation() + ? p->material()->rotatedMaterial(p->rotation()->rotMatrix()) + : *p->material()); + particleSlice->setMaterial(transformed_material); + particleSlice->setAdmixedFraction(volume); + particleSlice->setAdmixedMaterial(transformed_material); + particleSlice->setAmbientMaterial(ambientMat); + return particleSlice.release(); } } // namespace