Computer Science Canada

Pixel graphics problem

Author:  FearingFiend [ 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

Author:  Tony [ Wed Nov 06, 2002 8:16 am ]
Post 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

Author:  JayLo [ 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.

Author:  Tony [ Wed Nov 27, 2002 12:31 am ]
Post 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

Author:  FizixMan [ Wed Nov 27, 2002 1:07 am ]
Post 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...)

Author:  JayLo [ Fri Nov 29, 2002 4:50 pm ]
Post subject: 

Thank you! great help!


: