
-----------------------------------
recneps
Mon Mar 22, 2004 4:30 pm

Draw a circle
-----------------------------------
Draw a circle the cool way! (dot by dot :D)
i know its not much but check it out.
(I know, i actually LEARNED something from math class :D)

var x2, y2:int:=100
function circleify(x:int,y:int):int
var z:int:=round((x2-x)**2+(y2-y)**2)
result round(z**0.5)
end circleify


for x:1..maxx
for y:1..maxy
if circleify (x,y) = 100 then
drawdot(x,y,7)
end if
end for 
end for

where x2,y2 is the location of the centre
and circleify(x,y) =number 
where number is the radius
:D(i know its completely useless, but meh.

-----------------------------------
Cervantes
Mon Mar 22, 2004 7:23 pm


-----------------------------------
oh my...  god......

spencer, that is.... amazing.
:lol:
nono im dead serious.  That's really good that you are using functions AND stuff you learned from math class.  :D[/b]

-----------------------------------
Delos
Mon Mar 22, 2004 7:54 pm


-----------------------------------
Nice, nice...
Now try the same using trig.  It's a bit more fun that the usual conics type of algebra.

-----------------------------------
programer007
Tue Mar 23, 2004 8:06 am


-----------------------------------
very nice,.... i found it worked better iof you changed the first line to = 200 not 100 but kept everything else the same... this way it dont draw out of bounds.....

VERY NICE>>.... thats beginning gr.11 work there... using functions and integrating math,,, +10 BITS!

-----------------------------------
recneps
Tue Mar 23, 2004 9:23 pm


-----------------------------------
Dont say trig :/ (i hate math now as it is) and thanks ;D we're almost at parabola's! I can see mario jumps on the horizon! look out ppl! Sidescroller V2 Coming soon!

-----------------------------------
recneps
Tue Mar 23, 2004 9:37 pm


-----------------------------------
Here, new version. Call it by using

circlify(centrex,centrey,radius,colour)

:D

-----------------------------------
jonos
Tue Mar 23, 2004 10:21 pm


-----------------------------------
ooh ooh, nice... good use of math you have learned. we're still on feasible regions, which sucks :(

-----------------------------------
zylum
Wed Mar 24, 2004 12:08 am


-----------------------------------
here's a way using lines :


procedure drawCircle (centerx, centery, diam, c : int)
    var x, y, oldx, oldy : real
    oldx := cos (0) * diam + centerx
    oldy := sin (0) * diam + centery
    for i : 1 .. 360
        x := cosd (i) * diam + centerx
        y := sind (i) * diam + centery
        drawline (round (oldx), round (oldy), round (x), round (y), c)
        oldx := x
        oldy := y
    end for
end drawCircle

drawCircle (maxx div 2, maxy div 2, 100, 7)


here's a way to do fill oval


procedure drawCircle (centerx, centery, diam, c : int)
    var x, y, oldx, oldy : real
    for i : 1 .. 360 * (diam div 50)
        x := cosd ((i / (diam / 50))) * diam
        y := sind ((i / (diam / 50))) * diam + centery
        drawline (round (x) + centerx, round (y), round (-x) + centerx, round (y), c)
    end for
end drawCircle

drawCircle (maxx div 2, maxy div 2, 200, 7)


:P

-zylum

-----------------------------------
recneps
Wed Mar 24, 2004 3:48 pm


-----------------------------------
Arg, i really gotta learn sine and cosine. All the cool programs seem to use it.... :(

-----------------------------------
jonos
Wed Mar 24, 2004 3:52 pm


-----------------------------------
just wait till trig in math... thats where everything comes together.

-----------------------------------
WhatAmIDoing
Thu Mar 25, 2004 12:18 pm


-----------------------------------
the fill circle needs a delay of 10 or 15 on my comp other than that it's pretty good.  oh and what gr.11 are you in i spent untill feb. learning loops and if statements  we hust started string manipulation and my teacher don't belive in making games.

-----------------------------------
recneps
Fri Mar 26, 2004 4:04 pm


-----------------------------------
im in 10 and i took the initiative to teach myself some more (sadly no higher than gr 10 is offered at my school.) i had gr 10 last sem, and gr math this sem ;)
We did parabola's today. so heres drawparabola!!!

procedure drawparabola(position:int,height:int,angle:real)
var y:real:=0
%const angle := -.1
%const position := 100
%const height := 150
for x:1..200
y:=(angle*((x-position)**2))+height
drawdot(round(x),round(y),7)
end for
end drawparabola

drawparabola(100,150,-.1)

And the commented lines are the "default" ones, in case you change em and dont like it ;)

-----------------------------------
the_short1
Fri Mar 26, 2004 6:40 pm


-----------------------------------
that parabola is kinda simple... 

drawline at mid point to midpoint +25 to the right
then draw a line to the left... +25 and each repetition of loop lower that 25 -1 and add one to hight...

all the ones u did look nice tho... good job..

and ur cicle one lookz better then zylum.... his is not as smooth... A FIRST!
but zylums is way more complex

-----------------------------------
recneps
Fri Mar 26, 2004 7:37 pm


-----------------------------------
we JUST learned parabolas, itll improve with time ;)

-----------------------------------
Hackster
Sat Mar 27, 2004 1:04 am


-----------------------------------
Holy shinikeys man ... one day of parabolas and you're making programs with them ... that is a very good sign!!! (Youre gunna make a great programmer!) :D

-----------------------------------
recneps
Sat Mar 27, 2004 11:01 am


-----------------------------------
Well we havent even technically got into the equations of em, my friend is this math whiz and he gave me the equation ;)

-----------------------------------
something
Wed Mar 31, 2004 9:12 pm


-----------------------------------
wow...just...wow

I hate to do this but couldn't it be done simplier

something like:

for a : 0..360
drawarc (50,50, 50,50,0,a, 7)
delay (5)
end for

Just wanted to feel smart

-Sammi

-----------------------------------
the_short1
Thu Apr 01, 2004 9:53 pm


-----------------------------------
no wahts fun ny... i was just about to post that so i went into this thread and ,, there... u did it......... realy realy scary... 

i made a cool ball rotation with filled arcs...
for by upcoming program.. i wanted the balls that are bouncing around to be half one color half another color... and have the colors rotating.....

and that is why i was about to post... scray.... brains are alike,.,.

-----------------------------------
zylum
Thu Apr 01, 2004 10:35 pm


-----------------------------------
wow...just...wow

I hate to do this but couldn't it be done simplier

something like:

for a : 0..360
drawarc (50,50, 50,50,0,a, 7)
delay (5)
end for

Just wanted to feel smart

-Sammi


an arc isn't the same thing as a parabola -_-


- zylum

-----------------------------------
recneps
Fri Apr 02, 2004 9:07 pm


-----------------------------------
a parabola is a series of points, an arc is just a line :)
like when you throw a ball up, it goes up fast, slows down, then drops. if you measure height at each second, you get a series of points on a parabola. You cant throw a ball in an arc that way. Like say you were drawing a circle, and you wanted it to go up and then down again, you would use parabola, because the x and y change so its smooth.
Yes, i know thats a really long explanation and could probably be left off after the first sentence. But ok :D

-----------------------------------
zylum
Sat Apr 03, 2004 5:13 pm


-----------------------------------
well both an arc and a parabola are a series of points  :? in fact, a line is just a series of points

-----------------------------------
recneps
Sat Apr 03, 2004 8:09 pm


-----------------------------------
ok let me rephrase that. a parabola is drawn point by point throughout a loop. an arc is drawn once (at least with the drawarc command) :D

-----------------------------------
apomb
Sun Apr 11, 2004 2:42 pm


-----------------------------------
Hey, i know this thread is a little old, but i didn't want to make another thred, I made a parabola proggy too, its like a spinnint thing, check it out
View.Set ("nooffscreenonly,graphics:max;max")
loop
    var a : int := 0
    var x, i : int := Rand.Int (32, 103)
    loop
        x := 25
        cls
        loop
            x -= 1
            Draw.FillOval (a * x + maxx div 2, - (x * x) + maxy - 4, 5, 5, i)
            exit when x = -25
        end loop
        delay (20)
        a += 1
        exit when a = 17
    end loop
    a := 17
    loop
        x := 25
        cls
        loop
            x -= 1
            Draw.FillOval (a * x + maxx div 2, - (x * x) + maxy - 4, 5, 5, i)
            exit when x = -25
        end loop
        delay (20)
        a -= 1
        exit when a = 0
    end loop
end loop


-----------------------------------
recneps
Tue Apr 13, 2004 2:55 pm


-----------------------------------
thats pretty sweet ;D Have some bitsss

(and whoever said "if you give bits, you receive bits". You're 100% right ;) Everyone GIVE BITS!)

-----------------------------------
apomb
Mon Apr 19, 2004 2:34 pm


-----------------------------------
hey thanks man, i didn't see this post untill now! ya , i gave bits and now i'm recieving bits!!  here is another quote like that " If you want something, you must give it away"

-----------------------------------
the_short1
Mon Apr 19, 2004 3:12 pm


-----------------------------------
neat compswiz..... ill post some of my attemps at making cool sine curves here soon ok???

here have some bits.... (compwizz) cuz i made that parabola b4 i could (iu was thinking on making it ) ;)
