Last active
September 8, 2015 15:50
-
-
Save madhephaestus/96ebd49463ef37862ecb 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
(import '[eu.mihosoft.vrl.v3d CSG Cube Sphere Transform])) | |
(defn translate-x | |
"Translates a csg in the x direction" | |
[csg n] | |
(.transformed csg (. (Transform/unity) translateX n))) | |
(defn union-all | |
[& objs] | |
(reduce (fn [a b] (.union a b)) objs)) | |
(let [cube (.toCSG (Cube. 2)) | |
sphere (.toCSG (Sphere. 1.25)) | |
csg (union-all cube | |
(translate-x sphere 3) | |
(translate-x (.union cube sphere) 6) | |
(translate-x (.difference cube sphere) 9) | |
(translate-x (.intersect cube sphere) 12))] | |
(spit "/home/hephaestus/example.stl" (.toStlString csg))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment