L12-IntroToGraphics-II.ppt

Download Report

Transcript L12-IntroToGraphics-II.ppt

King Fahd University of Petroleum & Minerals
College of Computer Science & Engineering
Information & Computer Science Department
ICS201
Lecture 12 : Gentle Introduction
to Computer Graphics II
Based on:
David Brogan’s “Introduction to Computer Graphics” Course Slides, University of Virginia
Jack van Wijk’s “Computer Graphics” Course Slides, University of Eindhoven.
Outline



Introduction to 2D Modeling Transformations
Matrix Representations
Linear Transformations
Introduction to Modeling Transformations

Specify transformations for objects


Allows definitions of objects in own coordinate systems
Allows use of object definition multiple times in a scene
2D Modeling Transformations
Modeling
Coordinates
y
Scale
Translate
x
Scale
Rotate
Translate
World Coordinates
Scaling


Scaling a coordinate means multiplying each of its
components by a scalar
Uniform scaling means this scalar is the same for all
components:
2
Scaling

Non-uniform scaling: different scalars per
component:
X  2,
Y  0.5

How can we represent this in matrix form?
Scaling

Scaling operation:

Or, in matrix form:
 x' ax 
 y '  by 
   
 x '   a 0  x 
 y '  0 b  y 
  
 
scaling matrix
2-D Rotation
(x’, y’)
(x, y)

x’ = x cos() - y sin()
y’ = x sin() + y cos()
2-D Rotation

This is easy to capture in matrix form:
 x' cos   sin    x 
 y '   sin   cos    y 
  
 

Even though sin() and cos() are nonlinear
functions of ,


x’ is a linear combination of x and y
y’ is a linear combination of x and y
2-D Translation
(x’, y’)
ty
(x, y)
tx
x’ = x + tx
y’ = y + ty
The end