Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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 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.

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!
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 6 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: