# CS488 - Introduction to Computer Graphics - Lecture 5

## Euclidean Space

An affine space plus a metric, d(P1, P2), that has translational invariance

• Metric is symmetric by definition
• also non-negative and obeying the triangle inequality.
• Translational symmetry means: d(P1, P2) = d(P1 +2 v, P2 +2 v).

The familiar dot product (defined on vectors, Why?) is your baby.

• d(P1, P2) = ( P1 -2 P2 ) /dot ( P1 -2 P2 ) = | P1 -2 P2 |
• This gives you what Euclid was able to do with a compass, and more.

The dot product also defines ahgles between vectors.

• cos(s) = v1 \dot v2 / (|v1| |v2|),
• s is the angle between v1 and v2.
• This is part of the more' we got than compass.

## Cartesian Space

A Euclidean space plus a (usually orthonormal) frame.

• The frame is ( i, j, k, O ).
• ( i, j, k ) is a set of basis vectors with two properties
1. orthogonality: i \dot j = j \dot k = k \dot i = 0.
2. normalization: |i| = |j| = |k| = 1.

Using the frame (often called standard' or distinguished' ) we can write uniquely

• any vector as v =1 ( x, y, z, 0 ) \dot ( i, j, k, O ) =1 x *1 i +1 y *1 j +1 z *1 k, and
• any point as P =2 ( x, y, z, 1 ) \dot ( i, j, k, O ) =2 ( x *1 i +1 y *1 j +1 z *1 k ) +2 O
• ( x, y, z, 1 ) and ( x, y, z, 0 ) are called the coordinates' of the point or vector.
• Note that coordinates are defined wrt a frame: without a specific frame they are meaningless.

## Affine Transformations

The general idea is that we apply a transformation to a point to position it.

• P -> T P

There are two ways to see this process

#### One Point, Two Frames

1. P = x i + y j + z k + O = x' i' + y' j' + z' k' + O'
2. Express the second frame in terms of the first.

i' = aii i + aij j + aik k, etc.

O' = O + bi i + bj j + bk k.

3. Then collect terms.

## View Transformations

1. Several objects positioned in the world
• Frames view
1. Each object has its own frame, in terms of which its points have coordinates.
2. Express all object coordinates in a common frame, the modelling frame.
3. Express the modelling frame in terms of the world frame.
4. Get coordinates of each object in the world frame.
• Points view
1. Each object starts at the origin of the world frame in a standard orientation, with point coordinates in the world frame.
2. Move the object to the correct position and orientation by transforming its coordinates.
• The two views give exactly the same result, with slightly different mathematics, which will be explained later.
2. Viewer's eye looks at the world. Possibilities
• Put the eye in the world frame.
• Do high school geometry.
• What a drag!
• Associate a frame, the view frame, with the viewer.
• Find object coordinates in the view frame.
• Drop a coordinate, because you defined the view frame cleverly.

What happened?

1. Point Po in object coordinates.
2. Transform Po by T1 to get it into world coordinates: Pw = T1( Po )
3. Transform Pw by V to get it into view coordinates: Pv = V( Pw ) = V( T1( Po ) ) = V T1 Po.

To move the point transform it again.

1. Pw = T2 T1 Po
2. Pv = V T2 T1 Po