Animation and CS Philip Chan. Animation Hand-drawn Early Disney movies.

Slides:



Advertisements
Similar presentations
Graphing Linear Equations By: Christine Berg Edited By: VTHamilton.
Advertisements

The equation of a line - Equation of a line - Slope - Y intercept
Slope intercept form of an equation
Graphing Using Slope - Intercept STEPS : 1. Equation must be in y = mx + b form 2. Plot your y – intercept ( 0, y ) 3. Using your y – intercept as a starting.
Starter Activity Write the equation of a circle with a center of
Systems of Linear Equations Recalling Prior Knowledge.
WARM UP Evaluate 1.3x + y for x = 4 and y = 3 2.x² + 7 for x = 7 5 Minutes Remain.
Functions. A function is a relation that has exactly one output for each input.
3.2 Graphing Functions and Relations
Is this relation a function? Explain. {(0, 5), (1, 6), (2, 4), (3, 7)} Draw arrows from the domain values to their range values.
Relation Input Output Function Domain Range Scatter Plot Linear Equation x - intercept y- intercept Slope Rise Run.
2.7 – Absolute Value Inequalities To solve an absolute value inequality, treat it as an equation. Create two inequalities, where the expression in the.
2.3 – Slopes, Forms of Lines. Slope Slope = measure of steepness of a line in the Cartesian plane for two points Slope = m = Two ways to calculate slope:
Analyzing Data using Line Graphs Slope & Equation of a Line.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 7 Algebra: Graphs, Functions, and Linear Systems.
x y Straight Line Graphs m gives the gradient of the line and.
4.4 Slope Formula.
DOMAIN, RANGE, AND INTERCEPTS NOTES: 9/8. DOMAIN The set of all input values of a function.  x RANGE The set of all output values of a function.  f(x)
Example 2 Graphing Using Slope-Intercept Form 1
OBJECTIVE: USE THE SLOPE INTERCEPT FORM TO GRAPH A LINE Slope Intercept Form.
Graphing Equations Slope Intercept form and Point Slope form.
Point-Slope Form Linear Equations in Two Variables.
Writing Equations from Tables
Section 2.3 Linear Functions and Slopes
Graphing Linear Equations
Slope-Intercept and Standard Form of a Linear Equation.
Today we will graph linear equations in slope intercept form.
Warm Up Find each y-intercept. 1. y = 3x x – 3y = 12 2 –4
Quick Graphs of Linear Equations
Standard and Slope-Intercept Form
Graphing Linear Equations
Writing Equations From Graphs
5.3 Slopes of Straight Lines
Graphing Linear Equations
Linear Equations in two variables
Objective- To use slope and y-intercept to
Quick Graphs Using Slope-Intercept Form
Slope and Graphing.
Uniform motion.
Warm up 20 Find the slope: 1.) (4,0) (5,7) 2.) (-3,3) (-3, -2)
Objective The student will be able to:
Objective The student will be able to:
Tables and Relations Review
Algebra: Graphs, Functions, and Linear Systems
Quick Graphs of Linear Equations
Graphing Linear Equations
Determining an Equation of a Line
x-Value = The horizontal value in an ordered pair or input Function = A relation that assigns exactly one value in the range to each.
Warm - up Write the equation in vertex form..
Lesson 5.1 – 5.2 Write Linear Equations in Slope-Intercept Form
Example 1A: Graphing by Using Slope and y-intercept
Objectives Graph lines and write their equations in slope-intercept and point-slope form. Classify lines as parallel, intersecting, or coinciding.
Tables and Relations Review
Warm - up Write the equation in vertex form..
Graphing Systems of Equations
Bell Ringer If (x) = 3x + 2, then what is the solution of f(2). Hint: substitute 2 in for x. 2) If f(x) = 2x2 – 3x + 4, then what is f(3), or what’s.
Section 3.3 The Slope of a Line.
Objective graph linear equations using slope-intercept form.
Equations of Lines Point-slope form: y – y1 = m(x – x1)
Find the y-intercept and slope
GRAPHING EQUATIONS OF LINES
Domain-Range Graphing f(x) Notation Calculating Slope
Objectives: To graph lines using the slope-intercept equation
4 minutes Warm-Up Graph. 5x – 4y = 20 2) x = 5 3) y = -2.
Introduction to Functions & Function Notation
Warm up 21 1.) Determine the slope and y intercept of the line y=7x ) Determine the slope and the yintercept of the line 7x- 4y=3 3.) Graph y=1/2.
Coordinates Picture For each instruction, join up the coordinates.
Algebra: Graphs, Functions, and Linear Systems
Graphing using Slope-Intercept Form
Graphing Linear Equations
Presentation transcript:

Animation and CS Philip Chan

Animation Hand-drawn Early Disney movies

Animation Hand-drawn Early Disney movies Computer-drawn Pixar movies

Animation A sequence of drawings Shown to the audience quickly “flip book”

A simple animation A stick figure kicking a ball What are the basic shapes that you need?

A simple animation A stick figure kicking a ball What are the basic shapes that you need? lines circles

Drawing a Line

Input Starting point: (x1, y1) Ending point: (x2, y2) Output A line from (x1,y2) to (x2, y2) How?

Drawing a Line Same as plotting an equation on graph paper

Drawing a Line Same as plotting an equation on graph paper Given an equation: y = f(x)

Drawing a Line Same as plotting an equation on graph paper Given an equation: y = f(x) 1. Determine the x interval (domain) 2. Sample x values 3. Calculate the corresponding y values (range) 4. Plot the (x, y) pairs

Equation for a Line What is the equation for a line?

Equation for a Line What is the equation for a line? y = mx + b What is m? What is b?

Equation for a Line Given (x1, y1) [start] and (x2, y2) [end]? How to determine m and b?

Finding Slope m (x2, y2) (x1, y1)

Finding Slope m (x2, y2) (x1, y1) ?

Finding Slope m (x2, y2) (x1, y1) y2-y1 ?

Finding Slope m m = rise / run (x2, y2) (x1, y1) y2-y1 x2-x1

Finding Slope m m = rise / run m = (y2 – y1) / (x2 – x1) (x2, y2) (x1, y1) y2-y1 x2-x1

Finding y-intercept b y = mx + b Plug in the calculated m and given (x1,y1) y1 = m*x1 + b Solve for b

Finding y-intercept b y = mx + b Plug in the calculated m and given (x1,y1) y1 = m*x1 + b Solve for b b = ?

Finding y-intercept b y = mx + b Plug in the calculated m and given (x1,y1) y1 = m*x1 + b Solve for b b = y1 - m*x1

Calculating Slope m = slope = (y2 – y1) / (x2 – x1) Could have a problem?

Calculating Slope m = slope = (y2 – y1) / (x2 – x1) Could have a problem? x2 – x1 could be zero Division by zero! What kind of line is that?

Vertical Lines x1 is the same as x2 Don’t need the equation Change y values from y1 to y2 Without changing x

Equation for a Line -- Summary Given (x1, y1) [start] and (x2, y2) [end] y = mx + b m = (y2 – y1) / (x2 – x1) If x2 and x1 are not the same b = y1 - m*x1

Drawing a Line (reminder) Same as plotting an equation on graph paper Given an equation: y = f(x) 1. Determine the x interval (domain) 2. Sample x values 3. Calculate the corresponding y values (range) 4. Plot the (x, y) pairs

Algorithm Summary If not a vertical line Find equation for the line By calculating slope (m) and y-intercept (b) For each x value from x1 to x2 (domain) Calculate corresponding y value Plot the (x, y) pair Else For each y value from y1 to y2 Plot the (x, y) pair

Drawing a Circle

Input Center (a, b) Radius r Output A circle centered at (a,b) with radius r

Drawing a Circle Similar to a line Find the equation Sample x values Calculate the corresponding y values Plot the (x,y) pairs

Equation for a Circle (a,b) (x,y) r

Equation for a Circle (a,b) (x,y) r

Equation for a Circle (a,b) (x,y) r ?

Equation for a Circle (a,b) (x,y) r x-a ?

Equation for a Circle (a,b) (x,y) r x-a y-b

Equation for a Circle (a,b) (x,y) r x-a y-b

Equation for a Circle

Domain of x Values (a,b) (x,y) r x-a y-b (?,?)

Domain of x Values (a,b) (x,y) r x-a y-b (a+r, b)(a-r, b)

Each x Value has Two y Values (a,b) (x,y) r x-a y-b (a+r, b)(a-r, b)

Each x Value has Two y Values

Algorithm Summary For each x value from a-r to a+r (domain) Calculate the corresponding two y values Using the equation for a circle Plot the two (x,y) pairs

Drawing a Filled Circle

Fill the Circle with a Color Ideas?

Fill the Circle with a Color How would you systematically fill it by hand?

Fill the Circle with a Color Hint: you have two y values for each x

Algorithm Summary For each x value from a-r to a+r (domain) Calculate the corresponding two y values (y1 and y2) Using the equation for a circle Draw vertical line between (x,y1) and (x,y2)

Drawing a Moving Ball

Basic ideas for moving a ball?

Drawing a Moving Ball Drawing the ball in a different location for each frame/image Sequence of images flipbook

Moving a Ball in a Straight Line Input Center of ball and starting point (x1,y1) Radius of ball r Ending point (x2, y2) Output Moving a ball with radius r from (x1, x2) to (x2, y2)

Moving a Ball in a Straight Line Redraw the ball At a different center Along a straight line Using the equation for a line

Two Approaches to a Moving Ball 1. Multiple pictures Each picture is different Ball at different locations

Two Approaches to a Moving Ball 1. Multiple pictures Each picture is different Ball at different locations 2. One picture Edit the picture Ball at different locations

Two Approaches to a Moving Ball 1. Multiple pictures Each picture is different Ball at different locations 2. One picture Edit the picture Ball at different locations Tradeoffs? When the picture has only a moving ball

Two Approaches to a Moving Ball 1. Multiple pictures Each picture is different Ball at different locations 2. One picture Edit the picture Ball at different locations Tradeoffs? When the picture has only a moving ball When the picture has many stationary objects (e.g. buildings), and only one moving ball

Algorithm Summary (using only one picture) At each (x,y) along a straight line from (x1,y1) to (x2,y2) Draw a filled circle centered at (x,y) Show the picture Delay/sleep for some time Why? Erase the filled circle centered at (x,y) Why? How?