From be78bdf5ff65118b5d4217d5888b8cceb104dd27 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 26 Apr 2022 15:08:06 +0200 Subject: [PATCH] Fix the issue with point skipping in svg export --- src/libslic3r/Format/SL1_SVG.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/Format/SL1_SVG.cpp b/src/libslic3r/Format/SL1_SVG.cpp index d138a72ba8..844385aece 100644 --- a/src/libslic3r/Format/SL1_SVG.cpp +++ b/src/libslic3r/Format/SL1_SVG.cpp @@ -84,15 +84,16 @@ void append_svg(std::string &buf, const Polygon &poly) buf += decimal_from(c.x(), intbuf); buf += " "sv; buf += decimal_from(c.y(), intbuf); - buf += " m"sv; + buf += " l "sv; - for (auto &p : poly) { - auto d = p - c; - if (d.squaredNorm() == 0) continue; + for (const Point &p : poly) { + Point d = p - c; + if (d.x() == 0 && d.y() == 0) + continue; buf += " "sv; buf += decimal_from(p.x() - c.x(), intbuf); buf += " "sv; - buf += decimal_from(p.y() - c.y(), intbuf); + buf += decimal_from(d.y(), intbuf); c = p; } buf += " z\""sv; // mark path as closed