Pixel graphics problem
Author 
Message 
FearingFiend

Posted: 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 ycoordinate 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 ydirection 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






Sponsor Sponsor



Tony

Posted: 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

Tony's programming blog. DWITE  a programming contest. 




JayLo

Posted: 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

Posted: 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

Tony's programming blog. DWITE  a programming contest. 




FizixMan

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


Rats... you beat me too it by half an hour
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

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


Thank you! great help!







