Skip to content

Instantly share code, notes, and snippets.

@Octogonapus
Last active January 3, 2018 19:35
Show Gist options
  • Save Octogonapus/42af2cc3fa44c8549b494a1ea94e56f1 to your computer and use it in GitHub Desktop.
Save Octogonapus/42af2cc3fa44c8549b494a1ea94e56f1 to your computer and use it in GitHub Desktop.
structure synth test
/*
Source Structure Synth code:
R1
set maxdepth 25
rule R1 {
{ x 0.5 rx 10 s 0.95 } R1;
{ s 5 } box;
}
*/
CSG getPyramid(depth, theCube) {
if (depth == 0) {
return theCube
}
return getPyramid(depth - 1,
theCube.union(theCube.movez(5).rotz(10).scale(0.95)))
}
/*
Source Structure Synth code:
#define angle 2
set maxdepth 100
set background black
18 * { rx 3 x 1 sat 0.9 } R
rule R { R1 }
rule R1 {
{ x 1 rz 15 ry 45 rz 1.2 hue 1 a 0.99 } R1
{ s 1 1 1 } sbox
}
rule sbox {
{ color black } grid
{ b 0.8 hue 67 } box
}
*/
CSG getWave(depth, wave) {
if (depth == 0) {
return wave
}
return getWave(depth - 1, wave.union(wave.movez(5).rotz(15).roty(45).rotz(1.2)))
}
// return getPyramid(25, new Cube(50, 50, 50).toCSG())
return getWave(100, new Cube(20, 20, 20).toCSG())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment