Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2020-03-10 15:31:27 +0300
committertamasmeszaros <meszaros.q@gmail.com>2020-03-12 12:45:35 +0300
commit29f2394ecbb6586965bf86e26e989b4e3f150329 (patch)
tree7ebb79af69939c3bae4d945af36e5db79ec0b258 /src/libnest2d
parent84c9136e2d990b2079890b66fd88568f29dbf859 (diff)
Fix faulty nfp edge cache with argument > 1.0
in reaction to #3781
Diffstat (limited to 'src/libnest2d')
-rw-r--r--src/libnest2d/include/libnest2d/placers/nfpplacer.hpp2
1 files changed, 2 insertions, 0 deletions
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 RawShape> 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