Click to See Complete Forum and Search --> : Drawing a circle with Cos() and Sin()?


Sastraxi
Feb 13th, 2001, 06:02 PM
If I knew the centre point, the radius, and the point (in degrees 0-359) I wanted to draw, how would I draw it?

(this should return X and Y, the point of the point... I hope I make sense!) I want to make a circle pixel by pixel so I need to know how to get the pixel!

HarryW
Feb 13th, 2001, 08:23 PM
http://www.sparkseek.com/cgi-bin/search.fcgi?ac=ikt5993&ot=1001&qry=bresenham

http://www.gamedev.net/reference/articles/article767.asp

Try those links, they ought to explain a few things. It's a highly historical problem, drawing circles. Back when computers were incredibly slow by today's standards, it was a big deal drawing a circle. Thankfully it's pretty easy now :)

Sastraxi
Feb 14th, 2001, 09:32 PM
Thats allright, I found it out...

Here it is, for any curious ppl

X = OriginX + cos(degree) * radius
Y = OriginY + sin(degree)*radius

HarryW
Feb 15th, 2001, 04:10 AM
Oh, well just drawing a circle like that is very inefficient and slow, but never mind. Sorry, I would have said that but I thought you'd want something fast.

TB
Feb 17th, 2001, 09:53 AM
When you use Visual Basic to draw a circle with this code you will have to convert the degrees into radiant,
i mean you will have to multiply the degree value with PI/180 before you use it.