Skip to content

Commit

Permalink
[svg] bugfix all-as-svg for clj version, bugfix regression in example…
Browse files Browse the repository at this point in the history
…03 (needs GMesh)
  • Loading branch information
postspectacular committed May 25, 2015
1 parent 3ba44ea commit 35a68a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
24 changes: 11 additions & 13 deletions geom-svg/src/core.org
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,16 @@ Btw. This example can be run from the REPL via this command:
;; CLJS walk differs to clojure's impl and doesn't work for defrecords
;; hence we provide a custom version here...

#?@(:cljs
[(defn walk
[inner outer form]
(cond
(seq? form) (outer (doall (map inner form)))
(vector? form) (outer (mapv inner form))
:else (outer form)))

(defn postwalk
[f form]
(walk (partial postwalk f) f form))])
(defn walk
[inner outer form]
(cond
(seq? form) (outer (doall (map inner form)))
(vector? form) (outer (mapv inner form))
:else (outer form)))

(defn postwalk
[f form]
(walk (partial postwalk f) f form))

(defn all-as-svg
[form]
Expand Down Expand Up @@ -464,8 +463,7 @@ Btw. This example can be run from the REPL via this command:
(:require
[thi.ng.geom.svg.core :as svg]
[thi.ng.geom.core :as g]
[thi.ng.geom.types]
#?(:clj [clojure.walk :refer [postwalk]]))
[thi.ng.geom.types])
#?(:clj
(:import
[thi.ng.geom.types Circle2 Line2 LineStrip2 Polygon2 Rect2 Triangle2])))
Expand Down
3 changes: 2 additions & 1 deletion geom-svg/src/examples.org
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ is defined in its own namespace and can be loaded from the REPL via:
[thi.ng.geom.core.matrix :as mat]
[thi.ng.geom.circle :as c]
[thi.ng.geom.polygon :as p]
[thi.ng.geom.gmesh :as gm]
[thi.ng.geom.mesh.subdivision :as sd]
[thi.ng.geom.svg.core :as svg]
[thi.ng.geom.svg.shaders :as shader]
Expand Down Expand Up @@ -138,7 +139,7 @@ is defined in its own namespace and can be loaded from the REPL via:
[res radius depth wall]
(-> (c/circle radius)
(g/as-polygon res)
(g/extrude-shell {:depth depth :wall wall :inset -0.1})
(g/extrude-shell {:depth depth :wall wall :inset -0.1 :mesh (gm/gmesh)})
(g/center)))

(def mesh
Expand Down

0 comments on commit 35a68a3

Please sign in to comment.