[OpenSCAD] Why is this so heavy to OpenScad?

Jordan Brown openscad at jordan.maileater.net
Sun Nov 10 17:37:02 EST 2019


On 11/10/2019 2:32 PM, adrianv wrote:
> <http://forum.openscad.org/file/t2477/mcad_box.png> 
>
> [ MCAD's ] "rounded" box has a bunch of extra polygons because of whatever
> craziness is going on with the "rounding".

That looks really familiar.  I have a rounded-end-cylinder polygon
module that I use in a number of places, that I happen to be using
today, and it has some of the same issues.  Or did, until I got
obsessive and fixed several of them.

Without looking at the sources, it looks like it isn't so much doing
anything stupid as it is using naïve techniques, building the edges out
of cylinders and the corners out of spheres.  Unless you're really
careful, the faces on low-poly corners like that won't line up.  It also
looks like it's got the faces of the round things aligning with the
sides of the box, without accounting for the fact that OpenSCAD's
polygon-cylinders have a diameter measured vertex-to-vertex, not
face-to-face.  It needs

    function adj(d, sides) = d/cos(360/sides/2);

which will give you the diameter (or radius) to use to get a diameter of
"d" measured face-to-face.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20191110/6fb8a1ae/attachment.html>


More information about the Discuss mailing list