Need help with parabola-drawing
Author |
Message |
Entz
|
Posted: Wed Dec 03, 2003 10:17 pm Post subject: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed Dec 03, 2003 10:26 pm Post subject: (No subject) |
|
|
showing your code would help with questions like that, so that someone can point out where you're having problems ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Homer_simpson
![](http://compsci.ca/v3/uploads/user_avatars/18138546704b4d2a3b2e50e.gif)
|
Posted: Wed Dec 03, 2003 10:39 pm Post subject: (No subject) |
|
|
code: | 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 |
|
|
|
|
|
![](images/spacer.gif) |
Entz
|
Posted: Wed Dec 03, 2003 11:47 pm Post subject: (No subject) |
|
|
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. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Dec 04, 2003 10:07 am Post subject: (No subject) |
|
|
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 ![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Entz
|
Posted: Thu Dec 04, 2003 4:49 pm Post subject: (No subject) |
|
|
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 ![Smile Smile](http://compsci.ca/v3/images/smiles/icon_smile.gif) |
|
|
|
|
![](images/spacer.gif) |
|
|