diff options
Diffstat (limited to 'src/csgterm.cc')
-rw-r--r-- | src/csgterm.cc | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/csgterm.cc b/src/csgterm.cc index 6dd3bd5..411cb12 100644 --- a/src/csgterm.cc +++ b/src/csgterm.cc @@ -27,7 +27,26 @@ #include "csgterm.h" #include "polyset.h" -CSGTerm::CSGTerm(PolySet *polyset, double m[20], QString label) +/*! + \class CSGTerm + + A CSGTerm is either a "primitive" or a CSG operation with two + children terms. A primitive in this context is any PolySet, which + may or may not have a subtree which is already evaluated (e.g. using + the render() module). + + */ + +/*! + \class CSGChain + + A CSGChain is just a vector of primitives, each having a CSG type associated with it. + It's created by importing a CSGTerm tree. + + */ + + +CSGTerm::CSGTerm(PolySet *polyset, const double m[20], QString label) { this->type = TYPE_PRIMITIVE; this->polyset = polyset; @@ -200,9 +219,9 @@ QString CSGChain::dump() text += "\n"; text += "+"; } - if (types[i] == CSGTerm::TYPE_DIFFERENCE) + else if (types[i] == CSGTerm::TYPE_DIFFERENCE) text += " -"; - if (types[i] == CSGTerm::TYPE_INTERSECTION) + else if (types[i] == CSGTerm::TYPE_INTERSECTION) text += " *"; text += labels[i]; } @@ -210,3 +229,13 @@ QString CSGChain::dump() return text; } +BoundingBox CSGChain::getBoundingBox() const +{ + BoundingBox bbox; + for (size_t i=0;i<polysets.size();i++) { + if (types[i] != CSGTerm::TYPE_DIFFERENCE) { + bbox.extend(polysets[i]->getBoundingBox()); + } + } + return bbox; +} |