summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-03-13 01:07:31 -0400
committerAndrew Cady <d@jerkface.net>2019-03-13 01:08:43 -0400
commit954666581245536f8baa1da81fe431062ef783f7 (patch)
tree1fcdbf7ee32af6f5b144ebfb96d5398c16c96d08
parent8ecd4c122c54e9a3b17400051e4d660cee4b8570 (diff)
arguably less convoluted
-rw-r--r--GenSCAD.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/GenSCAD.hs b/GenSCAD.hs
index e9343da..e5e99ab 100644
--- a/GenSCAD.hs
+++ b/GenSCAD.hs
@@ -18,12 +18,12 @@ import System.IO.Temp
18import System.Process 18import System.Process
19 19
20 20
21v3tolist (V3 a b c) = [a,b,c]
21 22
22_V32l :: R3 c1 => c1 c -> [c] 23_V32l :: R3 c1 => c1 c -> [c]
23_V32l c = [c ^. _x, c ^. _y, c ^. _z] 24_V32l = view (_xyz . to v3tolist)
24 25
25_V32s :: (R3 c1, Show a) => c1 a -> String 26_V32s c = intercalate "," (map show c)
26_V32s c = intercalate "," (map show (_V32l c))
27 27
28-- placecube: OpenSCAD translate cube described by d to place designated by p 28-- placecube: OpenSCAD translate cube described by d to place designated by p
29-- placecube (V3 1 2 3, V3 10 20 30) -> 29-- placecube (V3 1 2 3, V3 10 20 30) ->
@@ -63,7 +63,7 @@ scad [(d, p)] = cubeat p d
63 63
64 64
65placecube :: (R3 c2, R3 c3, Show a1, Show a2) => (c2 a1, c3 a2) -> String 65placecube :: (R3 c2, R3 c3, Show a1, Show a2) => (c2 a1, c3 a2) -> String
66placecube obj = "translate([ " ++ _V32s(fst obj) ++ " ]) { cube([ " ++ _V32s(snd obj) ++ " ]); }" 66placecube obj = "translate([ " ++ _V32s(_V32l(fst obj)) ++ " ]) { cube([ " ++ (_V32s._V32l)(snd obj) ++ " ]); }"
67--placecube (p,d) = printf "translate([%d, %d, %d]) { cube([%d, %d, %d]); }" (_V32l p ++ _V32l d) 67--placecube (p,d) = printf "translate([%d, %d, %d]) { cube([%d, %d, %d]); }" (_V32l p ++ _V32l d)
68 68
69 69