algorithm - How can I generate a list of coordinates that sit along the radius of a circle? -
let's center of screen have imaginary circle 100 pixels in radius , want generate array of 360 pixel coordiantes sit along line. how can it? want know central point, basic method of generating list, dont worry specifics of screen centering or whatever. lets circle @ 500,500 on screen.
the language i'm working bit obscure i'm asking under algorithm
tag basic explanation of how calculate list.
i realize should easy, math skills suck. im not sure how start.
for = 0.. 359: fi = * pi / 180 x = centerx + radius * cos(fi) //round integer y = centery + radius * sin(fi)
in case want generate points needed draw circle, consider circle rasterization algorithm bresenham circle algorithm or midpoint one
Comments
Post a Comment