Graphics Animation Using Borland’s bgi Mr. Dave Clausen La Cañada High School.

Slides:



Advertisements
Similar presentations
Line Drawing Algorithms
Advertisements

Physics: Principles with Applications, 6th edition
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Drawing Elementary Figures Dr. Eng. Farag Elnagahy.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
PROJECTILE By, Dr. Ajay Kumar School of Physical Education D.A.V.V. Indore.
Linear Motion Chapters 2 and 3.
Course Website: Computer Graphics 4: Viewing In 2D.
1 Computer Graphics Week6 –Basic Transformations- Translation & Scaling.
CIS101 Introduction to Computing Week 12. Agenda Your questions Solutions to practice text Final HTML/JavaScript Project Copy and paste assignment JavaScript:
CS 106 Introduction to Computer Science I 02 / 12 / 2007 Instructor: Michael Eckmann.
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Physics 218 Lecture 11 Dr. David Toback Physics 218, Lecture XI.
Functions and Equations of Two Variables Lesson 6.1.
Numerical Solutions of Differential Equations Taylor Methods.
C How to Program, 6/e Summary © by Pearson Education, Inc. All Rights Reserved.
Introduction In an equation with one variable, x, the solution will be the value that makes the equation true. For example: 1 is the solution for the equation.
The Insertion Sort Mr. Dave Clausen La Cañada High School.
Chapter 8 Graphing Linear Equations. §8.1 – Linear Equations in 2 Variables What is an linear equation? What is a solution? 3x = 9 What is an linear equation.
Graph an equation in standard form
AIM: How can we describe the path of an object fired horizontally from a height above the ground? DO NOW: A ball rolls off a table top with an initial.
Mr. Huynh.  A linear equation can contain many parts such as this one: y = 2 x + 6. What does this all mean? To break it down, we must look at the initial.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Lecture 3 Transformations.
Visual Basic .NET BASICS
CPS120 Introduction to Computer Science Iteration (Looping)
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Physics. Good News/Bad News: These are the same formulas we used for linear motion. Do you know them? If the answer is “NO”, then get familiar with them.
Physics pre-AP. Equations of motion : We assume NO AIR RESISTANCE! (Welcome to “Physicsland”), therefore… The path of a projectile is a parabola. Horizontal.
Physics Honors. Good News/Bad News: These are the same formulas we used for linear motion. Do you know them? If the answer is “NO”, then memorize them.
Introduction to Projectile Motion
Chapter 3 Kinematics in Two Dimensions; Vectors. Units of Chapter 3 Projectile Motion Solving Problems Involving Projectile Motion Projectile Motion Is.
Mr. Dave Clausen1 La Cañada High School Chapter 6: Repetition Statements.
New Tools And Workshop Mod & For Loops. Modulo Calculates the remainder (remember long division?) % Examples: 7 % 3 10 % 2 2 % 3 evaluates to 1 evaluates.
Getting Started with TI-Interactive. TI-Interactive TI-Interactive can be used to create a variety of graphs. Scatter Plots, Line Plots, Histograms, Modified.
Reference: The Game Loop Animation / Game loop 1. Update variables 2. [Get input from the user] (GameLoop only) 3. Draw (using variables)
The Bubble Sort by Mr. Dave Clausen La Cañada High School.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 6B Methods (Tutorial)
Pascal Programming Iteration (looping) Carl Smith National Certificate Unit 4.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Lecture 3 Transformations. 2D Object Transformations The functions used for modifying the size, location, and orientation of objects or of the camera.
CPS120 Introduction to Computer Science Iteration (Looping)
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
The Selection Sort Mr. Dave Clausen La Cañada High School.
Visual C++ Programming: Concepts and Projects Chapter 10A: Recursion (Concepts)
AII.7 The student will investigate and analyze functions algebraically and graphically. Key concepts include a) domain and range, including limited and.
Table of Contents Ellipse - Definition and Equations Consider two fixed points in the plane, F 1 and F 2, which we shall call foci... Select a point in.
Table of Contents Hyperbola - Definition and Equations Consider two fixed points in the plane, F 1 and F 2, which we shall call foci... Select a point.
Chapter 2 Motion in One Dimension. Quantities in Motion Any motion involves three concepts Displacement Velocity Acceleration These concepts can be used.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
The Bubble Sort Mr. Dave Clausen La Cañada High School
Ultimate Strength Analysis of Arbitrary Cross Sections under Biaxial Bending and Axial Load by Fiber Model and Curvilinear Polygons Aristotelis Charalampakis.
Unit 3 Lesson 9 Repetition Statements (Loops)
Scratch: iteration / repetition / loops
Java Programming: Guided Learning with Early Objects
Repetition Structures (Loops)
Basic Graphing Techniques
Graphing Linear Equations in Slope-Intercept Form
Graphics Animation Using Borland’s bgi
Projectiles.
Kinematics in Two Dimensions
Devil Physics Baddest Class on Campus AP Physics
Mr. Dave Clausen La Cañada High School
Chapter 6: Repetition Statements
Graphics Animation Using Terrapin LOGO
2.1 Review When variables change together, their interaction is called a ___________. When one variable determines the exact value of a second variable,
Mr. Dave Clausen La Cañada High School
Presentation transcript:

Graphics Animation Using Borland’s bgi Mr. Dave Clausen La Cañada High School

Mr. Dave Clausen2 Graphics Commands for the bgi n Remember, a summary of Borland’s graphics commands for Borland C for DOS and Borland C++ for Windows can be found in a previous lecture.

Mr. Dave Clausen3 Animation basic concepts. n The basic concept for graphics animation is to have some form of loop (definite or indefinite), where we draw an image, erase it (by drawing it exactly again, only in the background color instead of the foreground color), and update its coordinates. n This process repeats until the image reaches a desired location, or until some other condition is met.

Mr. Dave Clausen4 Blinking Objects n The algorithm for a blinking object is as follows: For a definite number of iterations do (or while) Draw the object (in a foreground color) Pause for a specified time (as necessary) Erase the object (draw in the background color) Update the coordinates n If you wish the image to remain at the end, draw it again after the loop. blink.cppblink.txt blink.cppblink.txt blink.exeblink.exe

Mr. Dave Clausen5 Horizontal motion n The algorithm for horizontal motion is: While the image is not at its destination (or for) Draw the image in the foreground color(s) Pause for a specified time (use symbolic constants) Erase the image (draw it in the background color) Update the image’s position –To update the image’s position, increment or decrement: x = x + delta_x; or x = x - delta_x; If you are using a for loop, this is taken care of already. n If you wish the image to remain at the end, draw it again after the loop.

Mr. Dave Clausen6 Vertical motion n The algorithm for vertical motion is: While the image is not at its destination (or for) Draw the image in the foreground color(s) Pause for a specified time (use symbolic constants) Erase the image (draw it in the background color) Update the image’s position –To update the image’s position, increment or decrement: y = y + delta_y; or y = y - delta_y; If you are using a for loop, this is taken care of already. n If you wish the image to remain at the end, draw it again after the loop.

Mr. Dave Clausen7 Linear motion n The algorithm for linear motion is: While the image is not at its destination (or for) Draw the image in the foreground color(s) Pause for a specified time (use symbolic constants) Erase the image (draw it in the background color) Update the image’s position –To update the image’s position, increment or decrement: y = y + delta_y; or y = y - delta_y; or x = x + delta_x; or x = x - delta_x; n If you wish the image to remain at the end, draw it again after the loop.

Mr. Dave Clausen8 Linear motion: y in terms of x n The algorithm remains the same as defined on previous slides. The difference is how we calculate the variable delta_y in terms of x. n For linear paths we may use the increment: y = y + (3* x - 5); //The equation of a line between 2 points is: mvsquare.cppmvsquare.txt mvsquare.exe

Mr. Dave Clausen9 Non linear motion n The algorithm remains the same as defined on previous slides. The difference is how we calculate the variable delta_y in terms of x. n For parabolic paths we may use the function: y = y + (0.01 * (x * x)); //The basic formula for a parabola in standard form: parabola.cpp parabola.txt parabola.exe

Mr. Dave Clausen10 To Move an Object in a Parabolic Path: n Let’s look at this example which doesn’t merely draw a parabola, but moves an object in a parabolic path. paracirc.cppparacirc.cpp paracirc.txt paracirc.exeparacirc.txtparacirc.exe

Mr. Dave Clausen11 Other Examples: n Let’s look at examples of previous student’s work. n They fall into 2 categories: non-interactive animation –as previously discussed interactive animation –using indefinite loops while not kbhit( ). –Keys can be detected using getch( ) –Using switch or nested ifs to determine action of key hit. (use ASCII codes of the keys.)