From f97f0258a4c0f5876e3c02c5b46bfcf713c1e8b5 Mon Sep 17 00:00:00 2001 From: kintel Date: Fri, 15 Jan 2010 18:36:53 +0000 Subject: [PATCH] Make CSG tree dumps more readable git-svn-id: http://svn.clifford.at/openscad/trunk@320 b57f626f-c46c-0410-a088-ec61d464b74c --- dxflinextrude.cc | 6 +++--- dxfrotextrude.cc | 4 ++-- import.cc | 4 ++-- primitives.cc | 10 +++++----- transform.cc | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dxflinextrude.cc b/dxflinextrude.cc index 740bb1f0..7e0c2c6b 100644 --- a/dxflinextrude.cc +++ b/dxflinextrude.cc @@ -305,17 +305,17 @@ QString DxfLinearExtrudeNode::dump(QString indent) const memset(&st, 0, sizeof(struct stat)); stat(filename.toAscii().data(), &st); text.sprintf("linear_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", " - "height = %f, origin = [ %f %f ], scale = %f, center = %s, convexity = %d", + "height = %g, origin = [ %g %g ], scale = %g, center = %s, convexity = %d", filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, layername.toAscii().data(), height, origin_x, origin_y, scale, center ? "true" : "false", convexity); if (has_twist) { QString t2; - t2.sprintf(", twist = %f, slices = %d", twist, slices); + t2.sprintf(", twist = %g, slices = %d", twist, slices); text += t2; } QString t3; - t3.sprintf(", $fn = %f, $fa = %f, $fs = %f) {\n", fn, fs, fa); + t3.sprintf(", $fn = %g, $fa = %g, $fs = %g) {\n", fn, fs, fa); text += t3; foreach (AbstractNode *v, children) text += v->dump(indent + QString("\t")); diff --git a/dxfrotextrude.cc b/dxfrotextrude.cc index c08577bb..427bcb09 100644 --- a/dxfrotextrude.cc +++ b/dxfrotextrude.cc @@ -236,8 +236,8 @@ QString DxfRotateExtrudeNode::dump(QString indent) const memset(&st, 0, sizeof(struct stat)); stat(filename.toAscii().data(), &st); text.sprintf("rotate_extrude(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", " - "origin = [ %f %f ], scale = %f, convexity = %d, " - "$fn = %f, $fa = %f, $fs = %f) {\n", + "origin = [ %g %g ], scale = %g, convexity = %d, " + "$fn = %g, $fa = %g, $fs = %g) {\n", filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, layername.toAscii().data(), origin_x, origin_y, scale, convexity, fn, fs, fa); diff --git a/import.cc b/import.cc index 88fae835..c9b1a66d 100644 --- a/import.cc +++ b/import.cc @@ -211,8 +211,8 @@ QString ImportNode::dump(QString indent) const filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, convexity); if (type == TYPE_DXF) text.sprintf("import_dxf(file = \"%s\", cache = \"%x.%x\", layer = \"%s\", " - "origin = [ %f %f ], scale = %f, convexity = %d, " - "$fn = %f, $fa = %f, $fs = %f);\n", + "origin = [ %g %g ], scale = %g, convexity = %d, " + "$fn = %g, $fa = %g, $fs = %g);\n", filename.toAscii().data(), (int)st.st_mtime, (int)st.st_size, layername.toAscii().data(), origin_x, origin_y, scale, convexity, fn, fs, fa); diff --git a/primitives.cc b/primitives.cc index 95bd3b80..2f50578d 100644 --- a/primitives.cc +++ b/primitives.cc @@ -509,17 +509,17 @@ QString PrimitiveNode::dump(QString indent) const if (dump_cache.isEmpty()) { QString text; if (type == CUBE) - text.sprintf("cube(size = [%f, %f, %f], center = %s);\n", x, y, z, center ? "true" : "false"); + text.sprintf("cube(size = [%g, %g, %g], center = %s);\n", x, y, z, center ? "true" : "false"); if (type == SPHERE) - text.sprintf("sphere($fn = %f, $fa = %f, $fs = %f, r = %f);\n", fn, fa, fs, r1); + text.sprintf("sphere($fn = %g, $fa = %g, $fs = %g, r = %g);\n", fn, fa, fs, r1); if (type == CYLINDER) - text.sprintf("cylinder($fn = %f, $fa = %f, $fs = %f, h = %f, r1 = %f, r2 = %f, center = %s);\n", fn, fa, fs, h, r1, r2, center ? "true" : "false"); + text.sprintf("cylinder($fn = %g, $fa = %g, $fs = %g, h = %g, r1 = %g, r2 = %g, center = %s);\n", fn, fa, fs, h, r1, r2, center ? "true" : "false"); if (type == POLYHEDRON) text.sprintf("polyhedron(points = %s, triangles = %s, convexity = %d);\n", points.dump().toAscii().data(), triangles.dump().toAscii().data(), convexity); if (type == SQUARE) - text.sprintf("square(size = [%f, %f], center = %s);\n", x, y, center ? "true" : "false"); + text.sprintf("square(size = [%g, %g], center = %s);\n", x, y, center ? "true" : "false"); if (type == CIRCLE) - text.sprintf("circle($fn = %f, $fa = %f, $fs = %f, r = %f);\n", fn, fa, fs, r1); + text.sprintf("circle($fn = %g, $fa = %g, $fs = %g, r = %g);\n", fn, fa, fs, r1); if (type == POLYGON) text.sprintf("polygon(points = %s, paths = %s, convexity = %d);\n", points.dump().toAscii().data(), paths.dump().toAscii().data(), convexity); ((AbstractNode*)this)->dump_cache = indent + QString("n%1: ").arg(idx) + text; diff --git a/transform.cc b/transform.cc index 5d85615c..ecbfcc2c 100644 --- a/transform.cc +++ b/transform.cc @@ -340,11 +340,11 @@ QString TransformNode::dump(QString indent) const if (dump_cache.isEmpty()) { QString text; if (m[16] >= 0 || m[17] >= 0 || m[18] >= 0 || m[19] >= 0) - text.sprintf("n%d: color([%f, %f, %f, %f])", idx, + text.sprintf("n%d: color([%g, %g, %g, %g])", idx, m[16], m[17], m[18], m[19]); else - text.sprintf("n%d: multmatrix([[%f, %f, %f, %f], [%f, %f, %f, %f], " - "[%f, %f, %f, %f], [%f, %f, %f, %f]])", idx, + text.sprintf("n%d: multmatrix([[%g, %g, %g, %g], [%g, %g, %g, %g], " + "[%g, %g, %g, %g], [%g, %g, %g, %g]])", idx, m[0], m[4], m[ 8], m[12], m[1], m[5], m[ 9], m[13], m[2], m[6], m[10], m[14],