On 10/04/11 15:12, Tyler Leavitt wrote:
I've not had any real success using the formulas with [sin] and [cos]...
maybe I'm missing something here. The only solution that I've gotten to work
is the midpoint circle algorithm with Peter's patch.

A circle centered at the origin is implicitly[1] described by:

  x^2 + y^2 = r^2

Rearranging this gives:

  y = +/- sqrt(r^2 - x^2)   for -r <= x <= r

Hopefully this more useful for your purposes than the parametric form:

  (x,y) = (cos(t), sin(t))  for -PI <= t <= PI

Should be much simpler to implement than an optimized-for-integers Bresenham-style implementation.


Relatedly[2] I like this function too:

  f(x,t) = sqrt((t^2)+(x^2)*(2*t+1))-t  for -1 <= x <= 1 and 0 <= t


[1] http://en.wikipedia.org/wiki/Circle#Cartesian_coordinates
[2] http://en.wikipedia.org/wiki/Conic_section


Claude
--
http://claudiusmaximus.goto10.org

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to