colah/ImplicitCAD — Issue #3: Extruded polygon has detached corners
Author: canadaduane
Created: 2012-01-05 16:33:26+00:00
State: open

I tried making a rectangle function ("rect") that takes width, height and depth, and produces a 3D rectangle. (It's an attempt to duplicate what OpenSCAD calls a "cube" which is not a particularly accurate name.) Here's the code:

```haskell
import Graphics.Implicit

rect w h d = extrude d (polygon [(-w/2,h/2), (w/2,h/2), (w/2,-h/2), (-w/2,-h/2)])

out =
union [
rect 10 20 40,
translate (20,20,20) (sphere 15)
]

main = writeSTL (-50,-50,-50) (50,50,50) 1 "test.stl" out
```

What I see is a rectangle with 2 of the corners "detached" from the rest of the body. [1] What do you think?

[1] http://dl.dropbox.com/u/118766/misc/implicit-cad-detached-corners.png