Permalink
Browse files

Merge branch 'master' into stl_dim

Conflicts:
	src/mainwin.cc
  • Loading branch information...
2 parents 69e4e86 + 4ff2d1a commit ebe54c86a0d57d2acbd9887dbd085e678e484796 @kintel kintel committed Dec 26, 2011
Showing with 598 additions and 183 deletions.
  1. +2 −0 RELEASE_NOTES
  2. BIN doc/OpenSCAD-polygons.graffle
  3. BIN doc/OpenSCAD-polygons.pdf
  4. +4 −0 doc/TODO.txt
  5. +25 −20 openscad.pro
  6. +2 −2 src/CGALEvaluator.cc
  7. +7 −7 src/CSGTermEvaluator.cc
  8. +4 −4 src/PolySetCGALEvaluator.cc
  9. +2 −2 src/PolySetEvaluator.cc
  10. +8 −7 src/context.cc
  11. +141 −57 src/csgterm.cc
  12. +18 −6 src/csgterm.h
  13. +14 −0 src/dxfdata.cc
  14. +21 −8 src/export.cc
  15. +1 −1 src/glview.cc
  16. +27 −0 src/linalg.cc
  17. +2 −0 src/linalg.h
  18. +2 −2 src/mainwin.cc
  19. +14 −9 src/module.cc
  20. +39 −23 src/module.h
  21. +1 −1 src/node.cc
  22. +3 −1 src/node.h
  23. +4 −15 src/parser.y
  24. +11 −2 src/polyset.cc
  25. +2 −2 src/surface.cc
  26. +9 −0 testdata/scad/bugs/bbox-transform-bug.scad
  27. +1 −0 testdata/scad/features/color-tests.scad
  28. +6 −0 testdata/scad/features/render-2d-tests.scad
  29. +2 −0 testdata/scad/features/surface-simple.dat
  30. +1 −0 testdata/scad/features/surface-simple.scad
  31. +16 −0 testdata/scad/misc/normal-nan.scad
  32. +15 −1 tests/CMakeLists.txt
  33. +163 −0 tests/cgalstlsanitytest.cc
  34. +4 −6 tests/csgtestcore.cc
  35. BIN tests/regression/cgalpngtest/color-tests-expected.png
  36. BIN tests/regression/cgalpngtest/example010-expected.png
  37. BIN tests/regression/cgalpngtest/render-2d-tests-expected.png
  38. BIN tests/regression/cgalpngtest/sphere-tests-expected.png
  39. BIN tests/regression/cgalpngtest/surface-simple-expected.png
  40. 0 tests/regression/cgalstlsanitytest/normal-nan-expected.txt
  41. +9 −0 tests/regression/dumptest/color-tests-expected.txt
  42. +7 −0 tests/regression/dumptest/render-2d-tests-expected.txt
  43. +2 −0 tests/regression/dumptest/surface-simple-expected.txt
  44. BIN tests/regression/opencsgtest/bbox-transform-bug-expected.png
  45. BIN tests/regression/opencsgtest/render-2d-tests-expected.png
  46. BIN tests/regression/opencsgtest/surface-simple-expected.png
  47. BIN tests/regression/opencsgtest/transform-tests-expected.png
  48. BIN tests/regression/throwntogethertest/bbox-transform-bug-expected.png
  49. BIN tests/regression/throwntogethertest/difference-tests-expected.png
  50. BIN tests/regression/throwntogethertest/example010-expected.png
  51. BIN tests/regression/throwntogethertest/intersection_for-tests-expected.png
  52. BIN tests/regression/throwntogethertest/render-2d-tests-expected.png
  53. BIN tests/regression/throwntogethertest/surface-simple-expected.png
  54. BIN tests/regression/throwntogethertest/transform-tests-expected.png
  55. +1 −1 tests/test_cmdline_tool.py
  56. +8 −6 tests/test_pretty_print.py
View
@@ -21,6 +21,7 @@ o Added import and export of the OFF file format
o Now uses standard shortcuts for save, reload and quit on Linux and Windows. F2/F3 will still work but is deprecated.
Bugfixes:
+o Complex CSG models sometimes took extremely long time to normalize before OpenCSG preview
o square() crashed if any of the dimensions were zero
o Flush Caches didn't flush cached USE'd modules
o STL export should be a bit more robust
@@ -30,6 +31,7 @@ o Less crashes due to CGAL assertions
o OpenCSG should now work on systems with OpenGL 1.x, given that the right extensions are available
o include now searches librarydir
o The $fs parameter yielded only half the number of segments it should have
+o surface(center=true) is now correctly centered in the XY plane
Deprecations:
o dxf_linear_extrude() and dxf_rotate_extrude() are now deprecated.
Binary file not shown.
View
Binary file not shown.
View
@@ -98,6 +98,7 @@ o Error reporting/debugging
o Provide some interaction for debug walk-through?
- Provide visual highlighting of geometry corresponding to code
-> could aid debugging a lot
+ - Optionally output console log to a file
o Computation
- Run CGAL rendering in a background thread
- Enable viewing/editing while rendering
@@ -165,6 +166,9 @@ o Mesh optimization on STL export
- Remove super small triangles (all sides are short)
- Replace super thin triangles (one h is short)
o Misc
+ - center as default: Very often, center=true is used everywhere.
+ Make a global variable ($center?) control this to beautify code
+ and the avoid typical errors when forgetting to specify center
- Go through default values of parameters (e.g. cube() has x,y,z=1 while linear_extrude() has height=100)
- Add support for symbolic names to child() statement
- Add 'lines' object type for non-solid 2d drawings
View
@@ -188,20 +188,14 @@ HEADERS += src/renderer.h \
src/system-gl.h \
src/stl-utils.h
-SOURCES += src/openscad.cc \
- src/mainwin.cc \
+SOURCES += src/mathc99.cc \
+ src/linalg.cc \
src/handle_dep.cc \
- src/renderer.cc \
- src/rendersettings.cc \
- src/ThrownTogetherRenderer.cc \
- src/glview.cc \
- src/export.cc \
src/value.cc \
src/expr.cc \
src/func.cc \
src/module.cc \
src/node.cc \
- src/builtin.cc \
src/context.cc \
src/csgterm.cc \
src/polyset.cc \
@@ -214,28 +208,39 @@ SOURCES += src/openscad.cc \
src/surface.cc \
src/control.cc \
src/render.cc \
- src/import.cc \
src/dxfdata.cc \
- src/dxftess.cc \
- src/dxftess-glu.cc \
- src/dxftess-cgal.cc \
src/dxfdim.cc \
src/stldim.cc \
src/linearextrude.cc \
src/rotateextrude.cc \
- src/highlighter.cc \
src/printutils.cc \
+ src/progress.cc \
+ \
+ src/nodedumper.cc \
+ src/traverser.cc \
+ src/PolySetEvaluator.cc \
+ src/PolySetCache.cc \
+ src/Tree.cc \
+ \
+ src/rendersettings.cc \
+ src/highlighter.cc \
src/Preferences.cc \
src/OpenCSGWarningDialog.cc \
- src/progress.cc \
src/editor.cc \
- src/traverser.cc \
- src/nodedumper.cc \
+ src/glview.cc \
+ \
+ src/builtin.cc \
+ src/export.cc \
+ src/import.cc \
+ src/renderer.cc \
+ src/ThrownTogetherRenderer.cc \
+ src/dxftess.cc \
+ src/dxftess-glu.cc \
+ src/dxftess-cgal.cc \
src/CSGTermEvaluator.cc \
- src/Tree.cc \
- src/mathc99.cc \
- src/PolySetCache.cc \
- src/PolySetEvaluator.cc
+ \
+ src/openscad.cc \
+ src/mainwin.cc
opencsg {
HEADERS += src/OpenCSGRenderer.h
View
@@ -99,7 +99,7 @@ CGAL_Nef_polyhedron CGALEvaluator::applyToChildren(const AbstractNode &node, CGA
const AbstractNode *chnode = item.first;
const CGAL_Nef_polyhedron &chN = item.second;
// FIXME: Don't use deep access to modinst members
- if (chnode->modinst->tag_background) continue;
+ if (chnode->modinst->isBackground()) continue;
// NB! We insert into the cache here to ensure that all children of
// a node is a valid object. If we inserted as we created them, the
@@ -127,7 +127,7 @@ CGAL_Nef_polyhedron CGALEvaluator::applyHull(const CgaladvNode &node)
const AbstractNode *chnode = item.first;
const CGAL_Nef_polyhedron &chN = item.second;
// FIXME: Don't use deep access to modinst members
- if (chnode->modinst->tag_background) continue;
+ if (chnode->modinst->isBackground()) continue;
if (dim == 0) {
dim = chN.dim;
}
View
@@ -48,18 +48,18 @@ void CSGTermEvaluator::applyToChildren(const AbstractNode &node, CSGTermEvaluato
t1 = t2;
} else if (t2 && t1) {
if (op == CSGT_UNION) {
- t1.reset(new CSGTerm(CSGTerm::TYPE_UNION, t1, t2));
+ t1 = CSGTerm::createCSGTerm(CSGTerm::TYPE_UNION, t1, t2);
} else if (op == CSGT_DIFFERENCE) {
- t1.reset(new CSGTerm(CSGTerm::TYPE_DIFFERENCE, t1, t2));
+ t1 = CSGTerm::createCSGTerm(CSGTerm::TYPE_DIFFERENCE, t1, t2);
} else if (op == CSGT_INTERSECTION) {
- t1.reset(new CSGTerm(CSGTerm::TYPE_INTERSECTION, t1, t2));
+ t1 = CSGTerm::createCSGTerm(CSGTerm::TYPE_INTERSECTION, t1, t2);
}
}
}
- if (t1 && node.modinst->tag_highlight) {
+ if (t1 && node.modinst->isHighlight()) {
this->highlights.push_back(t1);
}
- if (t1 && node.modinst->tag_background) {
+ if (t1 && node.modinst->isBackground()) {
this->background.push_back(t1);
t1.reset(); // don't propagate background tagged nodes
}
@@ -94,10 +94,10 @@ static shared_ptr<CSGTerm> evaluate_csg_term_from_ps(const State &state,
std::stringstream stream;
stream << node.name() << node.index();
shared_ptr<CSGTerm> t(new CSGTerm(ps, state.matrix(), state.color(), stream.str()));
- if (modinst->tag_highlight) {
+ if (modinst->isHighlight()) {
highlights.push_back(t);
}
- if (modinst->tag_background) {
+ if (modinst->isBackground()) {
background.push_back(t);
t.reset();
}
@@ -26,7 +26,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
// Before projecting, union all children
CGAL_Nef_polyhedron sum;
BOOST_FOREACH (AbstractNode * v, node.getChildren()) {
- if (v->modinst->tag_background) continue;
+ if (v->modinst->isBackground()) continue;
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v);
if (N.dim == 3) {
if (sum.empty()) sum = N.copy();
@@ -259,7 +259,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node)
// to a single DxfData, then tesselate this into a PolySet
CGAL_Nef_polyhedron sum;
BOOST_FOREACH (AbstractNode * v, node.getChildren()) {
- if (v->modinst->tag_background) continue;
+ if (v->modinst->isBackground()) continue;
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v);
if (N.dim != 2) {
PRINT("ERROR: linear_extrude() is not defined for 3D child objects!");
@@ -357,7 +357,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RotateExtrudeNode &node)
// to a single DxfData, then tesselate this into a PolySet
CGAL_Nef_polyhedron sum;
BOOST_FOREACH (AbstractNode * v, node.getChildren()) {
- if (v->modinst->tag_background) continue;
+ if (v->modinst->isBackground()) continue;
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v);
if (N.dim != 2) {
PRINT("ERROR: rotate_extrude() is not defined for 3D child objects!");
@@ -396,7 +396,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node)
CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(node);
PolySet *ps = NULL;
if (!N.empty()) {
- if (!N.p3->is_simple()) {
+ if (N.dim == 3 && !N.p3->is_simple()) {
PRINTF("WARNING: Body of render() isn't valid 2-manifold!");
}
else {
View
@@ -7,8 +7,8 @@
/*!
The task of PolySetEvaluator is to create, keep track of and cache PolySet instances.
- All instances of PolySet which are not strictly temporary should be requested through this
- class.
+ All instances of PolySet which are not strictly temporary should be
+ requested through this class.
*/
/*!
View
@@ -45,6 +45,7 @@ Context::Context(const Context *parent, const Module *library)
ctx_stack.push_back(this);
if (parent) document_path = parent->document_path;
if (library) {
+ // FIXME: Don't access module members directly
this->functions_p = &library->functions;
this->modules_p = &library->modules;
this->usedlibs_p = &library->usedlibs;
@@ -148,24 +149,24 @@ Value Context::evaluate_function(const std::string &name,
AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const
{
- if (this->modules_p && this->modules_p->find(inst.modname) != this->modules_p->end()) {
- AbstractModule *m = this->modules_p->find(inst.modname)->second;
- std::string replacement = Builtins::instance()->isDeprecated(inst.modname);
+ if (this->modules_p && this->modules_p->find(inst.name()) != this->modules_p->end()) {
+ AbstractModule *m = this->modules_p->find(inst.name())->second;
+ std::string replacement = Builtins::instance()->isDeprecated(inst.name());
if (!replacement.empty()) {
- PRINTF("DEPRECATED: The %s() module will be removed in future releases. Use %s() instead.", inst.modname.c_str(), replacement.c_str());
+ PRINTF("DEPRECATED: The %s() module will be removed in future releases. Use %s() instead.", inst.name().c_str(), replacement.c_str());
}
return m->evaluate(this, &inst);
}
if (this->usedlibs_p) {
BOOST_FOREACH(const ModuleContainer::value_type &m, *this->usedlibs_p) {
- if (m.second->modules.find(inst.modname) != m.second->modules.end()) {
+ if (m.second->modules.find(inst.name()) != m.second->modules.end()) {
Context ctx(this->parent, m.second);
- return m.second->modules[inst.modname]->evaluate(&ctx, &inst);
+ return m.second->modules[inst.name()]->evaluate(&ctx, &inst);
}
}
}
if (this->parent) return this->parent->evaluate_module(inst);
- PRINTF("WARNING: Ignoring unknown module '%s'.", inst.modname.c_str());
+ PRINTF("WARNING: Ignoring unknown module '%s'.", inst.name().c_str());
return NULL;
}
Oops, something went wrong.

0 comments on commit ebe54c8

Please sign in to comment.