0% found this document useful (0 votes)
18 views

006 - 2.0lab Assignment - Simulating A Ball Throw Using Processing

The document discusses a lab assignment to simulate projectile motion of a ball being thrown using Processing. Students are asked to simulate the motion from start to finish, plotting the location of the ball as a circle at different times. The key steps and equations for projectile motion are provided.

Uploaded by

iimsheung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

006 - 2.0lab Assignment - Simulating A Ball Throw Using Processing

The document discusses a lab assignment to simulate projectile motion of a ball being thrown using Processing. Students are asked to simulate the motion from start to finish, plotting the location of the ball as a circle at different times. The key steps and equations for projectile motion are provided.

Uploaded by

iimsheung
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

HKUSTx ISDN2300x

Help iimsheung
Digital Design

课程 进度 ⽇期 讨论 Resources 课程⼤纲 Grading Scheme 主讲教师

Course / Topic 5 P Color Theory / Lab Assignment P Processing and Unity Key Framing

Previous Next

Lab Assignment - Simulating a ball throw using Processing


Bookmark this page

Assignment: Simulating a ball throw using Processing

Go through the various Processing demos. Once you are familiar with the demos then attempt this assignment. You
will need to use projectile motion equations for this assignment. The equations are in the Appendix.

What you need to do is simulate a projectile motion of a ball thrown for a pre-determined velocity from a pre-
determined direction. These will be parameters you will assign at the start. The output should be the location of the
ball drawn as a circle from start to finish and the related time elapsed at each of those points as shown in Figure 1.
You will be given a bonus if you do the extra step of bouncing after hitting the floor. Save your image as a .jpg file and
submit so that it can be peer reviewed and graded,

NOTEI The acceleration due to gravity J 9.81 m/s2. However, coordinates on a screen are in pixels. So use a
conversion factor of, for example 200 pixels/m. Then convert all meter values to pixels with this conversion.

At start of the program let time t0 = millis(). Thereafter time t = millis()-t0. In the draw loop determine t, and then
calculate (x,y) and draw a circle at that point and write the corresponding time value, t as shown in Figure 1.

Figure 1. Sample output. Your plot should show from start of throw to the point at which the ball hits the floor. The
above figure shows only part of the projectile.

Appendix: Simple projectile motion equations

If the initial velocity in x direction is Vy0 then

Horizontal distance x J Vx0 t where t= time elapsed

Vertical distance y J Vy0 t W ½ (gt2)

Vertical velocity at point (x,y) Vy J Vy0 + gt

Sample Output of Assignment


字幕开始。跳转⾄结尾。

' By now you have had enough practice on


Processing, so this is the assignment
that you need to do. You need to simulate
a ball being thrown or ball being kicked,
at a certain velocity and at a thrown angle.
And you have to find the time
corresponding to each location
the ball is in. And the final map should be
with the time as you see
here and location as well. You need to have
! 0"00 / 0"33 % 1.0x & " # $ enough points

视频 字幕
下载视频⽂件 下载 SubRip (.srt) file
下载 Text (.txt) file

Previous Next

All Rights Reserved

edX Legal Connect


About Terms of Service & Honor Code Blog
Affiliates Privacy Policy Contact Us
edX for Business Accessibility Policy Help Center
Open edX Trademark Policy Media Kit
Careers Sitemap Donate
News

© 2021 edX Inc. All rights reserved.


深圳市恒宇博科技有限公司 粤ICP备17044299号P2

You might also like