Created
April 10, 2018 21:10
-
-
Save bddap/53a9e355b2bc62c7914aaaeec397620a to your computer and use it in GitHub Desktop.
for printing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const len = 200; // length of longest resonator | |
const count = 8; | |
const irr = (Math.sqrt(5) + 1) / 2; // a very irrational number | |
const s = 1 / irr; // length ratio between largest and smallest resonator | |
function main() { | |
return Array(count).fill(0) | |
.map((_, i) => resonator(Math.pow(s, i / (count - 1)))) | |
.reduce(combine); | |
} | |
function resonator(length) { | |
return cube({ | |
center: [1, 1, 0] | |
}).scale([length, 0.04, 0.005]) | |
.scale(len) | |
} | |
function combine(a, b) { | |
return union( | |
a.rotateZ(180 / count), | |
b | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment