trytten computergraphics(1)

15
Computer Graphics: A Case Study in Linear Algebra Deborah A. Trytten Spring 2002

Upload: nriaz469

Post on 17-Jul-2015

58 views

Category:

Engineering


4 download

TRANSCRIPT

Computer Graphics: A Case Study in Linear Algebra

Deborah A. Trytten

Spring 2002

What is Graphics?

The collection of techniques used to take mathematical models and create images

Models are often 3D

Images are often 2D

What Math is Involved?Extensive linear algebra

Change of coordinate systems

Affine transformations

Homogeneous matrices

Geometry

Calculus

Discrete Mathematics

Mathematical Modeling

The Elements

Objects

Catalog of reusable models

Usually a represented as a polygonal mesh

The Scene

Camera

Computer Screen

Desirable Properties

Speed

A single frame can have more than a million pixels

Logical control of elements

Speed

Visual realism

Speed

Goal

Want to create a single matrix that:

Starts with points in a 3D object

Arranges them in a scene

Positions a camera in the scene

Projects a region of interest to 2D

Maps projected region of interest to the computer screen

Coordinate Systems

Object

Coordinates

World

Coordinates

Camera Coordinates

Screen

Coordinates

Coordinate System Transforms

Start with points in object coordinates

Transform to world coordinates

Transform to camera coordinates

Project to 2D

Transform projected region of interest to screen coordinates

Coordinate Transformations

Coordinate systems transformations consist of three affine transformations

Rotation

Translation

Scaling

Shear is also affine

Used in one type of projection

RepresentationWe represent points in homogeneous coordinates

(x, y, z) -> (x, y, z, 1)

(x, y, z, 1) = (xw, yw, zw, w)

Vectors(x, y, z) -> (x, y, z, 0)

Distinguishing points and vectors is essential in graphics

Adding vectors is OK

Adding points isn’t

Translation

Homogeneous translations are multiplicative

1 0 0

0 1 0

0 0 1

1 0 0 0 1 1

x tx tx x

y ty ty y

z ty tz z

Perspective Projection

Gives depth foreshortening

Mathematics of Perspective

P(x,y,z)

(x*,y*, N)

z=-Nz

x or y

x or y

Perspective Matrix

x* = xN/z

y* = yN/z

z* = N (z/z)

0 0 0

0 0 0

0 0 0

0 0 1 0 1

xN N x

yN N y

zN N z

z

ResultP’ = (Object to World)P

P’’ = (World to Camera) P

P’’’ = Perspective P’’Derived earlier

Result = (Projected to Screen) P’’’

Multiply all the matrices first

Each point is multiplied by only one matrix!