ituethoslab / make_a_data_object

Make a data object
GNU General Public License v3.0
2 stars 1 forks source link

Find a faster solution for building the complement object #11

Open xmacex opened 6 years ago

xmacex commented 6 years ago

This OpenSCAD program takes about 35 minutes to render on my MBA for an object of size 250. That's ridiculous.

datafile = "alpha_sweep-250-2.dat";
size = 250;

scale(0.2) {
    rotate([180, 0, 0]) {
        translate([0, -size, -size + size - 150]) {
            difference() {
                translate([0.01, 0.01, 0.01]) {
                    cube([size - 2, size - 2, size]);
                }
                surface(file = datafile, convexity = true);
                translate([0, 0, 150]) {
                    cube([size, size, size]);
                }
            }
        }
    }
}

Here's some performance measures, with the object size on x and render time in seconds on the y. I have a Notebook about it.

rendertimes

The obvious solution is of course to just flip the DataObject.surface and do the necessary minus, rotation and flipping operations in Python, and do none of these 3D operations.

PS. maybe it shouldn't be conceptualized as "the inverse", but "the complement" instead.