diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-07-03 07:51:22 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-07-03 07:51:22 (GMT) |
commit | cb6dbb3a37602a9113b970477fdffc827e239baa (patch) | |
tree | d1df82ebfa09ed529de1e1a6abb336586f008160 /primitives.cc | |
parent | 5c239e7868842195189c9c5782ba8a07c948f1e5 (diff) |
Clifford Wolf:
Added caching of cgal nef polyhydrons
git-svn-id: http://svn.clifford.at/openscad/trunk@49 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'primitives.cc')
-rw-r--r-- | primitives.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/primitives.cc b/primitives.cc index 4494b03..a2ca971 100644 --- a/primitives.cc +++ b/primitives.cc @@ -326,13 +326,16 @@ sphere_next_r2: QString PrimitiveNode::dump(QString indent) const { - QString text; - if (type == CUBE) - text.sprintf("cube(size = [%f %f %f], center = %s);\n", x, y, z, center ? "true" : "false"); - if (type == SPHERE) - text.sprintf("sphere(r = %f);\n", r1); - if (type == CYLINDER) - text.sprintf("cylinder(h = %f, r1 = %f, r2 = %f, center = %s);\n", h, r1, r2, center ? "true" : "false"); - return indent + QString("n%1: ").arg(idx) + text; + 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"); + if (type == SPHERE) + text.sprintf("sphere($fn = %f, $fa = %f, $fs = %f, r = %f);\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"); + ((AbstractNode*)this)->dump_cache = indent + QString("n%1: ").arg(idx) + text; + } + return dump_cache; } |