Last active
May 3, 2021 18:01
-
-
Save mds2/166f6c0b6687af31f5012d5fffbacdfa 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
(set-bounds! [-14 -10 -10] [14 10 10]) | |
(set-quality! 8) | |
(set-resolution! 10) | |
(define super-egg (lambda-shape (x y z) | |
(- (sqrt (sqrt (+ (* x x x x) | |
(* y y y y) | |
(* z z z z)))) 1))) | |
(define semi-egg (lambda-shape (x y z) | |
(- (sqrt (sqrt (+ (* x x x x) | |
(* (+ (* y y) (* z z)) | |
(+ (* y y) (* z z)))))) 1))) | |
(define car-core (remap-shape (super-egg x y z) | |
(/ x 9) | |
(/ y 4) | |
z)) | |
(define smooth-intersection | |
(lambda (a b k) | |
(* k (log (+ (exp (/ a (* 0.25 k))) (exp (/ b (* 0.25 k)))))))) | |
(define smooth-blend | |
(lambda (a b k) | |
(- (smooth-intersection (- a) (- b) k)))) | |
(define smooth-difference | |
(lambda (a b k) | |
(smooth-intersection a (- b) k))) | |
(define cockpit | |
(smooth-intersection | |
(remap-shape (semi-egg x y z) | |
(/ y 3) | |
(/ (- z 1) 2) | |
(/ (- x 5) 7)) | |
(remap-shape (semi-egg x y z) | |
(/ y 4) | |
(/ (- z 0.5) 3) | |
(/ (- x 3) 5)) | |
0.25 )) | |
(define car (smooth-blend car-core cockpit 0.75)) | |
(define engines | |
(union | |
(remap-shape (semi-egg x y z) | |
(/ (+ x 6) 6) | |
(+ y 4.75) | |
(- z 2)) | |
(remap-shape (semi-egg x y z) | |
(/ (+ x 6) 6) | |
(- y 4.75) | |
(- z 2)) | |
)) | |
(define wings | |
(smooth-intersection | |
(box [-9.5 -5 -5] [-3 5 5]) | |
(smooth-difference | |
(difference | |
(remap-shape (super-egg x y z) | |
(/ (+ x 5) 9) | |
(/ y 5) | |
(/ (- z 2) 2)) | |
(remap-shape (super-egg x y z) | |
(/ (+ x 2) 8) | |
(/ y (* 5 0.9)) | |
(/ (- z 2) (* 2 0.9)))) | |
(remap-shape (super-egg x y z) | |
(/ (+ x 4) 3) | |
(/ y 12) | |
(/ (- z 4.5) 3)) 1) 1 )) | |
(smooth-blend | |
wings | |
(union | |
car | |
engines) | |
0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment