bend.scad icon indicating copy to clipboard operation
bend.scad copied to clipboard

Hull together steps to prevent gaps

Open WhittlesJr opened this issue 4 years ago • 4 comments

I was having issues with seams between each step in the model. It really messed with my slicer when I tried to 3D print the thing.

Here's a naive refactor that hulls together each step with the previous step. This fixes the gap issue, and my models come out with clean geometry. There is some unintended subtle change in shape though, which looks good on my model but may not be for everyone. Further testing is needed.

WhittlesJr avatar Oct 03 '21 03:10 WhittlesJr

Oh, I only did this for cylindric_bend, because that's what I'm using. I bet it would work for the parabolic version though, if this behavior is desirable.

WhittlesJr avatar Oct 03 '21 03:10 WhittlesJr

Yeah, you can't just throw hulls around segments in the general case - think about how that would affect the example model, for instance (not to mention the perf impact described in #1).

Can you upload the model you were having issues with? I've had thoughts about how to potentially improve the geometry generated by this module, but I'd want a more robust suite of test cases to develop against.

stuartpb avatar Oct 05 '21 07:10 stuartpb

(The main fix I've conceptualized would be to do the intersections against a properly-computed frustum/prism for each segment instead of a straight cube - with a bit of trig, this should be simple enough to calculate with one 2D polygon and a linear_extrude)

Edited to add: you'd also want to transform the model for perspective within that frustum, which I think is actually not possible with OpenSCAD's forced-uniform last row for multmatrix - see openscad/openscad#749.

I was trying to remember why I didn't go for this before...

stuartpb avatar Oct 05 '21 08:10 stuartpb

Oh, did I really never respond to this? I can still upload the model if that would be useful. I totally get why this approach would not work for many cases...

WhittlesJr avatar Dec 16 '21 02:12 WhittlesJr