Monday, 22 November 2010

How to Draw a Perfect Circle with Bezier Curves

I actually needed this for Swift 3d rather than Flash. Obviously in Flash I could have just drawn a circle using the circle tool.

In Swift 3d, I could still have done that - but what I needed was a path that was circular. I wanted to film all the way round a 3d object I had made, so I needed the target camera to go in a circular path around the object.

I tried 'eyeballing' it, but when I rendered out the movie, it looked like I was zooming in and out all the time.

This page http://bezier.dodofactory.net/bezier1e_04.html had diagrams that made it easier to understand, but I now realise that the number 0.55 is just a rounded down version of a value called 'kappa' (kappa = 0.5522847498), found on http://www.whizkidtech.redprince.net/bezier/circle/.

Anyway, lets say you were drawing a circle with a radius of 6 arbitrary units, your bezier handles need to extend to (6x0.55) arbitrary units.

That should give you a pretty nice circle.