Lecture08-WindowToViewportTransforms

# Lecture08-WindowToViewportTransforms - CS 455 Computer...

This preview shows pages 1–8. Sign up to view the full content.

CS 455 – Computer Graphics Window to Viewport Transformations

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Compositing Transformations Does order matter? Case 1: translate by (–2, 0), scale by (2, 2) Case 2: scale by (2, 2), translate by (-2, 0) Begin: red , 1st transform: purple , 2nd: green - = 1 0 0 0 1 0 2 0 1 T = 1 0 0 0 2 0 0 0 2 S Y X 1,1 3,1 2,3 Y X 1,1 3,1 2,3 Case 1(translate then scale) Case 2 (scale then translate)
Compositing Transformations Does order matter? Case 1: translate by (–2, 0), scale by (2, 2) Case 2: scale by (2, 2), translate by (-2, 0) Begin: red , 1st transform: purple , 2nd: green - = 1 0 0 0 1 0 2 0 1 T = 1 0 0 0 2 0 0 0 2 S Y X 1,1 3,1 2,3 Y X 1,1 3,1 2,3 Case 1(translate then scale) Case 2 (scale then translate) -1,1 0,3 -1,1 0,6 -2,2 2,2 2,2 6,2 4,6 0,2 4,2 2,6

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Composition Example STP P = TSP P = 1 0 0 0 2 0 0 0 2 - = - 1 0 0 0 2 0 4 0 2 1 0 0 0 1 0 2 0 1 - 1 0 0 0 1 0 2 0 1 - = 1 0 0 0 2 0 2 0 2 1 0 0 0 2 0 0 0 2 Scale(2.0,2.0); Translate(-2.0,0.0); drawTriangle(); Translate(-2.0, 0.0); Scale(2.0,2.0); drawTriangle(); In general, transformations are not commutative
Need to transform points from “world” view ( window ) to the screen view ( viewport ) Maintain relative placement of points (usually) Can be done with a translate-scale-translate sequence Window-to-Viewport Transform x y -3 -2 -1 3 -4 -3 -2 -1 3 4 u v 0 10 20 30 40 50 60 70 80 10 20 30 40 50 60 0 Window (“world”) Viewport (screen)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
“Window” refers to the area in “world space” or “world coordinates” that you wish to project onto the screen Location, units, size, etc. are all determined by the application, and are convenient for that application Units could be inches, feet, meters, kilometers, light years, etc. The window is often centered around the origin, but need not be Specified as (x,y) coordinates Window x y -3 -2 -1 3 -4 -3 -2 -1 3 4 Window (“world”) (x min , y min ) (x max , y max )
The area on the screen that you will map the window to

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/02/2012 for the course C S 455 taught by Professor Jones,m during the Winter '08 term at BYU.

### Page1 / 22

Lecture08-WindowToViewportTransforms - CS 455 Computer...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online