Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

CSG result is broken #319

Closed
nico opened this Issue · 1 comment

2 participants

@nico

Consider this file:

module cells() {
  r = sqrt(3 / (1 + 2*sqrt(5)/5) - 1);
  for (j = [0, 180]) rotate([0, j, 0])
    for (i = [4:4]) rotate([0, 0, i * 360 / 5])
      for (k = [0, 1])
        rotate([0, -atan(r) - 2*k*atan(r*cos(180/3)), 0])
        rotate([0, 0, 180*k])
        rotate([0, 0, 30])
        difference() {
          translate([0, 0, 0.001]) cylinder(1, 0, r/sqrt(3)+0.01, $fn=6);
          translate([0, 0, 0.3]) cylinder(1, 0, r/sqrt(3), $fn=6);
        }
}

difference() {
  sphere(1, center=true, $fn=20);
  cells();
}

It looks right, but if I change 4:4 to 0:4 (or even just 3:4), the difference as the bottom is rendered as a union instead. The output pane contains"WARNING: Normalized tree is growing past 4000 elements. Aborting normalization." when this happens (there are 80 elements with the input above).

Is the input invalid somehow?

@kintel
Owner

It's possible to increase the max. number of allowed CSG elements in Preferences->Advanced->Turn off rendering at NNN elements. As the number of elements increase, rendering speed goes down (for F5 only).

Explanation:
To be able to render an OpenCSG preview (F5) of this object, it's necessary to "unpack" all the differences into separate operations. This is called CSG normalization and is described in the paper at http://www.cc.gatech.edu/~turk/my_papers/pxpl_csg.pdf.

I've been wanting to write up some guidelines to "demystify" this process to make it easier to understand when and why some types of models render slowly with OpenCSG. I need to find a way of explaining it in a intuitive way though.

@kintel kintel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.