Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.39k stars 142 forks source link

Broken mesh output #19

Closed tolomea closed 5 years ago

tolomea commented 12 years ago

This scad file:

difference() { sphere(20); cylinder(r=17, h=100, center = true); }

produces non manifold output, here's the admesh output:

================= Results produced by ADMesh version 0.95 ================ Input file : mesh_death.stl File type : ASCII STL file Header : solid ImplictCADExport ============== Size ============== Min X = -20.000000, Max X = 20.000000 Min Y = -20.000000, Max Y = 20.000000 Min Z = -10.252552, Max Z = 10.252552 ========= Facet Status ========== Original ============ Final ==== Number of facets : 13184 12864 Facets with 1 disconnected edge : 328 0 Facets with 2 disconnected edges : 36 0 Facets with 3 disconnected edges : 0 0 Total disconnected facets : 364 0 === Processing Statistics === ===== Other Statistics ===== Number of parts : 1 Volume : 4499.025879 Degenerate facets : 560 Edges fixed : 0 Facets removed : 560 Facets added : 240 Facets reversed : 24867 Backwards edges : 198 Normals fixed : 12864

reinoudz commented 12 years ago

euuhhh thats also a maching cubes with fixed angles problem. Hmmmm if we could fix that... :)

reinoudz commented 12 years ago

in by tree this is fixed now esp. with a r= value on the difference to bypass the bug

hmeyer commented 12 years ago

still producing non manifolds:

import Graphics.Implicit import Graphics.Implicit.Definitions import Graphics.Implicit.Primitives

roundbox:: SymbolicObj3 roundbox = implicit ((x,y,z) -> (x^4 + y^4 + z^4 - 15000)) ((-20,-20,-20),(20,20,20))

main = writeSTL 2 "roundbox.stl" roundbox

bgamari commented 11 years ago

Any progress on this?

rahji commented 11 years ago

sorry if this is unrelated, but I'm trying to get a handle on why implicitcad's meshes look so strange as compared to openscad... the edges where a cube and sphere intersect look great from openscad but are rounded and ragged coming from implicitcad... $quality makes some difference but it never looks as clean as openscad STLs with even the lowest $fn numbers on the sphere

difference() { sphere(3); cube(4); }

meshlab shows a lot of non-manifold vertices, which is why I'm adding it to this bug

Screen shot 2012-12-27 at 11 41 00 AM

julialongtin commented 7 years ago

Have you tried a more modern version? while ImplicitCAD is built around the concept of an aproxable representation (as in, there is no perfect answer, but you can request how close to get), we should not be kicking out non-manifold objects.

TLC123 commented 7 years ago

Its working better now. Still Marching Cubes at its best has inherent limits in mesh quality. Whats needed is a proper feature preserving meshing algorithm like "Dual Contour" or at least "Extended Marching Cubes"

jakobdalsgaard commented 6 years ago

Been seeing some of this too; I really like the speed of implicitcad, but it seems incapable of making thin shells by use of difference, such as:

difference () {
  sphere(r=100);
  sphere(r=98);
  translate([-100, -100,0]) cube(size=[200,200,100]);
}

Openscad does fine with above. I'd love to take a look at fixing this -- if someone could point me in direction of the right files...

screen shot 2018-01-17 at 1 48 45 pm

julialongtin commented 6 years ago

Agreed, this is quite annoying. have you tried dialing up the resolution?

On Wed, Jan 17, 2018 at 12:49 PM, Jakob Dalsgaard notifications@github.com wrote:

Been seeing some of this too; I really like the speed of implicitcad, but it seems incapable of making thin shells by use of difference, such as:

sphere(r=100); sphere(r=98); translate([-100, -100,0]) cube(size=[200,200,100]); }```

Openscad does fine with above. I'd love to take a look at fixing this -- if someone could point me in direction of the right files...

screen shot 2018-01-17 at 1 48 45 pm

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/colah/ImplicitCAD/issues/19#issuecomment-358294294, or mute the thread https://github.com/notifications/unsubscribe-auth/AQDAAvZmyArV0vmQPSAeNLFexMlNoh10ks5tLexVgaJpZM4AHFaE .

julialongtin commented 5 years ago

Added the given example as example15.scad... and fixed what i hope is the last bug in the engine.

juri@qemuhost:~/ImplicitCAD/ImplicitCAD-current$ admesh Examples/example15.stl ADMesh version 0.98.3, Copyright (C) 1995, 1996 Anthony D. Martin ADMesh comes with NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. Opening Examples/example15.stl Checking exact... All facets connected. No nearby check necessary. No unconnected need to be removed. No holes need to be filled. Checking normal directions... Checking normal values... Calculating volume... Verifying neighbors...

================= Results produced by ADMesh version 0.98.3 ================ Input file : Examples/example15.stl File type : Binary STL file Header : ============== Size ============== Min X = -19.960455, Max X = 19.960455 Min Y = -19.960455, Max Y = 19.960455 Min Z = -10.400242, Max Z = 10.400242 ========= Facet Status ========== Original ============ Final ==== Number of facets : 5408 5408 Facets with 1 disconnected edge : 0 0 Facets with 2 disconnected edges : 0 0 Facets with 3 disconnected edges : 0 0 Total disconnected facets : 0 0 === Processing Statistics === ===== Other Statistics ===== Number of parts : 1 Volume : 4708.353516 Degenerate facets : 0 Edges fixed : 0 Facets removed : 0 Facets added : 0 Facets reversed : 0 Backwards edges : 0 Normals fixed : 0

Note that it is still possible to get bad meshes when running with +RTSOPTS -N in valgrind's cachegrind mode. I'll keep an eye out for that.

Closing this 6 year old issue.