Computer Graphics and Linear Algebra Rebecca Weber, 2007

Similar documents
2D and 3D Transformations AUI Course Denbigh Starkey

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

How to draw and create shapes

Students are not expected to work formally with properties of dilations until high school.

Geometric Transformations

We created a few different effects and animations using this technique as applied to clones.

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

Unit 1, Lesson 1: Moving in the Plane

Graphics and Interaction Transformation geometry and homogeneous coordinates

Vector Algebra Transformations. Lecture 4

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Computer Science 336 Fall 2017 Homework 2

Set the Sails! Purpose: Overview. TExES Mathematics 4-8 Competencies. TEKS Mathematics Objectives.

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

On a coordinate plane, such a change can be described by counting the number of spaces, vertically and horizontally, that the figure has moved.

Paint/Draw Tools. Foreground color. Free-form select. Select. Eraser/Color Eraser. Fill Color. Color Picker. Magnify. Pencil. Brush.

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

MAT 343 Laboratory 4 Plotting and computer animation in MATLAB

Graphics Pipeline 2D Geometric Transformations

Section 12.1 Translations and Rotations

SAMLab Tip Sheet #1 Translating Mathematical Formulas Into Excel s Language

1. POINTS, LINES, AND ANGLES

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

R(-14, 4) R'(-10, -2) S(-10, 7) S'(-6, 1) T(-5, 4) T'(-1, -2)

Humanoid Robotics. Projective Geometry, Homogeneous Coordinates. (brief introduction) Maren Bennewitz

Interactive Computer Graphics. Hearn & Baker, chapter D transforms Hearn & Baker, chapter 5. Aliasing and Anti-Aliasing

8.G Reflections, Rotations, and

How to create shapes. Drawing basic shapes. Adobe Photoshop Elements 8 guide

Learning Log Title: CHAPTER 6: TRANSFORMATIONS AND SIMILARITY. Date: Lesson: Chapter 6: Transformations and Similarity

3D Rotations and Complex Representations. Computer Graphics CMU /15-662, Fall 2017

Transformation, tessellation and symmetry line symmetry

a triangle with all acute angles acute triangle angles that share a common side and vertex adjacent angles alternate exterior angles

2D/3D Geometric Transformations and Scene Graphs

Homework #2 and #3 Due Friday, October 12 th and Friday, October 19 th

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via by Friday, Mar. 18, 2016

Rasterization: Geometric Primitives

Ohio Tutorials are designed specifically for the Ohio Learning Standards to prepare students for the Ohio State Tests and end-ofcourse

Lecture 5 2D Transformation

KRISTU JYOTI COLLEGE OF MANAGEMENT & TECHNOLOGY QUESTION BANK BCA SEMESTER III Computer graphics Part A (2 marks questions)

2D Drawing Primitives

A Flavor of Topology. Shireen Elhabian and Aly A. Farag University of Louisville January 2010

COMP Preliminaries Jan. 6, 2015

REAL LIFE REAL WORLD Activity: Archeologist Frieze Patterns

b 1. If he flips the b over to the left, what new letter is formed? Draw a picture to the right.

Geometry. Topic 1 Transformations and Congruence

Prime Time (Factors and Multiples)

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 24 Solid Modelling

CS Exam 1 Review Problems Fall 2017

Boardworks Ltd KS3 Mathematics. S1 Lines and Angles

UNIT 11 VOLUME AND THE PYTHAGOREAN THEOREM

TRANSFORMATIONS AND CONGRUENCE

ACT Math test Plane Geometry Review

Corel Draw 11. What is Vector Graphics?

Computer Graphics Introduction. Taku Komura

(a) rotating 45 0 about the origin and then translating in the direction of vector I by 4 units and (b) translating and then rotation.

L1 - Introduction. Contents. Introduction of CAD/CAM system Components of CAD/CAM systems Basic concepts of graphics programming

Graphics and Interaction Rendering pipeline & object modelling

Animations involving numbers

Lesson 20: Exploiting the Connection to Cartesian Coordinates

ACT SparkNotes Test Prep: Plane Geometry

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

Computer Graphics Fundamentals. Jon Macey

In this lesson, you ll learn how to:

Chapter 8. Properties of Triangles and Quadrilaterals. 02/2017 LSowatsky

To build shapes from scratch, use the tools are the far right of the top tool bar. These

Topics and things to know about them:

Creating Digital Illustrations for Your Research Workshop III Basic Illustration Demo

LECTURE 6. Announcements

Chapter 5. Transforming Shapes

CS337 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics. Bin Sheng Representing Shape 9/20/16 1/15

A method in creating 3D models: From shape to shape, from shapes to model (October 2016)

Computer Graphics (CS 543) Lecture 1 (Part 1): Introduction to Computer Graphics

UNIT 2. Translation/ Scaling/ Rotation. Unit-02/Lecture-01

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Game Engineering: 2D

2D transformations: An introduction to the maths behind computer graphics

Translations, Reflections, and Rotations

Step 1: Create A New Photoshop Document

Module 1 Session 1 HS. Critical Areas for Traditional Geometry Page 1 of 6

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

Worn And Torn Text In Photoshop

Unit 1, Lesson 1: Tiling the Plane

(3) Proportionality. The student applies mathematical process standards to use proportional relationships

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

Properties of a Circle Diagram Source:

Math 9: Chapter Review Assignment

Unit 5: Motion Geometry

Transformations with Matrices Moved by Matrices

PLC Papers Created For:

acute angle An angle with a measure less than that of a right angle. Houghton Mifflin Co. 2 Grade 5 Unit 6

UNIT 2 2D TRANSFORMATIONS

Lecture notes: Object modeling

Isometries: Teacher Notes

Prentice Hall. Connected Mathematics 2, 6th Grade Units Mississippi Mathematics Framework 2007 Revised, Grade 6

Principles and Standards for School Mathematics. Content Standards. Process Standards. Emphasis across the Grades. Principles

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when time is announced or risk not having it accepted.

Cs602-computer graphics MCQS MIDTERM EXAMINATION SOLVED BY ~ LIBRIANSMINE ~

Study Guide - Geometry

Graphics in IT82. Representing Graphical Data. Graphics in IT82. Lectures Overview. Representing Graphical Data. Logical / Physical Representation

Transcription:

Computer Graphics and Linear Algebra Rebecca Weber, 2007

Vector graphics refers to representing images by mathematical descriptions of geometric objects, rather than by a collection of pixels on the screen (raster graphics). Punchline: If we represent points of space in the right way, we can represent all sorts of motions and deformations of shapes by matrix multiplication.

Geometrically, we can represent a polygon by a collection of vertices and the order in which to connect them. This is a lot less data to store in memory than the collection of all the pixels that are to be colored, especially as the polygon gets larger. If we want to represent other shapes, we need to store: What kind of shape it is Enough points and distances to fully describe the shape (if we have this option) The style and color of the outline (if we have this option) The style and color of the inside For example, for a circle we would need to know it was a circle, then have the center and radius.

Asteroids

Manipulating a Ship Let s represent the ship by a triangle, starting with its vertices at (0, 0), (2, 0), (1, 3). We could represent this as a matrix of vertices, with the understanding (stored as an additional piece of data) that they are connected in order and the last connects to the first. [ 0 2 ] 1 0 0 3

A matrix of vertices allows us to represent rotation by matrix multiplication, but what about translation? If we wanted to move r units to the right and s units up, we d have to add: [ 0 2 1 0 0 3 ] + [ r r r s s s With a simple modification of the vertex matrix, though, we can represent translation by matrix multiplication using shear transformations (adds a multiple of one coordinate to each of the other coordinates). We just add a dummy coordinate that always holds value 1, and add multiples of that to the x and y coordinates. ]

Homogeneous Coordinates In the new scheme, our triangle ship is represented by the matrix 0 2 1 0 0 3 1 1 1 Translation by (r, s) is now the product 1 0 r 0 1 s 0 0 1 0 2 1 0 0 3 1 1 1 = r 2 + r 1 + r s s 3 + s 1 1 1

Flying Forward Suppose we want to fly our ship two units in the direction it is currently facing (up). We need to translate by (0, 2): 1 0 0 0 1 2 0 0 1 0 2 1 0 0 3 1 1 1 = 0 2 1 2 2 5 1 1 1 The new vertices, (0, 2), (2, 2), (1, 5), give us the new ship image:

Turning in Place We ll crash into an asteroid if we can t change direction. Let s find the images of the columns of I 2 under counterclockwise rotation at an angle of ϕ. [ ] 1 0 [ ] 0 1 x 2 y 2 ϕ ϕ y 1 x 1 [ x1 y 1 [ x2 y 2 ] [ ] cos ϕ = sin ϕ ] [ ] sin ϕ = cos ϕ

The first two columns of I 3 will do just the same thing, with a zero in the last place. Our extra coordinate will stay the same. Hence to obtain counterclockwise rotation by ϕ degrees, we multiply by the matrix cos ϕ sin ϕ 0 sin ϕ cos ϕ 0 0 0 1 For example, for a 90 turn to the left, we would compute: 0 1 0 0 2 1 0 0 3 1 0 0 0 0 3 = 0 2 1 0 0 1 1 1 1 1 1 1

That s not the way ships turn, though! And if we rotate our ship after it drives up 2 units, it s even worse:

Center of Ship vs. Center of Screen We want our rotation to be about the center of the ship, say, the point halfway between the front and back ends on the line straight back from the tip. In our beginning position that is (1, 1.5). One solution is to translate, rotate, and translate back: make the center of the triangle the origin, do the rotation as previously, and then move the center back where it belongs. If we move everything by the amount the center requires, everything will stay in its proper positions.

We multiply on the left by each operation s matrix in order. Hence the new vertices are given by A 1 BAM where M is the matrix of homogeneous coordinates, A gives translation by ( 1, 1.5), B rotation by 90, and A 1 translation by (1, 1.5). A 1 BA = (A 1 BA)M = 1 0 1 0 1 1.5 0 0 1 = 0 1 2.5 1 0 0.5 0 0 1 0 1 0 1 0 0 0 0 1 0 1 2.5 1 0 0.5 0 0 1 0 2 1 0 0 3 1 1 1 1 0 1 0 1 1.5 0 0 1 = 2.5 2.5 0.5 0.5 2.5 1.5 1 1 1

The multiplication claims our vertices after rotation should be at (2.5, 0.5), (2.5, 2.5), and ( 0.5, 1.5). Let s graph it. Much better! The corresponding action for our ship after moving forward two units involves translating by ( 1, 3.5) and back with the rotation in between. The vertices obtained are (2.5, 2.5), (2.5, 4.5), and ( 0.5, 3.5) (the previous vertices with y + 2).

Advantages of Vector Graphics We ve mentioned that the same amount of data is required to represent an object of a given shape no matter what its size. Along those lines, resizing vector objects can be done with perfect quality maintenance. To go from 4 6 to 400 600, you simply multiply by a dilation matrix and then make the connections as usual. A raster image must be sharpened if it is blown up too much. Another advantage is that these are device-independent descriptions. No matter what kind of screen is going to display the picture, if you give the vector description to the machine it can (with proper software, of course) convert that description into an image that will display properly on its hardware.

So Why Raster? A little bit of history: For a brief time, displays were actually vector displays ( calligraphic or X-Y ). A beam would trace out the desired image on an otherwise black screen, many times per second. Modern displays, though, are raster (back to the early 1980s or even before), so a vector graphic must be converted to raster (a bitmap) in order to display. This meant that for two-dimensional games it was often easier to deal with raster graphics from the start. Additionally, a low-resolution display gives a lot more importance to each individual pixel, and it is not efficient to tweak individual pixels with vector representation.

Back to Vector, in part High-resolution displays decrease the need to tweak images at the pixel level, so vector representations can give quality images while maintaining efficiency. Perhaps more importantly, many games are now 3D. Raster graphics would require representing the entire solid object, despite the fact that we only need to see the surface. With 3D games there is also a lot more manipulation of the objects, as the player moves around and looks from different angles. These combine to make a vector representation again the better choice. However, raster representation is still more efficient for textures and patterns, so modern games use a combination of vector graphics for objects and raster graphics for surface detail. A couple more examples of vector graphics follow.

Battlezone (Atari, 1980)

Star Wars (Atari, 1983)

Title slide graphic is of Armor Attack (Cinematronics, 1980) All images are from Wikipedia, en.wikipedia.org