Gentle Introduction to Computer Graphics 2 Based on
Gentle Introduction to Computer Graphics (2) • 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. 1
Outline • Introduction to 2 D Modeling Transformations • Matrix Representations • Linear Transformations 2
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 3
2 D Modeling Transformations Modeling Coordinates y Scale Translate x Scale Rotate Translate World Coordinates 4
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 5
Scaling • Non-uniform scaling: different scalars per component: X 2, Y 0. 5 • How can we represent this in matrix form? 6
Scaling • Scaling operation: • Or, in matrix form: scaling matrix 7
2 -D Rotation (x’, y’) (x, y) x’ = x cos( ) - y sin( ) y’ = x sin( ) + y cos( ) 8
2 -D Rotation • This is easy to capture in matrix form: • Even though sin(q) and cos(q) are nonlinear functions of q, – x’ is a linear combination of x and y – y’ is a linear combination of x and y 9
2 -D Translation (x’, y’) (x, y) tx ty x’ = x + tx y’ = y + ty 10
- Slides: 10