summaryrefslogtreecommitdiff
path: root/csgterm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'csgterm.cc')
-rw-r--r--csgterm.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/csgterm.cc b/csgterm.cc
index 826ec44..c1c6e14 100644
--- a/csgterm.cc
+++ b/csgterm.cc
@@ -164,3 +164,45 @@ QString CSGTerm::dump()
return QString("(%1 - %2)").arg(left->dump(), right->dump());
return label;
}
+
+CSGChain::CSGChain()
+{
+}
+
+void CSGChain::add(PolySet *polyset, CSGTerm::type_e type, QString label)
+{
+ polysets.append(polyset);
+ types.append(type);
+ labels.append(label);
+}
+
+void CSGChain::import(CSGTerm *term, CSGTerm::type_e type)
+{
+ if (term->type == CSGTerm::PRIMITIVE) {
+ add(term->polyset, type, term->label);
+ } else {
+ import(term->left, type);
+ import(term->right, term->type);
+ }
+}
+
+QString CSGChain::dump()
+{
+ QString text;
+ for (int i = 0; i < types.size(); i++)
+ {
+ if (types[i] == CSGTerm::UNION) {
+ if (i != 0)
+ text += "\n";
+ text += "+";
+ }
+ if (types[i] == CSGTerm::DIFFERENCE)
+ text += " -";
+ if (types[i] == CSGTerm::INTERSECTION)
+ text += " *";
+ text += labels[i];
+ }
+ text += "\n";
+ return text;
+}
+
contact: Jan Huwald // Impressum