Escolar Documentos
Profissional Documentos
Cultura Documentos
3-D Transformations
3D Viewing Pipeline
Primitives
Object space
Modeling Transformation
World space
Viewing Transformation
Camera space
3D-Clipping
Projection
Computer Graphics
Image
Image space,
Device coordinates
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Composite transformations
Computer Graphics
3D Coordinate System
3D coordinate system consists of a reference point called
origin and three mutually perpendicular passing through
origin.
y axis
y
z
x
March 24, 2015
z axis
Computer Graphics
x axis
Right-Hand
Reference System
3D Coordinate System
y axis
z
x
z axis
March 24, 2015
Computer Graphics
x axis
5
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Composite transformations
Computer Graphics
Vector Fundamentals
In 3D there are 3 natural coordinate vectors I, J and K having
unit along X, Y and Z axis respectively.
y axis
V=aI+bJ+cK
P(a,b,c)
z
x
z axis
March 24, 2015
Computer Graphics
x axis
7
Vector Fundamentals
If P(x0,y0,z0) and Q(x1,y1,z1) are two points in space then
PQ = (x1 xo)I+ (y1 yo)J+ (z1 zo)K
y axis
P(a,b,c)
V=aI+bJ+cK
Computer Graphics
z
x
x axis
8
Vector Fundamentals
1.
u
v
u+v
v+u
Computer Graphics
Vector Fundamentals
2.
-v
u-v
Computer Graphics
10
Vector Fundamentals
3.
4.
u a b c
2
5.
u
uv
u
-v
Computer Graphics
11
Vector Fundamentals
Scalar Multiplication: (Scalar times a vector ) Let be a
scalar and u a vector we define u to be the vector with
length | ||u| with
6.
2u
Computer Graphics
-3u
12
Vector Fundamentals
7.
Also
cos = u.v /|u| |v|
Or = cos-1(u.v /|u| |v|)
Computer Graphics
13
Vector Fundamentals
The dot product is a scalar value that tells us something
about the relationship between two vectors
If uv > 0 then 0< < 90
Vectors point in the same general direction
If uv < 0 then > 90
Vectors point in opposite direction
If uv = 0 then = 90
Vectors are perpendicular
(or one or both of the vectors is degenerate (0,0,0))
Computer Graphics
14
Vector Fundamentals
8.
-1
Computer Graphics
uXv
15
Vector Fundamentals
In a Right handed coordinate System
J
IxJ=K
JxK=I
I x K = -J
or K x I = J
K
I
Right-Hand
Reference System
Computer Graphics
16
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Composite transformations
Computer Graphics
17
3D Homogeneous Coordinates
Similar to the 2-D situation we can use homogeneous
coordinates for 3-D transformations - 4 coordinate
y axis
column vector
All transformations can
then be represented
as matrices x
P(x, y, z) =
y
z
z
x
z axisGraphics
Computer
x
18
axis
3D Homogeneous Coordinates
Transform a point:
px
mxx
p
m
y
yx
pz
mzx
1
0
mxy
myy
mzy
0
mxz
myz
mzz
0
dx
dy
dz
1
0
px
r
M py d
pz
Computer Graphics
19
3D Homogeneous Coordinates
Transform a vector:
vx
mxx
v
m
y
yx
vz
mzx
0
0
mxy
myy
mzy
0
mxz
myz
mzz
0
dx
dy
dz
0000
0
vx
M vy
vz
Computer Graphics
20
3D Homogeneous Coordinates
In Homogeneous arithmetic Legal operations always end in
0 or 1!
M
vector+vector:
0
0
scalar*vector:s
point+vector:
1
0
vectorvector:
0
M
0
M
1
1
0
M
point+point:
1
1
2
M
scalar*point:s
1
s
pointpoint:
weightedaverage
affinecombination
ofpoints:
1 M
2 M
3 1
3 1
1
Computer Graphics
21
3D Homogeneous Coordinates
Rotation, Scale, and Translation of points and vectors unified
in a single matrix transformation:
p Mp
mxx
m
Where M = yx
mzx
mxy
myy
mzy
0
mxz
myz
mzz
0
dx
dy
dz
Computer Graphics
22
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Composite transformations
Computer Graphics
23
3D Geometric Transformations
Geometric Transformations: In Geometric transformation an
object itself is moved relative to a stationary coordinate system
or background. The mathematical statement of this view point is
described by geometric transformation applied to each point of
the object. Various Geometric transformations are:
Translation
Scaling
Rotation
Reflection
Shearing
Computer Graphics
25
3D Geometric Transformations
Once we have an object described, transformations are used to
move that object, scale it and rotate it
Computer Graphics
26
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
3D Geometric Translation
Translation is defined as the displacement of any object by a
given distance and direction from its original position
Computer Graphics
28
3D Geometric Translation
To translate a point in three dimensions by tx, ty and tz simply
calculate the new points as follows:
x = x + tx
y = y + ty z = z + tz
(x, y, z)
(x, y, z)
Translated Position
Computer Graphics
29
3D Geometric Translation
The translation of a point P(x,y,z) by (tx, ty, tz) can be
written in matrix form as:
P Tv ( P) where v tx I ty J tz K
1 0 0 tx
0 1 0 ty
Tv
0 0 1 tz
0
0
0
1
x
y
z
'
Computer Graphics
x
y
30
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
3D Geometric Scaling
Scaling is the process of expanding or compressing the
dimensions of an object determined by the scaling factor.
Computer Graphics
32
3D Geometric Scaling
To scale a point in three dimensions by sx, sy and sz simply
calculate the new points as follows:
x = sx*x
y = sy*y
z = sz*z
(x, y, z)
(x, y, z)
Scaled Position
March 24, 2015
Computer Graphics
33
3D Geometric Scaling
The scaling of a point P(x,y,z) by scaling factors Sx, Sy
and Sz about origin can be written in matrix form as:
P Ssx , sy , sz ( P ) where
sx 0 0
0 sy 0
Ssx , sy , sz
0 0 sz
0 0 0
such that
x
y
z
'
0
0
0
x
y
sx 0 0
0 sy 0
0 0 sz
0 0 0
'
x
y
P
z
1
1
0 x sx x
0 y sy y
0 z sz z
1 1 1
Computer Graphics
34
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
3D Geometric Rotations
When we performed rotations in two dimensions we only
had the choice of rotating about the z axis
In the case of three dimensions we have more options
Rotate about x pitch
Rotate about y yaw
Rotate about z - roll
Computer Graphics
36
3D Geometric Rotations
Roll is known as the rising or dipping of the airplane's wing. The movement is done
about Longitudinal axis. The Ailerons controlling the roll are located on the
trailing edge of both wings.
Pitch refers to the movement of the airplane's nose either up or down. It movement
is done about Lateral axis. The elevator controls the pitch is also located on the
rear of the aircraft on the tail, along with the rudder.
Yaw allows the airplane to move towards the left or right while in flight. The
movement is done about a ventricle axis. The yaw is controlled by the rudder
located in the rear of the aircraft on the tail.
Roll
March 24, 2015
Pitch
Computer Graphics
Yaw
37
3D Geometric Rotations
Rotate about z axis: The picture shows a z-axis rotation
around the origin in a positive angle, (Anti-clockwise) as you
look down the z-axis towards the origin. The angle is
measured in the xy-plane from the x-axis, just as in 2D.
Computer Graphics
38
3D Geometric Rotations
Rotate about y axis: You are looking down the y-axis
which is not shown. A positive (counter-clockwise) angle is
shown.
Computer Graphics
39
3D Geometric Rotations
Rotate about x axis: You are looking down the x-axis
which is not shown. A positive (counter-clockwise) angle is
shown.
Computer Graphics
40
3D Geometric Rotations
The equations for the three kinds of rotations in 3-D are
x = xcos - ysin
y = xsin + ycos
z = z
March 24, 2015
x = x
y = ycos - zsin
z = ysin + zcos
Computer Graphics
x = zsin + xcos
y = y
z = zcos - xsin
41
3D Geometric Rotations
The scaling of a point P(x,y,z) by an angle of about
different axis about origin can be written in matrix form as:
P R , axis ( P)
where
cos
0
R , J
sin
x
y
'
cos
sin
R , K
0 cos
0
0
0
0
1
0 cos
R , I
Computer Graphics
sin
cos
0 sin
1
0
0
x
y
0 sin
0
0 0
0 0
1 0
0 1
0
0
sin 0
cos 0
0
1
42
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
3D Geometric Reflections
We can perform reflections relative to a selected reflection axis
or with respect to a reflection plane.
Reflections relative to a given axis are equivalent to 180
rotations about that axis.
Reflections with respect to a plane are equivalent to 180
rotations in 4D space.
3 standard Reflections are
About z axis or with respect to xy plane
About y axis or with respect to zx plane
About x axis or with respect to yz plane
Computer Graphics
44
3D Geometric Reflections
Reflection about XY plane: Reflection relative to the xy
plane can be obtained from following set of equations:
x = x
y = y
z = z
In homogenous matrix form
P' = Mxy(P)
where
M xy
1 0
0 1
0
0
0
0
0 0 1 0
0 0
Computer Graphics
45
3D Geometric Reflections
Reflection about XY plane is a useful reflection as it
converts a right-handed coordinate system into a left-handed
coordinate system.
y
y
z
x
x
Computer Graphics
46
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Composite transformations
Computer Graphics
47
Inverse Transformations
Inverse Translation:
Inverse Scaling:
Tv Tv
1
Inverse Rotations:
R , p R , p
Inverse Reflections:
M plane M plane
Computer Graphics
48
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Combining transformations
Computer Graphics
49
3D Coordinate Transformations
Coordinate Transformation: The object is held
stationary while coordinate system is moved relative
to the object. These can easily be described in terms
of the opposite operation performed by Geometric
transformation.
Computer Graphics
50
3D Coordinate Transformations
Coordinate Translation:
T v Tv Tv
1
Coordinate Scaling:
Coordinate Rotations:
Coordinate Reflections:
R , p R , p R , p
1
Computer Graphics
53
Contents
1.
2.
3.
4.
5.
6.
7.
3D Coordinate System
Vector Fundamentals
3D Homogeneous Coordinate
3D Geometric Transformations
3D Inverse Transformations
3D Coordinate Transformations
Composite transformations
Computer Graphics
54
Composite Transformation
Computer Graphics
56
Exercise 1
Scaling about arbitrary point P
Imagine scaling an object around a point (a,b,c) other than the origin
Computer Graphics
57
Exercise 1
Computer Graphics
58
Exercise 1
1.
Let P is the object point which is to be scaled by factors sx, sy and sz about
the fixed point (a,b,c). Then the composite transformation S sx,sy,sz,(a,b,c) can be
obtained by performing following sequence of transformations :
Translate (a,b,c) to origin and the new object point is found as
P1 = TV(P) where V= aI bJ cK
2.
3.
Computer Graphics
59
Exercise 1
Thus we form the matrix to be Ssx,sy,sz(a,b,c)= T-VSsx,sy,szTV
And the composite scaling transformation matrix is
1 0 0 a sx 0 0 0 1
0 1 0 b 0 sy 0 0 0
S sx , sy , sz ( a ,b,c )
0 0 1 c 0 0 sz 0 0
0 0 0 1 0 0 0 1 0
sx 0 0 a.sx a
0 sy 0 b.sy b
0 0 sz c.sz c
1
0 0 0
Computer Graphics
0 0 a
1 0 b
0 1 c
0 0
60
Exercise 2
Define tilting as rotation about the x-axis followed by a
rotation about y-axis.
a)
b)
Computer Graphics
61
Exercise 3
Z axis
P(a,b,c)
c
a
V
b
Y axis
X axis
Computer Graphics
62
Exercise 3
Z axis
P(0,b,c)
Q(a,0, b2+c2
P(a,b,c)
b2 c2
c
b2 c2
Y axis
X axis
Computer Graphics
63
Exercise 3
Rotate vector V about X-axis by an angle of 1
V= R1,I(V) or Q = R
1,I
Where
R1 , I
(P)
0
1
0 cos
1
0 sin 1
0
0
0
0
sin 1
cos 1
sin 1
cos 1 0
0
b
b2 c2
c
b2 c2
Computer Graphics
64
Exercise 3
1
0
cos 1
sin 1
sin 1
cos 1
Q R1 , I ( P )
0
c
b2 c2
b
b2 c2
0
0
0
b2 c2
c
b2 c2
0
b
c
cb bc
a
0
b
.
0 c
1
1
b2 c2
b2 c2
b2 c2
b c
2
0
b
0
0
0
1
Computer Graphics
65
Exercise 3
Z axis
R(0,0, a2+b2+c2)
Q(0,0, b2+c2)
V
Q(a,0, b2+c2)
cos 2
March 24, 2015
b2 c2
a 2 b2 c2
P(0,b,c)
a
C
V
2
O
A
P(a,b,c)
Y axis
X axis
Computer Graphics
66
Exercise 3
Rotate vector V about Y-axis by an angle of 2
V= R-2,J(V) or R = R-
2,J
Where
R 2 , J
cos 1
0
sin 2
(Q)
0 sin 2
1
0
0 cos 2
0
0
0
0
0
sin 2
cos 2
a
a2 b2 c2
b2 c2
a2 b2 c2
Computer Graphics
67
Exercise 3
cos 2
0
R R 2 , J (Q )
sin 2
b2 c2
a b c
0
a
a b c
0
0
1
0
sin 2
1
0
0
0
cos 2
0
a b c
0
b2 c2
2
a2 b2 c2
0
a b c
0
2
a b2 c2
a 2 b2 c2
1 Computer Graphics
2
2
b c
a b2 c2 a b2 c2
0
0
0
1
0
0 .
0
1
2
2
b c
1
2
2
2
a b c
68
Exercise 3
Composite Matrix AV,K can be found as
R R 2 , J (Q) R 2 , J * R1 , I ( P )
b2 c2
a2 b2 c2
0
a
a2 b2 c2
0
V
0
a
V
0
0
1
0
0
V
0
V
0
1
0
a2 b2 c2
0
2
b c2
a2 b2 c2
0
0 .
0
1
1
0
0
0
0
c
0
b
1
0
0
0 .
0 0
1 0
V
V
0
0
c
b2 c2
b
b2 c2
0
ab
V
c
b
V
0
Computer Graphics
0
b
b2 c2
c
b2 c2
0
ac
V
b
c
V
0
b2 c2
where
V a2 b2 c2
1
69
Exercise 3
Corollary I: If both b = c =0
then 0, V a
AV , K a0
a
0
a
0
a
1
0
0
and 2 900
0 .
0
R 2 , J
Computer Graphics
70
Exercise 3
Corollary II: The inverse of AV,K can be found as
A1V , K ( R 2 , J . R1 , I ) 1
R
1
1 , I
1 , I
.R
.R
2 , J
2 , J
( R 2 , J . R1 , I )
( AV , K )
A
V ,K
Computer Graphics
71
Exercise 4
Find transformation AV,N that aligns vector V = 2I J K with
another N = I+J+K.
AV ,N
4
18
1
18
1
18
0
1
18
2
1
18 2
2
1
18 2
0
0
18
2
1
18 2
2
1
0
18 2
0
1
Computer Graphics
72
Exercise 5
Rotation by an angle about arbitrary axis L specified by a
direction vector V and fixed point P0.
The transformation can be found as:
1. Translate P0 to origin.
2. Align Vector V with K.
3. Rotate object about Z axis by angle .
4. Realign vector V back.
5. Retranslate P0 back.
Computer Graphics
73
Exercise 5
If P is the object point the sequence of transformations is:
1.
Translate P0 to origin
P1 = T-P0(P)
P2 = AV,K(P1)
2.
3.
4.
5.
P4 = A-1V,K(P3)
Thus P5 = T-1-P0(P4)
= T-1-P0.A-1V,K(P3)
= T-1-P0.A-1V,K. R,K(P2)
= T-1-P0.A-1V,K. R,K. AV,K(P1)
= T-1-P0.A-1V,K. R,K. AV,K. T-P0(P)
Computer Graphics
74
Exercise 5
Computer Graphics
75
Exercise 6
The pyramid is defined by A(0,0,0), B(1,0,0), C(0,1,0) and D(0,0,1) is
rotated by 450 about line L in the direction of V = J+K passing
through P(0,1,0). Find the coordinates of rotated figure.
R450 , L
2
2
1
2
1
2
0
1
2
2 2
4
2 2
4
0
1
2
2 2
4
2 2
4
0
2
2 2
4
2 2
4
1
Computer Graphics
1
2
2 2
4
2 2
4
1
1 2
2
4 2
4
2 4
4
1
0
1
0
1
2 2
2
2
2
1
76
Any Question !