summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.txt1
-rw-r--r--primitives.cc14
2 files changed, 10 insertions, 5 deletions
diff --git a/TODO.txt b/TODO.txt
index bfcf775..8f4dbc4 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -5,7 +5,6 @@ o Some invalid DXF data gets pass the import checks and breaks the tessing code
o Broken polyhedron() entities are not correctly detected and cause CGAL segfaults
o Tesselation via GLU sometimes produces strange results
o Non-manifold objects make CGAL crash (e.g. two cubes which touch at one edge)
-o crash: polygon(paths=[[0,0],[10,0],[0,10]])
o crash: rotate([0,1,0])import_dxf("../openscad-tess/testdata/polygon.dxf");
USER INTERFACE
diff --git a/primitives.cc b/primitives.cc
index 7e6a9e1..95bd3b8 100644
--- a/primitives.cc
+++ b/primitives.cc
@@ -481,11 +481,17 @@ sphere_next_r2:
dd.paths.append(DxfData::Path());
for (int j=0; j<paths.vec[i]->vec.size(); j++) {
int idx = paths.vec[i]->vec[j]->num;
- DxfData::Point *p = &dd.points[idx];
- dd.paths.last().points.append(p);
+ if (idx < dd.points.size()) {
+ DxfData::Point *p = &dd.points[idx];
+ dd.paths.last().points.append(p);
+ }
+ }
+ if (dd.paths.last().points.isEmpty()) {
+ dd.paths.removeLast();
+ } else {
+ dd.paths.last().points.append(dd.paths.last().points.first());
+ dd.paths.last().is_closed = true;
}
- dd.paths.last().points.append(dd.paths.last().points.first());
- dd.paths.last().is_closed = true;
}
}
contact: Jan Huwald // Impressum