Created
December 22, 2018 17:03
-
-
Save sebastien/f439b05a9c46f92207bc3233a7cb2a17 to your computer and use it in GitHub Desktop.
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
// Triangle study | |
// Ref: https://otakugangsta.com/image/180451216975 | |
let | |
w = 28; | |
h = 34; | |
black = (0.016, 0.031, 0.027); | |
// NOTE: Here we need to add an EPSILON otherwise the polygon | |
// drawing will fail. | |
prel (a,b,k) = | |
if (k ==a) 0.0000001 | |
else (k - a) / (b - a); | |
in | |
union [ | |
for (x in 0..3) | |
union [ | |
for (y in 0..10) | |
let | |
k = prel(10,0,y); | |
in | |
let | |
dx = sin(lerp(0,2 * pi, k)); | |
in | |
triangle {w:w*k, h:h * k} | |
>> colour (blue) | |
>> move (x * w + dx,y * h) | |
] | |
] | |
where | |
triangle {w,h} = convex_polygon [ | |
(0,0), | |
(w,h/2), | |
(0,h) | |
] >> move (-w/2,-h/2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment