diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 6a99d3f15f..e6c39a772d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -835,7 +835,8 @@ static std::vector get_path_of_change_filament(const Print& print) std::string gcode_out; std::string line; Vec2f pos = tcr.start_pos; - Vec2f transformed_pos = pos; + auto trans_pos = [wt_rot = Eigen::Rotation2Df(angle), &translation](const Vec2f& p) -> Vec2f { return wt_rot * p + translation; }; + Vec2f transformed_pos = trans_pos(pos); Vec2f old_pos(-1000.1f, -1000.1f); while (gcode_str) { @@ -863,7 +864,7 @@ static std::vector get_path_of_change_filament(const Print& print) line_out << ch; } - transformed_pos = Eigen::Rotation2Df(angle) * pos + translation; + transformed_pos = trans_pos(pos); if (transformed_pos != old_pos || never_skip) { line = line_out.str();