-----------------------------------
Entz
Wed Dec 03, 2003 10:17 pm
Need help with parabola-drawing
-----------------------------------
I need to draw a parabola or graph the movement of an object in Turing. I am having a bit of trouble as I can only draw 1 kind of parabola and it doesn't seem to want to be altered to the numbers specified.
-----------------------------------
Tony
Wed Dec 03, 2003 10:26 pm
-----------------------------------
showing your code would help with questions like that, so that someone can point out where you're having problems :)
-----------------------------------
Homer_simpson
Wed Dec 03, 2003 10:39 pm
-----------------------------------
View.Set ("offscreenonly")
var yy, y := 0
var a, b, c := 0.0
a := .001
b := 0
c := 50
for x : -320 .. 320
y := round (a * ((x + b) ** 2) + c)
for xx : -320 .. 320
yy := round (a * ((xx + b) ** 2) + c)
drawdot (xx + 320, yy, 9)
end for
drawfilloval (x + 320, y, 10, 10, 9)
View.Update
delay (10)
cls
end for
-----------------------------------
Entz
Wed Dec 03, 2003 11:47 pm
-----------------------------------
var setoff := 400
var y := 0
var a := 2
var b := 2
var c := 50
for x : -300 .. 300
y := round (a * (x + b) ** 2 + c) * -1
drawfilloval (x + 100, y + setoff, 1, 1, 5)
end for
^^^ this is really what I had in mind and THX for your help Homer.
its just that the value for setoff changes the size of my parabola.
-----------------------------------
Tony
Thu Dec 04, 2003 10:07 am
-----------------------------------
you guys should find two points (well... one point and keep previous in another variable) and draw a line between two points instead. Then the graph would look like a complete curve, not a bunch of scatered dots :D
-----------------------------------
Entz
Thu Dec 04, 2003 4:49 pm
-----------------------------------
THx that makes alot of scence. Finding one point at a time is so easy and plus it'll be more original than some stuff other people in my class will graph :)