Skip to content

Commit

Permalink
Add sketch, expose a couple more ops
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimmons committed Jan 18, 2019
1 parent ac6a2ca commit 8f686a8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ const ops = {
}
},

fillBox,
makeHollowShell,

randomBox: (scene, val) => {
fillBox(scene, randVec(scene), randVec(scene), val);
},
Expand Down Expand Up @@ -162,9 +165,7 @@ const ops = {
}
},

worm: (scene, startVec, size, moveRepeat, kind) => {
worm(scene, startVec, size, moveRepeat, kind);
}
worm,
};

module.exports = {
Expand Down
26 changes: 26 additions & 0 deletions sketches/sketch020.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const {makeSketch} = require('./util');

makeSketch({x: 128, y: 128, z: 128}, {padFrac: 0.1}, (scene, ops) => {
/*
for (let i = 0; i < 256; i++) {
ops.randomShell(scene, 1);
}
const IN = 32;
ops.predicateFill(scene, 0, (x, y, z) => ((x < IN) || (y < IN) || (x >= (scene.size.x-IN)) || (y >= (scene.size.y-IN)) || (z >= 32)));
*/

ops.makeHollowShell(scene, {x: 0, y: 0, z: 0}, {x: scene.size.x, y: scene.size.y, z: 8}, 1);
ops.predicateFill(scene, 0, (x, y, z) => ((y % 16) < 6));

for (let i = 0; i < 128; i++) {
ops.worm(scene, {x: 64, y: 64, z: 64}, 1+Math.floor(3*Math.random()), 2+Math.floor(2*Math.random()));
}

const RAD = 6;
ops.makeHollowShell(scene, {x: 64-RAD, y: 64-RAD, z: 0}, {x: 64+RAD, y: 64+RAD, z: 128}, 1);

// ops.predicateFill(scene, 0, (x, y, z) => ((x % 16) < 4));
// ops.predicateFill(scene, 0, (x, y, z) => ((z % 16) < 4));

ops.frontCutaway(scene, 0.5);
});

0 comments on commit 8f686a8

Please sign in to comment.