CS488 - Introduction to Computer Graphics - Lecture 6
Window Coordinates
On the view plane
- the result of a perspective projection
- perspective projections include orthogonal projections
- measured in world units
- go to infinity in both directions
- origin at projected location of world coordinate origin
Viewport Coordinates
On the viewplane
- one part of the view plane will be shown
- measured in world units
- finite limits
- origin lies within the viewport, often at one of its corners
Normalized Device Coordinates
Normalized viewport coordinates
- origin usually in upper left corner
- direction of y-axis reversed
- viewport fills the range zero to one
Real Device Coordinates
Normalized device coordinates scaled to the size of the picture on the
screen
Exercise for the reader
Why bother with normalized device coordinates? What extra value to they
give you?
Comment
Renaissance artists had rules of thumb for how a satisfying picture is
frame; i.e., how the viewport should be chosen. They were right, and they
were smarter than you about images. Follow their rules when you want to make
a picture that people will admire.
Geometry - Affine Spaces
Euclidean Spaces
Poorly named: Euclid had only a compass; Euclidean spaces have a ruler and
a protractor.
- A ruler is a function that tells you the length of something.
- Lengths are defined only for vectors
- Lengths are defined as the dot product: v \dot v is the square of the length of v, which we write |v|
- The dot product also defines the angle between two vectors: "angle
between u and v" = ( u \dot v ) / ( |u| |v|)
- This definition of angle goes from -1 to 1 only, and repeats with a
period 2 \pi.
- We call it cos( \theta ) where \theta is the angle measured by a
protractor
- In OpenGL, and pretty well everywhere else in computer graphics,
angles are measured in radians!
Cartesian Spaces
Euclid allows us to position vectors with respect to a general basis,
but
- it doesn't allow us to position points, and
- it doesn't give us the ability to compare bases.
A Cartesian space adds a standard frame so that we can position points and
compare coordinates.
Matrix Representations of Affine Transformations
Write a general point in terms of its coordinates in two different
orthonormal frames.
- P = x i + y j + z k + O = x' i' + y' j' + z' k' + O'
- ( x, y, z ) and ( x', y', z' ) are the two sets of coordinates.
- ( i, j, k, O ) and ( i', j', k', O' ) are the two frames.
- If any three of these are known we can find the fourth.
Example. Find ( x', y', z' )
- x' i' + y' j' + z' k' = x i + y j + z k + (O - O')
Notice that this is a vector equation.
0 = 0 in the fourth coordinate comes for free!
- Then, taking the dot product with i':
x' = x (i . i') + y (j . i') + z (k . i') + (O - O') . i'
This is an ordinary linear algebraic equation.
There are two other equations like this one, produced by j' and k'.
See how nice it is to have an orthonormal frame!
- Write the three algebraic equations together as a matrix multiplication.
/ \ / \ / \
| i.i' j.i' k.i' (O-O').i' | | x | | x' |
| i.j' j.j' k.j' (O-O').j' | | y | = | y' |
| i.k' j.k' k.k' (O-O').k' | | z | | z' |
\ / \ / \ /
- What about the fourth row of the matrix?
Points have the fourth coordinate 1, vectors 0.
Regardless of the coordinates points should stay points, vectors
vectors.
Only the row ( 0, 0, 0, 1 ) makes it happen.
This method works fine when we know the frames in terms of each other - or
in terms of another frame - but not when we want to derive the matrix from a
geometrical manipulation.
Another Take on Affine Transformations
`The longest journey starts with but a single step.' What does this mean?
- Tx = Tsn ... Ts2 Ts1 x
- Any transformation can be constructed from a sequence of more
elementary transformations.
Is there a small set of simple transformations from which all
transformations can be constructed?
- Yes!!
- Should we thank heaven for making it so?
- Or geometers for discovering and exploring it?
Example
Translation is simple; rotation about a basis vector is simple. But
rotation about an arbitrary axis is complex.
Construct rotation about an aribitrary axis from translation and rotation
about a basis vector.
- Translate the axis of rotation so that it passes through the origin.
- Rotate the axis of rotation to coincide with the z-axis.
- First about the x-axis until it lies in the yz-plane
- Then about the y-axis until it lise along the z-axis
- Rotate by the specified angle.
- Undo the axis rotation.
- Undo the translation.
Notice the structure, Tinv S T, which occurs over and over again.
Return to: