I like Andrew's suggestion...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I like Andrew's suggestion...

Dan Zuras 3D
> From: [hidden email]
> Subject: OpenSCAD Digest, Vol 13, Issue 10
> To: [hidden email]
> Date: Sun, 26 Dec 2010 18:10:37 +0100
>
> ------------------------------
>
> Message: 8
> Date: Sun, 26 Dec 2010 11:26:46 -0500
> From: Andrew Plumb <[hidden email]>
> Subject: Re: [OpenSCAD] circle tessellation and apothems
> To: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> Hey Marius,
>
> How about calling the parameter "snap" with a range from [0,1]:
>
> snap=0 snaps line segment end-point coordinates to the ideal circle coordinates.
> - least effort to calculate
> - use when circle is maximal bound of polygon approximation
>
> snap=1 snaps line segment midpoint coordinate to the ideal circle coordinates (i.e. line midpoint is tangent to circle)
> - degenerate case where polygon fully contains circle
>
> snap=0.5 snaps line segment quarter-point coordinates to the ideal circle coordinates.
> - trade-off between polygon line segment inside & outside circle.
>
> Andrew.
>
> . . .
>
> ------------------------------

        On the one hand, while the original poster
        is mathematically correct about the problem
        of screws versus mating holes when rendered
        as polygons, I suspect that any ACTUAL
        screws that didn't fit into their mating
        holes was due to not accounting for the
        thickness of the material out of which
        each was made.

        That having been said, on the other hand,
        I like Andrew's suggestion of a snap
        parameter that can interpolate between
        the two.

        But let me suggest a slightly different
        interpretation based on the following:

        r(circumscribed) = r(inscribed)/cos(Pi/n)
                        = r(inscribed)*sec(Pi/n)
                        = r(inscribed)*sqrt(1 + tan^2(Pi/n))

        This suggests a natural approach to
        Andrew's snap parameter along the lines
        of:

        r(effective) = r*sqrt(1 + snap*tan^2(Pi/n))

        with the default snap = 0.

        Then we have:

                snap = 0 : polygon inscribed
                snap = 1 : polygon circumscribed
                0 < snap < 1 : something in between
                snap < 0 : fudge factor for a screw
                snap > 1 : fudge factor for a hole

        And all appear linear (to first order) in
        the scale of the polygon in question.

        Some care must be taken to prevent negative
        square roots.  So perhaps the formula:

        r(effective) = r*sqrt(max(0,1 + snap*tan^2(Pi/n)))

        is safest.

        Again, just a suggestion.


                           Dan