diff options
author | Marius Kintel <marius@kintel.net> | 2011-12-26 18:15:51 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-12-26 18:15:51 (GMT) |
commit | bc3454f369a21cd689f42f5e9ec5cb316f9ebdd5 (patch) | |
tree | 9794056684d42b7dd4b955160c6e83fa694e0729 /tests/csgtestcore.cc | |
parent | 9e6cc9cebbfd5007a5fa9afabf57476676357193 (diff) |
Refactored normalization into a separate class, hard-limited normalization to stop at 5000 nodes to keep from normalizing 'forever'
Diffstat (limited to 'tests/csgtestcore.cc')
-rw-r--r-- | tests/csgtestcore.cc | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index c2be326..e8a6878 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -19,6 +19,7 @@ #include "ThrownTogetherRenderer.h" #include "csgterm.h" +#include "csgtermnormalizer.h" #include "OffscreenView.h" #include <QApplication> @@ -315,12 +316,8 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } // CSG normalization - csgInfo.root_norm_term = root_raw_term; - while (1) { - shared_ptr<CSGTerm> n = CSGTerm::normalize(csgInfo.root_norm_term); - if (csgInfo.root_norm_term == n) break; - csgInfo.root_norm_term = n; - } + CSGTermNormalizer normalizer; + csgInfo.root_norm_term = normalizer.normalize(root_raw_term); assert(csgInfo.root_norm_term); @@ -333,11 +330,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) csgInfo.highlights_chain = new CSGChain(); for (unsigned int i = 0; i < csgInfo.highlight_terms.size(); i++) { - while (1) { - shared_ptr<CSGTerm> n = CSGTerm::normalize(csgInfo.highlight_terms[i]); - if (csgInfo.highlight_terms[i] == n) break; - csgInfo.highlight_terms[i] = n; - } + csgInfo.highlight_terms[i] = normalizer.normalize(csgInfo.highlight_terms[i]); csgInfo.highlights_chain->import(csgInfo.highlight_terms[i]); } } @@ -347,11 +340,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) csgInfo.background_chain = new CSGChain(); for (unsigned int i = 0; i < csgInfo.background_terms.size(); i++) { - while (1) { - shared_ptr<CSGTerm> n = CSGTerm::normalize(csgInfo.background_terms[i]); - if (csgInfo.background_terms[i] == n) break; - csgInfo.background_terms[i] = n; - } + csgInfo.background_terms[i] = normalizer.normalize(csgInfo.background_terms[i]); csgInfo.background_chain->import(csgInfo.background_terms[i]); } } |