-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object formed by extrusion is not solid #412
Comments
I've updated your code to work with most recent version and managed to reproduce the problem. I think it is a bug but it's not clear to me what is causing it. Updated code and pics following: module Main
where
import Prelude
import Graphics.Implicit
import Graphics.Implicit.Definitions
circle_diameter_bottom = 14.80 -- mm
circle_height = 9.86
root :: ℝ -> ℝ -> ℝ
root n x = x ** (1/n)
shape n width height (V2 x y) =
1 - root n ((x / half width) ** n + (y / half height) ** n)
half k = k / 2
twice k = 2 * k
test_shape :: ℝ -> SymbolicObj2
test_shape k =
intersect
[ implicit
(shape k circle_diameter_bottom (twice circle_height))
(V2 (-9) (-5), V2 9 10)
, rect (V2 (-15) 0) (V2 15 25)
]
test_solid :: ℝ -> SymbolicObj3
test_solid k = extrude (test_shape k) 7
main :: IO ()
main = do
writePNG2 0.5 "test.png" $ test_shape 2
writeSVG 0.5 "test.svg" $ test_shape 2
writeSTL 0.5 "test.stl" $ test_solid 2 |
OK. Thanks for having a look. I'll sit tight. |
The SVG not having lines for the top or sides is making me think that something is going wrong somewhere at the 2D level, and it might not be an extrusion issue. I'll have a bit of a poke around and see if I can find anything. |
OK, so I have a finding, and some reasoning as to why we are seeing the missing edges, and a work around for now. Background Workaround Thoughts As to why the 2D render is showing the bounding box as solid, while the SVG and 3D render aren't I suspect either a bug somewhere in the render for 2D STL or that STL itself is using the bounding box of the render as implicit edges and filling in the gaps. I haven't looked into if this is the case or not however. Followup
@julialongtin I'll probably need to pick your brains about the rendering code if I dig into this more, consider this a heads up. |
Bounding boxes now work as edges when using `implicit` defined surfaces. This allows the use of infinite surface functions with a finite bounding box to work with operations such as `intersect`. Haskell-Things#412
Bounding boxes now work as edges when using `implicit` defined surfaces. This allows the use of infinite surface functions with a finite bounding box to work with operations such as `intersect`. Haskell-Things#412
Bounding boxes now work as edges when using `implicit` defined surfaces. This allows the use of infinite surface functions with a finite bounding box to work with operations such as `intersect`. Haskell-Things#412
I've defined objects using the following code (complete code in attachments):
When I render the two-dimensional
test_shape
as a PNG, it shows as a solid rectangle with a semicircular bite taken out of it, as expected. But when that shape is extruded into a solid and written as an STL, the resulting STL isn't solid; it's just a bunch of surfaces glued together.The documentation for the Haskell API is a bit thin, so I'm not sure if there is a fault in the library or if I just don't understand the API. If it's an API misunderstanding, perhaps we can clear it up and I'll send you a PR with revised documentation?
Here is a zip file with the complete source code and the output STL
The text was updated successfully, but these errors were encountered: