Skip to content

Instantly share code, notes, and snippets.

@edap
Created August 9, 2016 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edap/032167b683f5c59cdaa1877c5d070007 to your computer and use it in GitHub Desktop.
Save edap/032167b683f5c59cdaa1877c5d070007 to your computer and use it in GitHub Desktop.
(defn morphogen-mesh
[seed tree]
(-> seed
(mg/seed-box)
(mg/generate-mesh tree)
(g/center)))
(def strip-quad
"Arrangement of quads"
(let [quad (mg/apply-recursively (mg/reflect :e) 4 [1] 1)
reflected-quad (mg/reflect :n :out [{} quad])
inject #(-> quad
(assoc-in (mg/child-path [1 1 0]) %)
(assoc-in (mg/child-path [1 1 1 1 0]) %)
)
seed-clone (mg/reflect :s :out [{} (inject reflected-quad)])]
(mg/reflect :s :out [(inject seed-clone) (inject reflected-quad)])))
(defn quads-recursively
[]
[(mg/seed-box (mg/seed-box (mg/circle-lattice-seg 6 0.25 0.1))) strip-quads])
(apply morphogen-mesh (quads-recursively))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment