Matrix Representation of Translations; Homogeneous Coordinates

Transformations are conveniently described and applied with the use of
matrices.
This yields a powerful formalism for combining
the effects of several transformations through matrix multiplication.
Also: If we transform a complicated object with thousands of vertices with the same transformation,
then we need to
calculate that compound matrix only once and can than use it to
transform all those vertices.

We also want to do Translation with Matrices.
This is not straight-forward, since translation is not a "linear operation"!
Linear transforms: {T(aX + B) = a T(X) + b } always leave origin in
place; T(0) = 0.
--> We use a clever hack via homogeneous coordinates:
Homogenizing = introduce an extra component: w : (x, y)
==> (wx, wy, w)
We can recover the regular cartesian coordinates by a division
with w (w<>0);
this corresponds to a cut of the homogeneous line with the w=1 plane.
Matrix operation is still linear in d+1 dimension (origin stays in
place),
but we are only interested in (hyper-)plane w=1.
The basic translation matrix, and how it works.
All 2D transformation matrices for use with homogeneous column vectors.
Distinguish: Rigid-body transforms (rotate and translate)
and Affine transforms (scaling and shear).

Issues arising from use of homogeneous coordinates:

Efficiency ?: -- Number of arithmetic operations may increase!
Yields ease of composition: -- No need to separate out
the translation
part.
Abstraction from implementation: however it is done -- hide
it from user !
(also: row vectors versus column vectors => "outside" matrix multiplication).
Also: Now we have hardware that has been designed to handle homogeneous coordinates, thus there would be no savings doing it any other way!

Viewport Mapping

In assignment A#2 you are asked to make the display window scalable (e.g., by dragging one of its corners).
But you don't want your carefully designed fantasy polygon to be
distorted -- just scale it uniformly to the largest size that fits into
the given window.
Thus you have to determine what is the largest rectangle with the
aspect ratio of your original drawing window (= square) that fits into
the given window.If we were to just scale the x- and y-directions individually, so that the content
of window completely fills the viewport, we might get affine distortions, if the
aspect
ratios of window and viewport are different.
To avoid such distortion, we choose the smaller of the two scale
factors and apply it uniformly to both axes.

Crucial Concepts from Last Lecture (and Mini-Quiz Answers):

Fill in the polygon based on "Non-Zero Winding Number". ==> Orientation plays no role! (Starting point plays no role either).
Practical hint: draw some orientation onto the polygon contour if it is
not already given. Label fields with winding numbers. Check that
adjacent fields differ by exactly ONE.

How many DOFs are there
for the specification of all
possible
...

line segments in 2D: ( 4 )

arbitrary n-gons in 2D: ( 2n )

rectangles in 2D: ( 5 )

infinitely long lines in 2D: ( 2 )

spheres in 3D: ( 4 )

planes in 3D: ( 3 )

Picking:
Find what is under the cursor! ( Like target shooting in a CG
game: How do you know what, if anything, you hit with your
blaster ? )
A#2: Test each polygon vertex whether it is "close enough" (+/- 2-3 pixels) to the mouse!

Various possible bounds:Axis-aligned bounding boxes (AABB): most often used, easy to compute, can be somewhat wasteful.
Optimally oriented bounding boxes (OOBB): are more
efficient
but more difficult to determine.
Bounding circles or spheres: have rotation-independent size,
but are not so easy to find either.
Convex hulls: can be constructed efficiently, but may have many
vertices, --> loss of efficiency.

Scene Hierarchy, Instantiations, Compound Transformations

Now we want to build complex scenes with more than just one polygon!
How should we "describe" a complex world model in the computer ?
-- for instance: a Boeing 747: ~ 4 000 000 identifyable parts?.
-- or a battle scene in StarWars?
Use hierarchically nested groups of objects (and of other groups) with relative transformations.
An object or group of objects can be instantiated multiple times -- in different places, with different orientations, and different scales.Benefits: Managing complexity,
abstraction, structure, re-use of
objects,
easy searching and editing, reducing the rendering work, ...

Reading Assignments:

Study: ( i.e., try to understand fully, so that you can answer
questions
on an exam):
Shirley, 2nd Ed: Ch 6.1, 6.3.

Programming Assignment 2:

Assignment #2 is due (electronically submitted) before Thursday 2/12, 11:00pm.

I strongly recommend that you should be done with your assignments by Wednesday,
so that you can then focus on the new one and pay attention to what I might say in class about it.
The "extension" to Thursday should only be seen as an emergency measure.