Skip to content

Commit fe181fc

Browse files
committed
Port to new implicit API
1 parent d638c8a commit fe181fc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Graphics/Implicit/Viewer/Demos.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ demoLetterI t =
1010
scale 2
1111
$ translate (V3 0 0 (-7))
1212
$ unionR 1
13-
[ translate (V3 0 0 5) $ cubeR 1 True (V3 4 4 10)
13+
[ translate (V3 0 0 5) $ withRounding 1 $ cube True (V3 4 4 10)
1414
, translate (V3 0 0 (13 - 13 * t)) $ sphere (3 + t)
1515
]
1616

1717
demoRotatingAnim :: Double -> SymbolicObj3
1818
demoRotatingAnim t =
1919
rotate3 (V3 0 0 (t*2*pi))
20-
$ cylinder2 2 1 2 `ontop` cubeR 0 True (V3 6 6 2)
20+
$ cylinder2 2 1 2 `ontop` cube True (V3 6 6 2)
2121

2222
ontop :: SymbolicObj3 -> SymbolicObj3 -> SymbolicObj3
2323
ontop a b = union [ translate (V3 0 0 z) a, b ]
@@ -44,7 +44,7 @@ demoAnimSpheres t = union $ [
4444
translate (V3 s 0 0) (sphere (5 - s/5))
4545
, translate (V3 (-s) 0 0) (sphere (5 - s/5))
4646
, translate (V3 (-5-(s/2)) 0 0)
47-
$ rotateExtrude (t * 360) (Just 0) (Left (V2 0 2)) (Left 0)
47+
$ rotateExtrude (t * 360) (Left (V2 0 2)) (Left 0)
4848
$ translate (V2 4 0) $ circle 1
4949
, translate (V3 (-10) 20 0)
5050
$ rotate3 (V3 0 (t * 2 * pi) 0)
@@ -53,16 +53,16 @@ demoAnimSpheres t = union $ [
5353
, translate (V3 0 0 s) $ rotate3 (V3 pi 0 0) $ cylinder2 1 3 7 ]
5454
] ++
5555
map (\x -> translate (V3 (5 + (fromIntegral x * 2)) 5 0)
56-
(cubeR 0 False (V3 1 1 (fromIntegral x)))
56+
(cube False (V3 1 1 (fromIntegral x)))
5757
) [(0 :: Int)..(round s)]
5858
where s = (t*7) + 0.01 -- noglitchart
5959

6060
demoScene :: SymbolicObj3
6161
demoScene = union $ [
62-
cubeR 0 False (pure 20)
62+
cube False (pure 20)
6363
, translate (pure 20) (sphere 15)
6464
, translate (V3 30 20 20) (sphere 5)
65-
, translate (V3 0 0 25) (cubeR 2 False (pure 10))
65+
, translate (V3 0 0 25) (withRounding 2 $ cube False (pure 10))
6666
, translate (V3 25 0 0) (cylinder2 10 1 100)
6767
-- , translate (V3 45 0 0) $ difference
6868
-- ( cylinder 5 (10) )
@@ -72,7 +72,7 @@ demoScene = union $ [
7272
-- https://github.com/colah/ImplicitCAD/issues/280
7373
-- , translate (V3 55 55 0) demoSymbolic
7474
] ++
75-
map (\x -> translate (V3 0 0 (20 + (10 - x) * 11)) (cubeR 0 False (pure $ 10 - x))) [0..9]
75+
map (\x -> translate (V3 0 0 (20 + (10 - x) * 11)) (cube False (pure $ 10 - x))) [0..9]
7676

7777
circ :: SymbolicObj2
7878
circ = implicit (\(V2 x y) -> x^(2 :: Int) + y^(2 :: Int) - 1) (pure (-10), (pure 10))
@@ -91,7 +91,7 @@ sph = implicit (\(V2 x y) -> 10*x^(2 :: Int) + y^(2 :: Int) - 1) (pure (-10), (p
9191
-- Example:
9292
-- @
9393
-- cubeOSphere s n = mixed s
94-
-- (cubeR 0 True (pure n))
94+
-- (cube True (pure n))
9595
-- (sphere (sqrt (3 * (n/2) ^2) ))
9696
-- @
9797
mixed

src/Graphics/Implicit/Viewer/Loaders.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ loadViaEscad modFile initialResolution renderChan = do
157157
_ -> initialResolution
158158

159159
renderObjToChan
160-
(unionR 0 ((extrudeR 0 (unionR 0 objs2) 1):objs3))
160+
(unionR 0 ((extrude (unionR 0 objs2) 1):objs3))
161161
res
162162
renderChan
163163

0 commit comments

Comments
 (0)