diff --git a/js/kiri-fill.js b/js/kiri-fill.js index 1161ed24..fd11acf9 100644 --- a/js/kiri-fill.js +++ b/js/kiri-fill.js @@ -18,7 +18,8 @@ var gs_kiri_fill = exports; hex: fillHexFull, grid: fillGrid, gyroid: fillGyroid, - triangle: fillTriangle + triangle: fillTriangle, + linear: fillLinear }; function fillHexFull(target) { @@ -148,6 +149,32 @@ var gs_kiri_fill = exports; } } + function fillLinear(target) { + let bounds = target.bounds(); + let height = target.zHeight(); + let span_x = bounds.max.x - bounds.min.x; + let span_y = bounds.max.y - bounds.min.y; + let density = target.density(); + let offset = target.offset() / 2; + let tile = 1 + (1 - density); + let tile_xc = span_x / tile; + let tile_yc = span_y / tile; + + if (target.zIndex() % 2 === 1) { + for (let tx=0; tx<=tile_xc; tx++) { + target.newline(); + target.emit(bounds.min.y, tx * tile + bounds.min.x); + target.emit(bounds.max.y, tx * tile + bounds.min.x); + } + } else { + for (let ty=0; ty<=tile_yc; ty++) { + target.newline(); + target.emit(ty * tile + bounds.min.y, bounds.min.x); + target.emit(ty * tile + bounds.min.y, bounds.max.x); + } + } + } + function fillTriangle(target) { let bounds = target.bounds(); let height = target.zHeight(); diff --git a/js/kiri-slice.js b/js/kiri-slice.js index b8b54d6c..45ba7c3e 100644 --- a/js/kiri-slice.js +++ b/js/kiri-slice.js @@ -709,9 +709,10 @@ let gs_kiri_slice = exports; scope._fill_finger = POLY.fingerprint(polys); + let skippable = type !== 'gyroid' && type !== 'linear'; let miss = false; // if the layer below has the same fingerprint, we may be able to clone its infill - if (scope.fingerprintSame(down)) { + if (skippable && scope.fingerprintSame(down)) { // the fill fingerprint can slightly different because of solid projections if (down._fill_finger && POLY.fingerprintCompare(scope._fill_finger, down._fill_finger)) { for (let i=0; i