CS 282.  Questions about Assignment 1?  Questions about last week’s lab?  Otherwise, please sit next to your partner (or someone else if your partner.

Slides:



Advertisements
Similar presentations
Potential Energy, Conservation of Energy
Advertisements

Physics Conservation of Energy Science and Mathematics Education Research Group Supported by UBC Teaching and Learning Enhancement Fund Department.
CS 282.  Any question about… ◦ SVN  Permissions?  General Usage? ◦ Doxygen  Remember that Project 1 will require it  However, Assignment 2 is good.
ConcepTest Clicker Questions
Chapter 15 Energy Assignments 15.1 Math Skills 1-3 p 448; AQs 1-9 p452
Click here to enter. Click a menu option to view more details Starters Main Courses Desserts Click on the coffee cup to return when Navigating For Vocabulary.
CS 282.  Review of projectile physics  Examine gravity projectile model  Examine drag forces ◦ Simulate drag on a projectile  Examine wind forces.
Fall Final Review WKS: WORD PROBLEMS Part II. 1. A car travels at a constant speed of 15 m/s for 10 seconds. How far did it go?
CS 282.  Last week we dealt with projectile physics ◦ Examined the gravity-only model ◦ Coded drag affecting projectiles  Used Runge-Kutta for approximating.
Physics of Rolling Ball Coasters Cross Product Torque Inclined Plane Inclined Ramp Curved Path Examples.
Science w/ Ms. Hendryx 9/22/11. Velocity: m/s (distance over time) Position: m (distance) Acceleration: m/s 2 (distance over time squared) Mass: kg Force:
Physics 218, Lecture XI1 Physics 218 Lecture 11 Dr. David Toback.
Physics of Rolling Ball Coasters
Physics 218 Lecture 11 Dr. David Toback Physics 218, Lecture XI.
Linear Momentum Lecturer: Professor Stephen T. Thornton
Chapter 4: Accelerated Motion in a Straight Line
Newton’s Third Law of Motion
Chapter 15 Energy Assignments 15.1 Math Skills 1-3 p 448; AQs 1-9 p452

The Loop Design Challenge Start Gate Design Challenge The Hill Design Challenge The Figure 8Design Challenge The Stop Design Challenge.
A Solidify Understanding Task
The ability to cause change. DO NOW  Pick up notes sheet and half sheet.
Unit 2 Lesson 2 Kinetic and Potential Energy
Work and Energy Energy Chapter 5: Section 2. Learning Targets Identify several forms of energy Calculate kinetic energy for an object Distinguish between.
Using the “Clicker” If you have a clicker now, and did not do this last time, please enter your ID in your clicker. First, turn on your clicker by sliding.
Jeopardy Q 1 Q 2 Q 3 Q 4 Q 5 Q 6Q 16Q 11Q 21 Q 7Q 12Q 17Q 22 Q 8 Q 13 Q 18 Q 23 Q 9 Q 14 Q 19Q 24 Q 10 Q 15 Q 20Q 25 Final Jeopardy Conservation Energy.
Linear Motion Chapter 2. Review time! Remember when we were using math in physics….
Explain why an object traveling in a circular path at a constant speed has acceleration. Circular motion Objects traveling in a circular path at a constant.
ELECTRIC POTENTIAL September 13, 2006 Goings On For the Next Few Days Quiz Today – Gauss/Electric Field Quiz Today – Gauss/Electric Field Today – Begin.
Notes on Motion VI Free Fall A Special type of uniform acceleration.
Energy Physics December 9/12/13. Objectives Define mechanical energy Define kinetic and potential energy Describe the work-energy theorem State the law.
Reading and Review. A mass attached to a vertical spring causes the spring to stretch and the mass to move downwards. What can you say about the spring’s.
Physics Circular Motion: Energy and Momentum Conservation Science and Mathematics Education Research Group Supported by UBC Teaching and Learning Enhancement.
Physics Lab Agenda – Thursday 12/16/04 – Pick-up materials on front desks – Intro to Horizontal Motion Lab – Bring physics HW to do in class.
Recoil and Collisions 8.01 W07D1 Associated Reading Assignment: Young and Freedman:
Chapter 5.2. What do you think? What is meant when scientists say a quantity is conserved? Describe examples of quantities that are conserved. Are they.
Energy Physics 4 th Six Weeks. What is Energy? Energy is defined as the ability to produce a force. Energy is also defined as the ability to cause a change.
Energy in Motion 8SCIENCE. How is energy related to motion? Energy of matter in motion is called kinetic energy – Energy is the ability to cause a change.
Bell Ringer 11/13 Explain the difference between KINETIC energy and POTENTIAL energy: Also: get out your TEST: ENERGY and MOMENTUM (I passed it out yesterday)
Chapter 2 Motion in One Dimension. Motion is relative.
Conservation of Energy IT’S THE LAW. Lifting a Ball When you lift a ball to a certain height you do work on it. When you lift a ball to a certain height.
Conservation of Energy Using Conservation of Energy to solve problems.
4.2 A Model for Accelerated Motion. Chapter Objectives  Calculate acceleration from the change in speed and the change in time.  Give an example of.
Calculating g: Part II Dropping Pumpkins from the Stadium! Review: Freefall Lab: Calculating g Wrapping Up…
IB Physics 11 Mr. Jean November 3 rd, The plan: Video clips of the day Work Potential energy –Gravitational potential kinetic energy.
ENERGY Energy cannot be created or destroyed, it can only change forms.
Today: (Ch. 7) Momentum and Impulse Conservation of Momentum Collision.
Unit 2 Lesson 2 Kinetic and Potential Energy
S4 Physics Forces
Physics 11 Mr. Jean April 19th, 2012.
Unit 2 Lesson 2 Kinetic and Potential Energy
Potential & Kinetic Energy
Unit 2 Lesson 2 Kinetic and Potential Energy
Motion in two directions
Motion in two directions
Emma Taila & Nicolas Petruzzelli
Momentum Chapter 1 Section 3.
Potential & Kinetic Energy
PES 1000 – Physics in Everyday Life
Work and Energy Mr. I.
Potential & Kinetic Energy
Potential Energy.
Work AP Physics C.
Step 1: Get Organized Draw a picture.
Kinetic and Potential Energy
Day 2 At A Glance So today will have the following: 1) HW Talk
A.1. Knows High Expectations Snow Day Materials: pencils and paper
Pre Assessment Discussion
Presentation transcript:

CS 282

 Questions about Assignment 1?  Questions about last week’s lab?  Otherwise, please sit next to your partner (or someone else if your partner isn’t here)!

 We are going to make a ball fall and bounce off a table… with physics!  In a nutshell, ◦ Get a ball to fall in the framework ◦ Collision checking ◦ Changing velocity ◦ Energy Relationships  And for the over achievers… ◦ Realistic animation

 First of all, download the framework for today’s lab ( Resources in class website)  Take a look at the framework. Namely ◦ The body class (body.h and body.cpp) ◦ lab3.cpp (the driver)  Notice that the body class has ◦ 3 vectors: position, velocity, acceleration ◦ 2 scalars: mass, energy  So now let’s make the ball fall!

 How do you update the position of the ball? ◦ For now, we are going to assume the ball can only move in the y-direction, so ignore x and z. ◦ If you know the velocity and the delta time, you can update the position!  How do we get delta time? ◦ Since we have a clock class, and a clock called “delta_time” in our driver, all we need to do is call the measure_reset() function  We use measure_reset because delta time should be reset after its value is read.

 Go into body.cpp ◦ Edit the “update_position” function  Add the C++ equivalent of: y_position = y_position + ( y_velocity * delta_t )  Go into lab3.cpp ◦ Notice the variable “sphere” and its parameters  For this exercise, we let the sphere have an initial velocity of -2.0 ◦ Look at the DrawGLScene() function  Notice the part commented “Sphere Physics”  Under “Sphere Physics” use the global_time object and update_position function to correctly update sphere’s postion.

 Our ball fell magnificently! ◦ But it also fell through the table…  Since we never check for a collision between the ball and the table, there is no interaction between them  We need to fix that!

 Things to consider when doing collision ◦ The position of your object (in this case, the ball) ◦ It’s size ( radius for us ) ◦ The position of the object we want to check  You want to make the ball stop when it hits the table. ◦ The table is situated at ( 0.0, -0.5, 0.0) ◦ The radius of the ball is 0.5 ◦ Conveniently, this allows us to just check the collision at 0.0  Go into body.cpp ◦ Modify the update_position function  The ball should stop when it touches the table

 Our ball now stops at the table… ◦ But something is still wrong  The ball is falling at constant speed – which would be OK if there was no acceleration. ◦ Unfortunately for us, we have gravity  So we need to update our velocity based on acceleration  Acceleration due to gravity is m/s 2

 Examine the your change to update_position ◦ It should be testing for y_position >=0  Add this same check to update_velocity ◦ Inside the check, add the C++ equivalent of:  y_velocity = y_velocity + (delta_t * gravity)  This should be the only statement inside of this check right now.  At this point, our ball will accelerate until it touches the table.

 But something is still missing…

 Next we will make the ball bounce.  For now, we will just switch the sign of the y velocity once the ball has hit the ground  Go to body.cpp ◦ In update_velocity, add a check to switch the velocity sign. In other words:  If y_position < 0, switch y_velocity signs  The ball now bounces up and down!

 We are still missing one more thing – when the ball hits the ground, it should not bounce up to the same height.  The ball starts off with a certain amount of potential energy. When it hits the ground, this energy is converted to both kinetic and thermal energy.  Thus we our ball will have a lower kinetic energy, and will not bounce as high!

 First, you need to figure out the initial potential energy of the ball. ◦ E p = m*g*h  mass * 9.81 * height of the ball ◦ Go to body.cpp, and calculate energy in the constructor (since we know all our parameters at that point already!)  Next, we need to remove some things ◦ Remove the if statement in update_position ◦ Remove the if-else in update_velocity

 At this point, your update_velocity and update_position functions should have 1 line of code.  We need to know, however, when the ball has hit the table (or gone underneath it) ◦ Before you change the y-position in update_position, add a check for this and manually set the y-position to 0 (I’ll explain why we do this later).  Inside this check you’ve added, we can know calculate energy and our new velocity!

 To account for thermal energy, reduce the ball’s energy by 20% ◦ energy *= 0.8  You have your energy and mass, therefore you can solve this equation for velocity ◦ E k = ½ m*v 2  Math time! Solve the equation for v to get the equation you need. ◦ Now set your y-velocity to this new velocity  Congratulations! You have successfully implemented a (quasi) realistic bouncing ball!

 Manually setting the position of the ball to 0 is an incorrect way of animating what’s really occurring. The correct way is to detect the instant the ball hits the table, and subtract that from your recorded delta time. ◦ animation_t = delta_t – collision_t  Then, you can animate the ball bouncing up for this amount of time, and this will be the “realistic” way of animating your ball.