Animation Lecture 17 Wed, Oct 3, 2007.

Slides:



Advertisements
Similar presentations
Rotation, Angular Momentum and Gravity
Advertisements

Range, Height and Time.
IS660Z Programming Games Using Visual Basic Overview of Cannonball.
Parametric Equations Here are some examples of trigonometric functions used in parametric equations.
General Physics 1, Lec 8 By/ T.A. Eleyan 1 Lecture 8 Circular Motion & Relative Velocity.
Physics 151: Lecture 5, Pg 1 Announcements: l Physics Learning Resource Center Open, –> room P207-C çOpen 9am - 5 pm Monday - Friday çHours also listed.
Physics 106: Mechanics Lecture 01
Physics 111: Mechanics Lecture 3
Measuring Rotational Motion
1 Chapter 6: Motion in a Plane. 2 Position and Velocity in 2-D Displacement Velocity Average velocity Instantaneous velocity Instantaneous acceleration.
Acceleration & Speed How fast does it go?. Definition of Motion Event that involves a change in the position or location of something.
Parametric Equations. You throw a ball from a height of 6 feet, with an initial velocity of 90 feet per second and at an angle of 40º with the horizontal.
Rotational Motion 2 Coming around again to a theater near you.
Project 6 Tumbling Cube Fri, Nov 21, 2003 Due Mon, Dec 8, 2003.
Copyright © Cengage Learning. All rights reserved. CHAPTER Radian Measure 3.
Questions Alice. Functionality A question receives value(s), performs some computation on the value(s), and returns (sends back) a value.
Projectiles Motion in Two Dimensions Chapter 7. Projectile An object launched into the air by a force Trajectory The path followed by a projectile.
Circular Motion. Rotational Quantities A O r  dAdA A point on an object, located a distance r from a fixed axis of rotation, rotates in such a way that.
Circular Motion Circumference:2  r Period = T:definition? Basic quantities in circular motion:
Trigonometry and Applications References: xyz. Review (?) from ETGG1801 Angles – As a measure of rotation and/or orientation – Radians & Degrees (and.
Physics 141MechanicsLecture 2 Kinematics in One Dimension Kinematics is the study of the motion of an object. We begin by studying a single particle in.
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.
Radian application Problems What is angular speed? How is it used to solve problems? What t is linear speed?
Physics 141MechanicsLecture 4 Motion in 3-D Motion in 2-dimensions or 3-dimensions has to be described by vectors. However, what we have learnt from 1-dimensional.
3 Radian Measure and Circular Functions
Physics 111 Rotational Motion + inertia
PHYS 1441 – Section 501 Lecture #12
Ch 4: Motion in Two and Three Dimensions
GENERAL & RECTANGULAR COMPONENTS
Circular Motion How do we work out the velocity of something which is moving at constant speed in a circle ? Answer: We use the simple formula: But in.
Position Displacmen. Position Displacmen Instantaneous velocity Average velocity Instantaneous velocity (Or velocity) but Example:
Circular Motion.
Centripetal Acceleration and Force
Kinematics Uniform Circular Motion
Physics 201, Lect. 6 Feb.4, 2010 Chapter 3: Motion in two- and three-dimensions Examples and application.
MATH 1330 Section 4.2.
Animation Lecture 14 Wed, Oct 5, 2005.
Solve the differential equation. {image}
Angular Displacement and Speed
Speed How fast does it go?.
PHYS 1443 – Section 003 Lecture #16
Chapter 4-3 The Foundations of Physical Science
GENERAL & RECTANGULAR COMPONENTS
Ch.5, Sec.1 – Measuring Motion
Physics 207, Lecture 5, Sept. 20 Agenda Chapter 4
Parametric Equations & Plane Curves
Inverse Kinematics 12/30/2018.
Section 10.7 Parametric Equations
RECTILINEAR KINEMATICS: CONTINUOUS MOTION
Last Time: Collisions in 1- and 2-Dimensions
Rotation Kinematics.
Uniform circular motion
A Review of Kinematics SPH4U
Kinematics Vectors and Motion
Motion.
10.4 Parametric Equations Parametric Equations of a Plane Curve
The Basics of Physics with Calculus – Part II
Functions Alice.
Circular Motion Standard 9.
Rotational Motion Let’s begin with Rotational Kinematics!!
10.4 Parametric Equations.
12.6: Vector Magnitude & Distance
Kinematics of Wheeled Robots
MATH 1330 Section 4.2.
GENERAL & RECTANGULAR COMPONENTS
Functions Alice.
Functions Alice.
Fundamentals of Physics School of Physical Science and Technology
Functions Alice.
Presentation transcript:

Animation Lecture 17 Wed, Oct 3, 2007

Animation Animation may include Moving the objects in the scene. Changing the shapes of objects. Moving the camera through the scene.

Moving Objects Typically objects move with constant velocity or constant acceleration. If velocity is constant, then position(t) = vt + s0. If acceleration is constant, then velocity(t) = at + v0, position(t) = ½ at2 + v0t + s0.

Constant Velocity Assume Then x(t) = vt + s0. The velocity is constant, The motion is in the x direction only. Then x(t) = vt + s0. During a time interval t, v is constant (so v = 0), and The position changes by x = vt.

Constant Velocity The clock will give us the time interval t. Get the initial time t0 by last = clock(). Get the time interval as t = clock() – last. Update last.

Updating the Position void idle() { int now = clock(); float time = (float)(now – last)/CLOCKS_PER_SEC; pos.x += v*time; last = now; return; }

Constant Acceleration When an object is accelerating, its position and speed are changing. If the acceleration is constant, then The speed changes linearly. The position changes quadratically.

Constant Acceleration In this case, we may use position(t) = ½ at2 + v0t + s0 to compute the present position, or We may store the current position and current velocity and update both of them. We will use the second option.

Updating Position and Velocity A simple calculation is v = at, x = vt.

Updating Position and Velocity However, if a > 0, then v = at, v = v + v x = vt. x = x + x will overestimate x , while…

Updating Position and Velocity x = vt. x = x + x v = at, v = v + v will underestimate x . Why? Does it matter?

Updating Position and Velocity It turns out that if a is constant, then we can use the average velocity vavg over the time interval t and get the correct value for x. That is, v = at vavg = (v + (v + v))/2 = v + ½ v x = vavgt.

Updating Position and Velocity void idle() { int now = clock(); float time = (float)(now – last)/CLOCKS_PER_SEC; v_new = v + a*time; pos.x += 0.5*(v + v_new)*time; v = v_new; last = now; return; }

Circular Motion By incrementing the angle in the idle() function, we may use glRotate() to rotate an object or to move it in a circle.

Changing the Shape of Objects Objects can be compressed or stretched by calling Scalef() with variable scale factors. Increment the scale factors in idle(), using the clock() function.

A Rolling Ball In the next demo, a red ball appears to roll along a strip. Is the ball really rolling?

A Rolling Ball Read Run

A “Rolling” Beachball Make the plain red ball a beachball. Now we can tell whether the ball is rolling.

A “Rolling” Beachball Read Run

Let’s Get This Ball Rolling! Now we will add a rotation to make the ball roll. The rate of rotation must be coordinated with the distance the ball moves, or else the ball will appear to be slipping or spinning.

An Accelerating Beachball Read Run

An Accelerating Beachball Suppose that the ball moves a distance x. Then it has rolled a distance x along its circumference. If r is the radius, then the angle is x/r, in radians. Perform the rotation: glRotatef((180.0/PI)*dx/rad, 0.0, 0.0, 1.0);

Rolling Beachball in 2D In the final rolling-ball example, the ball is rolling around in a 2D plane. It is easy to calculate the ball’s position. However, it’s orientation depends on the particular path it followed to get there. That is, we must know the previous orientation to compute the new orientation.

Rolling Beachball in 2D Read Run

Stretching the Beachball Read Run

The Bouncing Ball The bouncing ball in the following example animates the shape of the object, as well as its position.

Bouncing Ball

Bouncing Ball The ball bounces in a semicircular arc.

Simulation of Motion in General Let the position of an object be given by P(t) = (x(t), y(t), z(t)). Then the change in position is given by P(t) = (x(t), y(t), z(t)). We may approximate this by P(t) = (x(t)t, y(t)t, z(t)t) P(t) += P(t).

A More Realistic Bounce We want the ball’s trajectory to be a parabola with height h and let s be the time required to travel this trajectory. For simplicity, assume that y(0) = 0. Then y(s/2) = h, y(s/2) = 0, and y(s) = 0. What is the formula for y(t)?

A More Realistic Bounce The equation of a parabola is quadratic. Therefore, y(t) = at2 + bt + c for some numbers a, b, c. To find a, b, and c, we solve the equations y(0) = c = 0 y(s/2) = as2/4 + bs/2 + c = h y(s) = as2 + bs + c = 0 y(s/2) = as + b = 0.

A More Realistic Bounce The solution is a = -4h/s2, b = 4h/s, c = 0. So, y(t) = -4h(t/s)2 + 4h(t/s). Then y(t) = -8ht/s2 + 4h/s = (4h/s)(1 – 2t/s).

A More Realistic Bounce We program this as time += deltaT; ballPos.x += (bDist/bRate)*deltaT; ballPos.y += (4.0*bHgt/bRate)*(1.0 – 2.0*time/bRate)*deltaT;

A More Realistic Bounce