![]() |
PSET Circle! - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: PSET Circle! (/thread-6492.html) |
PSET Circle! - KiZ - 03-17-2005 Quote:does any one under stand the math behind the circle? just checking *frowns at diroga* Yes, I do. Quote:tetha Dont you mean Theta ![]() PSET Circle! - xteraco - 03-17-2005 whats math? :bounce: no really, i do PSET Circle! - Neo - 03-17-2005 Quote:Oooooops :oops: Of course, Theta is EnglishNeo Wrote:tetha ![]() PSET Circle! - Eurodance - 03-18-2005 Code: PSET (100, 100), 15 ![]() ![]() ![]() Fu program - Meg - 03-18-2005 This obviously isn't an entry for this challenge, but it's a fun program nonetheless. ^_^ *peace* Meg [syntax="QBASIC"] 'THIS PROGRAM MAKES USE OF THE CROSSCIRCLE SUB TO DISPLAY CIRCLES WITH LINES 'CUTTING ACROSS THEM AT PRESET NODE POINTS. ' - Written 03/17/2005 by mb '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'SUB DECLARATIONS '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ DECLARE SUB CrossCircle (x!, y!, r!, c%, n%, o!) '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'CHANGE TO GRAPHICS MODE 320x200 '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ SCREEN 13 CLS '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'ROTATE A 10-NODE, 40-RADIUS CIRCLE IN THE CENTER OF THE SCREEN '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ offset! = 0 DO offset! = offset! + .01 CrossCircle 160, 100, 40, 15, 10, offset! WAIT &H3DA, 8 WAIT &H3DA, 8, 8 CrossCircle 160, 100, 40, 0, 10, offset! LOOP UNTIL INKEY$ <> "" SYSTEM SUB CrossCircle (x!, y!, r!, c%, n%, o!) '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'THIS SUB DRAWS NODES AROUND A CIRCLE AND CONNECTS THEM WITH LINES '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'x! = x-coordinate of circle 'y! = y-coordinate of circle 'r! = radius of circle 'c% = color of circle 'n% = number of nodes in circle 'o! = offset of first node in radians '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'MAKE OUR NODE COORDINATE ARRAYS '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ REDIM nodeX!(1 TO n%) REDIM nodeY!(1 TO n%) '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'STARTING AT OFFSET o!, CREATE EVENLY SPACED NODES AROUND THE CIRCLE '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ NodeDist! = (2 * 3.14159) / n% NodeCurr! = o! FOR i% = 1 TO n% nodeX!(i%) = x! + COS(NodeCurr!) * r! nodeY!(i%) = y! - SIN(NodeCurr!) * r! NodeCurr! = NodeCurr! + NodeDist! NEXT i% '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 'CONNECT THE NODES TO EACH OTHER WITH LINES '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FOR i% = 1 TO n% - 1 FOR j% = i% + 1 TO n% LINE (nodeX!(i%), nodeY!(i%))-(nodeX!(j%), nodeY!(j%)), c% NEXT j%, i% END SUB [/syntax] PSET Circle! - Rattrapmax6 - 03-18-2005 Quote:does any one under stand the math behind the circle? just checking Knows it here,.. :wink: ... do you? Quote:This obviously isn't an entry for this challenge, but it's a fun program nonetheless. ^_^ Wow, thats cool!! :bounce: PSET Circle! - Mitthrawnuruodo - 03-19-2005 Wow, that was great! lol try doing it at 160, 100, 200, 15, 25, offset!!!!! Ha lol :lol: (FYI that rotates a 200 radius circle at the center of the screen, color 15, AND 25 nodes!) ![]() Oh ya I do too (understand the math behind it). I had to learn all that stuff when I learned 3D in QB. ![]() PSET Circle! - Dio - 03-19-2005 i was messin' around with Diroga's entry just for fun and i made this: [syntax="qbasic"]CLS SCREEN 13 rad = (3.14159265#) / 180 c = 16 z = 76 SLEEP FOR ii = 1 TO 75 z = z - 1 FOR i = 1 TO 361 STEP .5 oldx = x: oldy = y x = INT(z * (COS(rad * i))) + 160 y = INT(z * (SIN(rad * i))) + 100 c = c + 1: IF c > 31 THEN c = 16 PSET (x, y), c NEXT NEXT[/syntax] PSET Circle! - Rattrapmax6 - 03-19-2005 ![]() [syntax="QBasic"]SCREEN 13 FOR a = 1 TO 360 x = a * COS(a * 3.14159265# / 180) y = 20 * SIN(a * 3.14159265# / 180) LINE (160, 100)-(160 + x, 100 - y), a NEXT[/syntax] :rotfl: PSET Circle! - Mitthrawnuruodo - 03-25-2005 Hey guess what? I was messing around with Dio's entry...hehe...oh no you say? Well, when I mess around with graphics, its more of a change here and see what happends :lol: ....well this was a little better than that...more math...not what I wanted it to do, but it looks cool: [syntax="qbasic"] CLS SCREEN 13 rad = (3.14159265#) / 180 c = 16 z = 76 offset = 0 DO offset = offset + 1 ci = (ci + 5) MOD 255 c = 16 z = 76 FOR ii = 1 TO 150 z = z - 1 FOR i = 1 TO 361 STEP .5 oldx = x: oldy = y d = (i + offset) MOD 360 x = INT(z * (COS(rad * d))) + 160 y = INT(z * (SIN(rad * d))) + 100 c = c + 1: IF c > ci THEN c = 16 PSET (x, y), c NEXT NEXT LOOP [/syntax] |