OpenSCAD-QR icon indicating copy to clipboard operation
OpenSCAD-QR copied to clipboard

Tidy up interfaces between cubes

Open bovlb opened this issue 3 years ago • 0 comments

Small change to get rid of the annoying boundaries between cubes, especially when using negative QR.

module qr_render(data, module_size = 1, height = 1) {
    maxmod = len(data) - 1;
    epsilon = module_size * 0.001;
    union() {
        for(r = [0 : maxmod]) {
            for(c = [0 : maxmod]) {
                if(data[r][c] == 1){
                    xo = c * module_size;
                    yo = (maxmod - r) * module_size;
                    xs = module_size + ((c<maxmod && data[r][c+1] == 1) ? epsilon : 0); 
                    ys = module_size + ((r>0 && data[r-1][c] == 1) ? epsilon : 0); 
                    translate([xo, yo, 0]) cube([xs, ys, height]);
                }
            }
        }
    }
}

bovlb avatar Apr 12 '22 17:04 bovlb