Skip to content

Instantly share code, notes, and snippets.

@joshcough
Created October 13, 2012 22:19
Show Gist options
  • Save joshcough/3886389 to your computer and use it in GitHub Desktop.
Save joshcough/3886389 to your computer and use it in GitHub Desktop.
(
(def closed (c)
(or
(<= (- (cube-max-x c) (cube-min-x c)) 1)
(<= (- (cube-max-z c) (cube-min-z c)) 1)
)
)
(defrec pyramid (c m)
(begin
(cube-set-walls c m)
(if (closed c)
unit
(pyramid (cube-shift-y (cube-shrink-in c 1) 1) m)
)
)
)
(def house (start-point h w d floor-m walls-m roof-m)
(let (c (cube-grow-up (cube-expand-z (cube-expand-x (cube start-point start-point) w) d) h))
(begin
(cube-set-all c (material "air"))
(cube-set-floor c floor-m)
(cube-set-walls c walls-m)
(pyramid (cube-expand-out (cube-ceiling c) 1) roof-m)
)
)
)
(house XYZ 8 8 20 (material "stone") (material "brick") (material "wood"))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment