Clifford Wolf:

Added missing "N.dim != 0" checks as needed e.g. for "if (false);" child nodes
	(fixes bug reported by Andrew Plumb)



git-svn-id: http://svn.clifford.at/openscad/trunk@204 b57f626f-c46c-0410-a088-ec61d464b74c
stl_dim
clifford 2010-01-05 20:38:33 +00:00
parent a02e00083f
commit 966eb8f55e
4 changed files with 12 additions and 8 deletions

View File

@ -76,7 +76,8 @@ CGAL_Nef_polyhedron CsgNode::render_cgal_nef_polyhedron() const
continue;
if (first) {
N = v->render_cgal_nef_polyhedron();
first = false;
if (N.dim != 0)
first = false;
} else if (N.dim == 2) {
if (type == CSG_TYPE_UNION) {
N.p2 += v->render_cgal_nef_polyhedron().p2;

View File

@ -241,14 +241,16 @@ static CGAL_Nef_polyhedron render_cgal_nef_polyhedron_backend(const AbstractNode
return *that->cgal_nef_cache[cache_id];
}
bool is_first = true;
bool first = true;
CGAL_Nef_polyhedron N;
foreach (AbstractNode *v, that->children) {
if (v->modinst->tag_background)
continue;
if (is_first)
if (first) {
N = v->render_cgal_nef_polyhedron();
else if (N.dim == 2) {
if (N.dim != 0)
first = false;
} else if (N.dim == 2) {
if (intersect)
N.p2 *= v->render_cgal_nef_polyhedron().p2;
else
@ -259,7 +261,6 @@ static CGAL_Nef_polyhedron render_cgal_nef_polyhedron_backend(const AbstractNode
else
N.p3 += v->render_cgal_nef_polyhedron().p3;
}
is_first = false;
}
that->cgal_nef_cache.insert(cache_id, new CGAL_Nef_polyhedron(N), N.weight());

View File

@ -92,7 +92,8 @@ CGAL_Nef_polyhedron RenderNode::render_cgal_nef_polyhedron() const
continue;
if (first) {
N = v->render_cgal_nef_polyhedron();
first = false;
if (N.dim != 0)
first = false;
} else if (N.dim == 2) {
N.p2 += v->render_cgal_nef_polyhedron().p2;
} else if (N.dim == 3) {

View File

@ -200,7 +200,8 @@ CGAL_Nef_polyhedron TransformNode::render_cgal_nef_polyhedron() const
continue;
if (first) {
N = v->render_cgal_nef_polyhedron();
first = false;
if (N.dim != 0)
first = false;
} else if (N.dim == 2) {
N.p2 += v->render_cgal_nef_polyhedron().p2;
} else if (N.dim == 3) {
@ -284,7 +285,7 @@ QString TransformNode::dump(QString indent) const
{
if (dump_cache.isEmpty()) {
QString text;
text.sprintf("n%d: multmatrix([[%f %f %f %f], [%f %f %f %f], [%f %f %f %f], [%f %f %f %f]])", idx,
text.sprintf("n%d: multmatrix([[%f, %f, %f, %f], [%f, %f, %f, %f], [%f, %f, %f, %f], [%f, %f, %f, %f]])", idx,
m[0], m[4], m[ 8], m[12],
m[1], m[5], m[ 9], m[13],
m[2], m[6], m[10], m[14],