Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like using the "split tweak" method to do my curves. Converts polygons to curves. Works VERY well. Very intuitive, straightforward and ez. It's a variety of bezier.

Alg :

    given polygon P.
    For each vertex V in P.
        Get the midpoints of the 2 segs adjacent to V. M0 M1. Add those 2 points to the polygon.
        Get the midpoint of seg(M0, M1). M2. Move V to the midpoint of (V,M2).
Repeat 2 or 3 times or whatever. Each iteration increases smoothness.

And here's the code for that

https://github.com/johnalexandergreene/Geom_2D/blob/master/C...

There's a version of that for open curves too, elsewhere in that package .



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: