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

Faceting on edges of cylinders #113

Closed eddieparker closed 7 years ago

eddieparker commented 10 years ago

I'm trying out ImplicitCAD for the first time, and noticing that the quality of the renders is less precise than OpenSCAD. I'm not sure if I'm doing something wrong however on my side.

I've attached a sample .scad file, the .stl it generates. This is with a resolution of .125 - it's much worse if I don't set anything on the command line. faceting

Is this to be expected? OpenSCAD doesn't have the chunkiness - for comparison it renders the model like this: openscad

scad file:

gQuality=200;
gMetricScrewSize=3;
gBedHeight=4.4;
gClipHeightAboveBed=3.25;
gScrewWallThickness=5;
gClipLength=12;

screwRadius=gMetricScrewSize/2*1.1;
outerScrewRadius=screwRadius+gScrewWallThickness/2;
totalHeight=gClipHeightAboveBed+gBedHeight;

difference()
{
    union()
    {
        translate([-outerScrewRadius,0,0])
        cube([outerScrewRadius*2,gClipLength,gClipHeightAboveBed]);
        cylinder(r=outerScrewRadius,h=totalHeight, $fn=gQuality);
    }
    cylinder(r=screwRadius,h=totalHeight, $fn=gQuality);
}
JustinSGray commented 9 years ago

bump for this one... not sure whats going on here, but it degrades the quality of any real complex part.

iSynaptic commented 9 years ago

Ditto.

Also noticing it's generating way more faces than OpenSCAD. Disappointing, since it generates them so much faster! ;-)

dlewissandy commented 9 years ago

Bump. I noticed severe degradation around the edges of spherical caps (the difference between a sphere and a rectangle). These artifacts make implicit cad less useful for rendering complex 3d models.

dlewissandy commented 9 years ago

It appears that spheres and cubes use an explicit method for mesh generation, while cylinders do not. I suspect that some of the weirdness is being caused by the rebounding in the last case of the symbolicGetMesh function.

wbrickner commented 8 years ago

was anyone able to get to the bottom of this? It's a really big problem!

I don't use haskell and I dont understand exactly how ImplicitCAD works, so I can't work on fixing it.

Could someone please try to find the problem?

TLC123 commented 8 years ago

The edge artifacts looks like what is expected when generating a mesh with marching cubes, more precise algorithms exist but are not implemented in ImplicitCAD. For example Antimonys .stl export includes feature detection to preserve corners and edges sharp. Here's a technical paper https://www.graphics.rwth-aachen.de/media/papers/feature1.pdf

julialongtin commented 7 years ago

expected behavior. for 3d printing, i just set the -r option to my layer height, and none of that is visible in the printed part.