Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 8 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: