Title: Representations and Transformations
1Representations and Transformations
2Objectives
- Derive homogeneous coordinate transformation
matrices - Introduce standard transformations
- Rotations
- Translation
- Scaling
- Shear
3Scalars, Points, Vectors
- Three basic elements from geometry
- Scalars, Points, Vectors
- Scalars can be defined as members of a set which
can be combined by the operations of addition and
multiplication and obey the fundamental axioms - associativity, commutivity, inversion
- Examples include the real and complex numbers
under the rules we are all familiar with - Scalars alone have no geometric properties
4Scalars, Points, Vectors
- A vector is a quantity with two attributes
direction magnitude and its own rules as we saw
last lecture - The set defines a vector space
- But, vectors lack position
- Same length and magnitude -gt
- Vectors are insufficient to specify geometry
- We need points
5Scalars, Points, Vectors
- Points, we know, are locations in space
- Certain operations translate between points and
vectors - Point-point subtraction yields a vector
- - Leads to equivalent to point-vector addition
vP-Q
PvQ
6Vector Spaces
- Consider a basis v1, v2,., vn
- A vector is written va1v1 a2v2 .anvn
- The list of scalars a1, a2, . an then is the
representation of v with respect to the given
basis - And we write the representation as a row or
column array of scalars
aa1 a2 . anT
7Affine Spaces
- Vector spaces do not represent points
- Instead, we work in an affine space and add a
special point, the origin, to the basis vectors,
this is called a frame
v2
v1
P0
v3
8Affine Spaces
- An affine space is both point and vector space
- It allows operations from vectors, points and
scalars - Vector-vector addition
- Scalar-vector multiplication
- Point-vector addition
- All scalar-scalar operations
- Define our space with a coordinate Frame
9Frames
- A frame is determined by (P0, v1, v2, v3, ...)
- Within this frame
- Every vector can be written as
- va1v1 a2v2 .anvn
- And every point can be written as
- P P0 b1v1 b2v2 .bnvn
10Homogeneous Coordinates
Consider the point and the vector P P0 b1v1
b2v2 .bnvn va1v1 a2v2 .anvn They appear
to have the similar representations pb1
b2 b3 va1 a2 a3 which confuse the
point with the vector But, a vector has no
position
v
p
v
can be placed anywhere
fixed
11Homogeneous Coordinates
- An affine space combines point and vector
- with
- two new rules
- ( 1 )( P ) P
- ( 0 )( P ) 0 (zero vector)
12Homogeneous Coordinates
With these rules, we can keep track of the
difference va1v1 a2v2 a3v3 a1 a2 a3 0
v1 v2 v3 P0 T P P0 b1v1 b2v2 b3v3 b1
b2 b3 1 v1 v2 v3 P0 T Thus we obtain a
four-dimensional representation for both
v a1 a2 a3 0 T
p b1 b2 b3 1 T
13Homogeneous Coordinates
- Homogeneous coordinates are key to all computer
graphics systems - Hardware pipeline all work with 4 dimensional
representations - All standard transformations (rotation,
translation, scaling) can be implemented by
matrix multiplications with 4 x 4 matrices
14Homogeneous Coordinates
- Most generally, the form of homogeneous
coordinates is - px y z w T
- We can return to a simple three dimensional point
by - x'?x/w
- y'?y/w
- z'?z/w
- But if w0, the representation is that of a vector
15 Transformations
- A transformation maps points to other points
and/or vectors to other vectors
vT(u)
QT(P)
16Affine Transformations
- Line preserving
- Characteristic of many physically important
transformations - Rigid body transformations rotation, translation
- Non-rigid Scaling, shear
- Importance in graphics is that we need only
transform vertices (points) of line segments and
polygons, then system draws between the
transformed points
17Translation
- Move (translate, displace) a point to a new
location - Displacement determined by a vector d
- Three degrees of freedom
- PPd
P
d
P
18Moving objects
When we move a point on an object to a new
location, to preserve the object, we must move
all other points on the object in the same way
object
translation every point displaced by the
same vector, d
19Translation Using Representations
Using the homogeneous coordinate representation
in some frame p x y z 1T px y
z 1T ddx dy dz 0T Hence p p d or
xxdx yydy zzdz
note that this expression is in four dimensions
and expresses that point vector point
20Translation Matrix
We can also express translation using a 4 x 4
matrix T in homogeneous coordinates pTp
where T T(dx, dy, dz) This form is better
for implementation because all affine
transformations can be expressed this way and
multiple transformations can be concatenated
together
21Rotation (2D)
- Consider rotation about the origin by q degrees
- radius stays the same, angle increases by q
What is this rotation about the z axis?
22Rotation (2D)
- Consider rotation about the origin by q degrees
- radius stays the same, angle increases by q
x r cos (f q) y r sin (f q)
xx cos q y sin q y x sin q y cos q
x r cos f y r sin f
23Rotation about the z axis
- Rotation about z axis in three dimensions leaves
all points with the same z - Equivalent to rotation in two dimensions in
planes of constant z - or in matrix notation (with p as a column)
- pRz(q)p
xx cos q y sin q y x sin q y cos q z z
24Rotation Matrix
Homogeneous Coordinates
R Rz(q)
25Rotation about x and y axes
- Same argument as for rotation about z axis
- For rotation about x axis, x is unchanged
- For rotation about y axis, y is unchanged
R Rx(q)
R Ry(q)
26Scaling
Expand or contract along each axis (fixed point
of origin)
xsxx ysyy zszz
pSp
S S(sx, sy, sz)
27Reflection
corresponds to negative scale factors
sx -1 sy 1
original
sx -1 sy -1
sx 1 sy -1
28Shear
- Helpful to add one more basic transformation
- Equivalent to pulling faces in opposite directions
29Shear Matrix
Consider simple shear along x axis
x x y shy y y z z
H(q)
30Inverses
- Although we could compute inverse matrices by
general formulas, we can also use simple
geometric observations, for example - Translation T-1(dx, dy, dz) T(-dx, -dy, -dz)
- Rotation R -1(q) R(-q)
- Holds for any rotation matrix
- Note that since cos(-q) cos(q) and sin(-q)
-sin(q) - R -1(q) R T(q)
- Scaling S-1(sx, sy, sz) S(1/sx, 1/sy, 1/sz)
-
31Composite
- In modeling, we often start with a simple object
centered at the origin, oriented with the axis,
and at a standard size - We apply an composite transformation to its
vertices to - Scale
- Orient
- Locate
32Composite Transformations
- Scaling about a fixed point
- - Simply applying the scale transformation also
moves the object being scaled.
Q'
Q
P
P'
33Composite Transformations
- Scaling about origin does not move object
- Origin is a fixed point for the scale
transformation - We use composite transformations to create scale
- transformations with different fixed points
Q'
Q
P'
P
34Composite Transformations
- Fixed point scale transformation
- Move fixed point (px,py,pz) to origin
- Scale by desired amount
- Move fixed point back to original position
M T(px, py, pz) S(sx, sy, sz) T(-px, -py, -pz)
35Composite Transformations
- Rotating about a fixed point
- - basic rotation alone will rotate about origin
- but we want
36Composite Transformations
- Rotating about a fixed point
- Move fixed point (px,py,pz) to origin
- Rotate by desired amount
- Move fixed point back to original position
M T(px, py, pz) Rx(q) T(-px, -py, -pz)
37Composite Transformations