aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-02-06 15:36:27 +0100
committerjaseg <git@jaseg.de>2021-02-06 15:36:27 +0100
commit3bcbb29cf3d0397864a63f5b243de52f9c97c480 (patch)
treefad7b2ef4351ee5fc1dba55d478939dfc24486b0
parent3e323c953c1916b6d342f01e1a28916b86b692c9 (diff)
downloadgerbolyze-3bcbb29cf3d0397864a63f5b243de52f9c97c480.tar.gz
gerbolyze-3bcbb29cf3d0397864a63f5b243de52f9c97c480.tar.bz2
gerbolyze-3bcbb29cf3d0397864a63f5b243de52f9c97c480.zip
svg-flatten: Fix invalid export of negative gerber coordinates
-rw-r--r--svg-flatten/src/out_gerber.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/svg-flatten/src/out_gerber.cpp b/svg-flatten/src/out_gerber.cpp
index b32e6e4..f16a06b 100644
--- a/svg-flatten/src/out_gerber.cpp
+++ b/svg-flatten/src/out_gerber.cpp
@@ -78,15 +78,15 @@ SimpleGerberOutput& SimpleGerberOutput::operator<<(const Polygon &poly) {
double x = round((poly[0][0] * m_scale + m_offset[0]) * m_gerber_scale);
double y = round((m_height - poly[0][1] * m_scale + m_offset[1]) * m_gerber_scale);
m_out << "G36*" << endl;
- m_out << "X" << setw(m_digits_int + m_digits_frac) << setfill('0') << (long long int)x
- << "Y" << setw(m_digits_int + m_digits_frac) << setfill('0') << (long long int)y
+ m_out << "X" << setw(m_digits_int + m_digits_frac) << setfill('0') << std::internal /* isn't C++ a marvel of engineering? */ << (long long int)x
+ << "Y" << setw(m_digits_int + m_digits_frac) << setfill('0') << std::internal << (long long int)y
<< "D02*" << endl;
m_out << "G01*" << endl;
for (size_t i=1; i<poly.size(); i++) {
double x = round((poly[i][0] * m_scale + m_offset[0]) * m_gerber_scale);
double y = round((m_height - poly[i][1] * m_scale + m_offset[1]) * m_gerber_scale);
- m_out << "X" << setw(m_digits_int + m_digits_frac) << setfill('0') << (long long int)x
- << "Y" << setw(m_digits_int + m_digits_frac) << setfill('0') << (long long int)y
+ m_out << "X" << setw(m_digits_int + m_digits_frac) << setfill('0') << std::internal << (long long int)x
+ << "Y" << setw(m_digits_int + m_digits_frac) << setfill('0') << std::internal << (long long int)y
<< "D01*" << endl;
}
m_out << "G37*" << endl;