Qbasicnews.com
October 25, 2021, 09:41:11 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4 5
  Print  
Author Topic: PSET Circle!  (Read 43222 times)
Sterling Christensen
Na_th_an
*****
Posts: 1328


« Reply #15 on: March 16, 2005, 07:00:02 PM »

Quote from: "Mitth'raw'nuruodo"
I think Sterling won.

Lol, I was just joking. I don't think my submission counts, it's only valid on a technicality. He would have specified a minimum readius had it occured to him to.
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #16 on: March 16, 2005, 07:02:12 PM »

Quote from: "Mitth'raw'nuruodo"
heh, its FB...

I think Sterling won.
[/code]


Oh yeah, heh, nice try, but I said it had to be round, thats a small square.. :wink:
Logged

Kevin (x.t.r.GRAPHICS)

Mitth'raw'nuruodo
Ancient Guru
****
Posts: 515



WWW
« Reply #17 on: March 16, 2005, 07:04:02 PM »

Ah, but it's a point. And isn't a point round?

Just cause the computer gives him a handicap on its res..... :lol:
Logged

i]"But...it was so beautifully done"[/i]
Diroga
Been there, done that
*****
Posts: 1087


« Reply #18 on: March 17, 2005, 04:33:40 AM »

does any one under stand the math behind the circle? just checking
Logged
Neo
Na_th_an
*****
Posts: 2150



« Reply #19 on: March 17, 2005, 06:09:02 AM »

What a question... of course Tongue

The math behind an ellipse is very simple.
For an ellipse:
    (x / c) ^ 2 + (y / d) ^ 2 = r ^ 2

For a filled ellipse:
    (x / c) ^ 2 + (y / d) ^ 2 <= r ^ 2

For a negative ellipse:
    (x / c) ^ 2 + (y / d) ^ 2 > r ^ 2


That is the mathematical algebraic description of an ellipse (a circle has c = d = 1). A circle can also be written as a function of polar or parametric variables.
Polar form:
    r = const

Parametric:
    x = cos(tetha) * r
    y = sin(tetha) * r

In both forms tetha ranging from 0 to 2 * PI.

Rotated ellipses are easier to make using the parametric form, although for both the function and parametric form a rotation formula can be used.

Wink

~~~~~
Logged
KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #20 on: March 17, 2005, 06:47:38 AM »

Quote from: "Diroga"
does any one under stand the math behind the circle? just checking


*frowns at diroga*

Yes, I do.

Quote from: "Neo"
tetha


Dont you mean Theta Wink
Logged
xteraco
Ancient QBer
****
Posts: 450



WWW
« Reply #21 on: March 17, 2005, 09:55:07 AM »

whats math? :bounce:  no really, i do
Logged

url=http://www.random-seed.net][/url]
Neo
Na_th_an
*****
Posts: 2150



« Reply #22 on: March 17, 2005, 02:22:26 PM »

Quote from: "dark_prevail"
Quote from: "Neo"
tetha


Dont you mean Theta Wink

Oooooops :oops: Of course, Theta is English Wink lol I just talked Dutch... tetha... lol
Logged
Eurodance
Member
*
Posts: 42



WWW
« Reply #23 on: March 17, 2005, 04:27:08 PM »

Code:
PSET (100, 100), 15

Isn't it a circle?  :lol:  Cheesy  :lol:  Cheesy  Tongue
Logged

EEL THE BEAT OF EURODANCE!!! Smiley
Meg
Ancient QBer
****
Posts: 483


« Reply #24 on: March 17, 2005, 05:36:44 PM »

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]
Logged
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #25 on: March 17, 2005, 06:27:58 PM »

Quote from: "Diroga"
does any one under stand the math behind the circle? just checking


Knows it here,..  :wink: ... do you?

Quote from: "Meg"
This obviously isn't an entry for this challenge, but it's a fun program nonetheless. ^_^

*peace*

Meg


Wow, thats cool!! :bounce:
Logged

Kevin (x.t.r.GRAPHICS)

Mitth'raw'nuruodo
Ancient Guru
****
Posts: 515



WWW
« Reply #26 on: March 18, 2005, 05:19:07 PM »

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!) Tongue

Oh ya I do too (understand the math behind it). I had to learn all that stuff when I learned 3D in QB. Cheesy
Logged

i]"But...it was so beautifully done"[/i]
Dio
I hold this place together
*****
Posts: 874



« Reply #27 on: March 18, 2005, 05:49:20 PM »

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]
Logged

quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Rattrapmax6
__/--\__
*****
Posts: 2577



WWW
« Reply #28 on: March 18, 2005, 07:59:27 PM »

Smiley Heh, okay, try this one, deff not for the comp, just for the eye:

[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:
Logged

Kevin (x.t.r.GRAPHICS)

Mitth'raw'nuruodo
Ancient Guru
****
Posts: 515



WWW
« Reply #29 on: March 25, 2005, 01:27:00 AM »

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]
Logged

i]"But...it was so beautifully done"[/i]
Pages: 1 [2] 3 4 5
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!