Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need help with parabola-drawing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Entz




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Homer_simpson




PostPosted: 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
Entz




PostPosted: 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.
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Entz




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: