How do you make this line into a circle?
Author |
Message |
santabruzer
|
Posted: Wed Dec 10, 2003 11:31 pm Post subject: How do you make this line into a circle? |
|
|
Hey!
Just wondering.. how you would go about make a line draw a cicle.. as in like
code: | for i : 1 .. 360
drawline (300, 225, i, 100, 7)
delay (10)
end for
|
would draw a triangle....
PLease help! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
AsianSensation
|
Posted: Wed Dec 10, 2003 11:32 pm Post subject: (No subject) |
|
|
equation of a circle, as in x^2 + y^2 = r^2
sub in values for x and find y, then draw it from a center point. |
|
|
|
|
|
Schaef
|
Posted: Wed Dec 10, 2003 11:34 pm Post subject: (No subject) |
|
|
To draw a circle you use
"Drawoval" or "Drawfilloval" then in brackets you put (x coor. of circles center, y coor. of circles center, radius, radius, colour) |
|
|
|
|
|
santabruzer
|
Posted: Wed Dec 10, 2003 11:37 pm Post subject: (No subject) |
|
|
the problem is that i knew that, but have no idea how to do it.... i'll try and figure it out.. hopefully.. |
|
|
|
|
|
Tony
|
Posted: Wed Dec 10, 2003 11:48 pm Post subject: (No subject) |
|
|
well you graph circle using y^2 = r^2 - x^2
code: |
for i:-50..50
Draw.Dot(i+100,round(sqrt(2500-i*i))+100,red)
delay(10)
end for
for decreasing i:50..-50
Draw.Dot(i+100,-round(sqrt(2500-i*i))+100,red)
delay(10)
end for
|
and just use those outer coordinates as your second point for the line
code: |
for i:-50..50
Draw.Line(100,100,i+100,round(sqrt(2500-i*i))+100,red)
delay(10)
end for
for decreasing i:50..-50
Draw.Line(100,100,i+100,-round(sqrt(2500-i*i))+100,red)
delay(10)
end for
|
Though it's not a perfect fill
You're better off using Draw.FillArc
code: |
for i:1..360
Draw.FillArc(100,100,100,100,i-1,i,black)
delay(10)
end for
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
santabruzer
|
Posted: Wed Dec 10, 2003 11:56 pm Post subject: (No subject) |
|
|
Thanx.. .. wonder why it ain't a perfect fill... (maybe should've paid attention at math class) |
|
|
|
|
|
Homer_simpson
|
Posted: Thu Dec 11, 2003 12:11 am Post subject: (No subject) |
|
|
how bout this one?
code: | View.Set ("offscreenonly")
var y := 0.0
for decreasing r : 6000 .. 50 by 20
cls
for x : -80 .. 80
if (r ** 2) >= (x ** 2) then
y := sqrt ((r ** 2) - (x ** 2))
drawdot (x + 320, round (y) + 200 - r, 12)
drawdot (x + 320, round (-y) + 200 - r, 12)
end if
end for
View.Update
delay (10)
end for |
|
|
|
|
|
|
santabruzer
|
Posted: Thu Dec 11, 2003 8:49 am Post subject: (No subject) |
|
|
nice effect... but i wanted something a lot simpler.. like a line redrawing over and over to form a fill oval... i guess you can't do that.. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|