From 29f2394ecbb6586965bf86e26e989b4e3f150329 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 10 Mar 2020 13:31:27 +0100 Subject: [PATCH] Fix faulty nfp edge cache with argument > 1.0 in reaction to #3781 --- src/libnest2d/include/libnest2d/placers/nfpplacer.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index e44e1dae1..91f04cb93 100644 --- a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -278,6 +278,8 @@ template class EdgeCache { inline Vertex coords(const ContourCache& cache, double distance) const { assert(distance >= .0 && distance <= 1.0); + if (cache.distances.empty() || cache.emap.empty()) return Vertex{}; + if (distance > 1.0) distance = std::fmod(distance, 1.0); // distance is from 0.0 to 1.0, we scale it up to the full length of // the circumference