Skip to content

Commit

Permalink
cleanup; add missing angle conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
farrellm committed Jun 19, 2014
1 parent 05ecdd4 commit 70fe412
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/scad_clj/scad.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; utility

(defn rtod [radians]
(defn rad->deg [radians]
(/ (* radians 180) pi))

(defn indent [depth]
Expand Down Expand Up @@ -148,13 +148,13 @@

(defmethod write-expr :rotatev [depth [form [a [x y z]] & block]]
(concat
(list (indent depth) "rotate (a=" (/ (* a 180) pi) ", v=[" x ", " y ", " z "]) {\n")
(list (indent depth) "rotate (a=" (rad->deg a) ", v=[" x ", " y ", " z "]) {\n")
(write-block depth block)
(list (indent depth) "}\n")))

(defmethod write-expr :rotatec [depth [form [x y z]] & block]
(concat
(list (indent depth) "rotate ([" (rtod x) "," (rtod y) "," (rtod z) "]) {\n")
(list (indent depth) "rotate ([" (rad->deg x) "," (rad->deg y) "," (rad->deg z) "]) {\n")
(write-block depth block)
(list (indent depth) "}\n")))

Expand Down Expand Up @@ -222,7 +222,7 @@
:or {center @center-default}} & block]]
(concat
(list (indent depth) "linear_extrude (height=" height)
(if (nil? twist) [] (list ", twist=" twist))
(if (nil? twist) [] (list ", twist=" (rad->deg twist)))
(if (nil? convexity) [] (list ", convexity=" convexity))
(when center ", center=true") "){\n"

Expand Down

0 comments on commit 70fe412

Please sign in to comment.