diff options
author | Marius Kintel <marius@kintel.net> | 2013-02-04 17:29:00 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-02-04 17:29:00 (GMT) |
commit | 3f7037b5242eed0175ca2c9780d7d02bd6943959 (patch) | |
tree | 37423c5d8c3a1d99642f8c73f99c98dac254f9f1 /src/csgtermnormalizer.cc | |
parent | d2d22503eb0e9b5cfe3846562aa84af18a044907 (diff) |
bugfix: We didn't always print a warning when CSG normalization created too many elements
Diffstat (limited to 'src/csgtermnormalizer.cc')
-rw-r--r-- | src/csgtermnormalizer.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc index 81fab80..461e965 100644 --- a/src/csgtermnormalizer.cc +++ b/src/csgtermnormalizer.cc @@ -7,6 +7,7 @@ */ shared_ptr<CSGTerm> CSGTermNormalizer::normalize(const shared_ptr<CSGTerm> &root) { + this->aborted = false; shared_ptr<CSGTerm> temp = root; while (1) { this->rootnode = temp; @@ -49,14 +50,16 @@ shared_ptr<CSGTerm> CSGTermNormalizer::normalizePass(shared_ptr<CSGTerm> term) while (term && match_and_replace(term)) { } this->nodecount++; if (nodecount > this->limit) { + PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", this->limit); + this->aborted = true; return shared_ptr<CSGTerm>(); } if (!term || term->type == CSGTerm::TYPE_PRIMITIVE) return term; if (term->left) term->left = normalizePass(term->left); - } while (term->type != CSGTerm::TYPE_UNION && + } while (!this->aborted && term->type != CSGTerm::TYPE_UNION && ((term->right && term->right->type != CSGTerm::TYPE_PRIMITIVE) || (term->left && term->left->type == CSGTerm::TYPE_UNION))); - term->right = normalizePass(term->right); + if (!this->aborted) term->right = normalizePass(term->right); // FIXME: Do we need to take into account any transformation of item here? return collapse_null_terms(term); |