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

Username:   Password: 
 RegisterRegister   
 Pixel graphics problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
FearingFiend




PostPosted: Sun Nov 03, 2002 8:37 pm   Post subject: Pixel graphics problem

Hi there, I found your cool forum on a search engine. I was looking for help on this turing problem I have. Anyways, here it is:

Draw a ball in motion starting at the top of the scren so that its center moves to the position it would move to under gravity in each step of the animation. The equation for the y-coordinate of the center is

y = ymax - (1/2) * a * t **2

where a is the acceleration of gravity, namely 32 m sec - 2, and t is the time in seconds. If each pixel is in the y-direction represents 1 meter choose an appropriate time scale to watch the motion : in real time, in slow motion, and in time lapse motion.

I would appreciate any help you all can give me. Thanks Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Nov 06, 2002 8:16 am   Post subject: (No subject)

acceleration due to gravity is 9.81 m/s^2 [toward center of earth... which is usually down]


Though I lost the formula for calculation :S
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
JayLo




PostPosted: Tue Nov 26, 2002 11:30 pm   Post subject: HELP!

so how do you do it? I also have the same problem with this question. Please explain.
Tony




PostPosted: Wed Nov 27, 2002 12:31 am   Post subject: (No subject)

well here's the code (assume gravity is 10 for easier calculations)

code:
var y:int := maxy %height of ball

for i:1..10 %drop for 10 seconds
y:= y - 10*i %find new height of the ball, since it falls
                   %gravityConstant*time passed per second
drawoval(100,y,5,5,red) %draw ball
delay(1000) %delays a second for realistic results and so you can see
cls %clears screen... remove to see where ball was at each second
end for


I hope this helps you guys
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
FizixMan




PostPosted: Wed Nov 27, 2002 1:07 am   Post subject: (No subject)

Rats... you beat me too it by half an hour Mad
anyhow, and if you want to apply an inputted scale, try multiplaying it against the "t" value. Just make sure you use brackets in the right way 'cause BEDMAS rules all... (took me half an hour to figure that out...)
JayLo




PostPosted: Fri Nov 29, 2002 4:50 pm   Post subject: (No subject)

Thank you! great help!
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: