Skip to content

Instantly share code, notes, and snippets.

@edap
Created August 9, 2016 18:50
Show Gist options
  • Select an option

  • Save edap/032167b683f5c59cdaa1877c5d070007 to your computer and use it in GitHub Desktop.

Select an option

Save edap/032167b683f5c59cdaa1877c5d070007 to your computer and use it in GitHub Desktop.

Revisions

  1. edap created this gist Aug 9, 2016.
    23 changes: 23 additions & 0 deletions test-sphere.cljs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    (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))