Anda di halaman 1dari 91

Unit-4

3-D Transformations
Shweta Rajput
Normalized view space
Modeling Transformation
Viewing Transformation
Lighting & Shading
3D-Clipping
Projection
Scan conversion, Hiding
Primitives
Image
Object space
World space
Camera space
Image space,
Device coordinates
Hidden Surface Removal
3D Viewing Pipeline
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Composite transformations
Shweta Rajput
3D Coordinate System
3D coordinate system consists of a reference point called
origin and three mutually perpendicular passing through
origin.
x axis
y axis
z axis
P
y
z
x
Right-Hand
Reference System
Shweta Rajput
3D Coordinate System
A point P(x,y,z) specifies that point
is
At a distance of x units from YZ-plane
At a distance of y units from XZ-plane
At a distance of z units from XY-plane
x axis
y axis
z axis
P
y
z
x
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Composite transformations
Shweta Rajput
Vector Fundamentals
In 3D there are 3 natural coordinate vectors I, J and K having
unit along X, Y and Z axis respectively.
x axis
y axis
z axis
P
y
z
x
V=aI+bJ+cK
(a,b,c)
Any vector V = aI+bJ+cJ can be
resolved into three components
(a,b,c) that represent corresponding
point when the tail of V is placed at
the origin.
Shweta Rajput
Vector Fundamentals
If P(x
0
,y
0
,z
0
) and Q(x
1
,y
1
,z
1
) are two points in space then
PQ = (x
1
x
o
)I+ (y
1
y
o
)J+ (z
1
z
o
)K

Vector has two attributes:
length- a scalar denoted by |v|
direction in 3D space

Equality: Two vectors are equal if
they have same length and direction
x axis
y axis
z axis
P
y
z
x
V=aI+bJ+cK
(a,b,c)
Shweta Rajput
1. Vector Addition: perform addition by the head-to-tail rule.
Note u+v = v+u
Vector Fundamentals
u
v
u+v
u
v+u
Shweta Rajput
2. Vector Subtraction: To perform subtraction, given u and v,
we define u - v to be u + (-v):
Note u - v v u
Vector Fundamentals
u
v
u
-v
u - v
Shweta Rajput
Vector Fundamentals
3. Zero Vector: i.e. vector with zero length and no direction.
v + (-v) = 0
4. Magnitude of Vector of a vector u = aI +bJ +cK is a scalar
quantity defined as:


5. Unit vector for any vector u is a vector having direction of u
and unit magnitude. It can be found as

2 2 2
c b a u + + =
v
-v

Shweta Rajput
6. Scalar Multiplication: (Scalar times a vector ) Let o be a
scalar and u a vector we define ou to be the vector with
length | o ||u| with
the direction of u if o > 0
the opposite of u if o < 0

if o = 0, the vector is the zero vector or a point.
Vector Fundamentals
u
2u
-3u
Shweta Rajput
7. Dot Product: Given two vectors u = a
1
I +b
1
J +c
1
K and v =
a
2
I +b
2
J +c
2
K the dot product of the vectors is defined to be
the scalar as follows
u.v = a
1
.a
2
+b
1
. b
2
+c
1
.c
2
or u.v = |u| |v| cos u , 0 ut
where u is the angle between u and v
Also
cos u = u.v /|u| |v|
Or u = cos
-1
(u.v /|u| |v|)



Vector Fundamentals
Shweta Rajput
The dot product is a scalar value that tells us something
about the relationship between two vectors
If u v > 0 then 0< < 90
Vectors point in the same general direction
If u v < 0 then > 90
Vectors point in opposite direction
If u v = 0 then = 90
Vectors are perpendicular
(or one or both of the vectors is degenerate (0,0,0))

Vector Fundamentals
Shweta Rajput
8. Cross Product: Given two vectors u = a
1
I +b
1
J +c
1
K and v =
a
2
I +b
2
J +c
2
K the cross product of the vectors is defined to be
the new vector whose length is |u||v| sin u, 0 ut and
direction is given by the right hand rule.
u x v = (b
1
.c
2
c
1
. b
2
)I +(c
1
.a
2
a
1
. c
2
)J +(a
1
.b
2
b
1
. a
2
)K
or |u x v| = |u| |v| sin u , 0 ut where u is the angle b/w u & v
sin u = |u x v| /|u| |v|
Or u = sin
-1
(|u x v| /|u| |v|)
Vector Fundamentals
u
v
u X v
u
Shweta Rajput
In a Right handed coordinate System

I x J = K
J x K = I
I x K = -J
or K x I = J
Vector Fundamentals
Right-Hand
Reference System
I
J
K
Shweta Rajput
Vector Fundamentals
9. Vector Equations of Line: If P(x
0
,y
0
,z
0
) and Q(x
1
,y
1
,z
1
) are
two points in space then
PQ = (x
1
x
o
)I+ (y
1
y
o
)J+ (z
1
z
o
)K
= t.aI+t.bt+t.ct = t(aI+bt+ct)

x = x
0
+(x
1
x
0
).t = x
0
+a.t
y = y
0
+(y
1
y
0
).t = y
0
+b.t 0 t 1
z = z
0
+(z
1
z
0
).t = z
0
+c.t
Shweta Rajput
Vector Fundamentals
10. Vector Equations of Plane: A plane can be uniquely
determined by specifying
A reference point R
0
(x
0
,y
0
,z
0
) on the plane, and
Normal vector N = n
1
I+n
2
J+n
3
K

N

P(x,y,z)
R
0
(x
0
,y
0
,z
0
) P R
0
A vector N is said to be
the normal vector to the
plane if for any given
directed line V in the
plane V.N = 0.

Shweta Rajput
Vector Fundamentals
Let P(x,y,z) be any point on the plane so that vector R
0
P
lies on the plane.
since N R
0
P
N . R
0
P = 0
(n
1
I+n
2
J+n
3
K). ((x-x
0
)I+(y-y
0
)J+(z-z
0
)K) = 0
n
1
(x-x
0
)+n
2
(y-y
0
)+n
3
(z-z
0
) = 0
n
1
x+n
2
y+n
3
z (n
1
x
0
+n
2
y
0
+n
3
z
0
) = 0
which is in
Ax + By + cZ D = 0 form

R
0
(x
0
,y
0
,z
0
)
N

P(x,y,z)
P R
0
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Composite transformations
Shweta Rajput
3D Homogeneous Coordinates
Similar to the 2-D situation we can use homogeneous
coordinates for 3-D transformations - 4 coordinate
column vector

All transformations can
then be represented
as matrices
(
(
(
(

1
z
y
x
x axis
y axis
z axis
P
y
z
x
P(x, y, z) =
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Composite transformations
Shweta Rajput
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
Shweta Rajput
3D Geometric Transformations
Once we have an object described, transformations are used to
move that object, scale it and rotate it
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
Shweta Rajput
3D Geometric Translation
Translation is defined as the displacement of any object by a
given distance and direction from its original position
Shweta Rajput
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
Shweta Rajput
3D Geometric Translation
The translation of a point P(x,y,z) by (tx, ty, tz) can be
written in matrix form as:
(
(
(
(

=
(
(
(
(
(

'
'
=
'
(
(
(
(

=
+ + = =
'
1
1
1 0 0 0
1 0 0
0 1 0
0 0 1
) (
'
z
y
x
P
z
y
x
P
tz
ty
tx
T
K tz J ty I tx v where P T P
v
v
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
Shweta Rajput
3D Geometric Scaling
Scaling is the process of expanding or compressing the
dimensions of an object determined by the scaling factor.

Shweta Rajput
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)
Scaled Position
(x, y, z)
Shweta Rajput
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:
(
(
(
(

=
(
(
(
(

(
(
(
(

=
(
(
(
(
(

'
'
(
(
(
(

=
(
(
(
(
(

'
'
=
'
(
(
(
(

=
=
'
1 1 1 0 0 0
0 0 0
0 0 0
0 0 0
1
1
1
1 0 0 0
0 0 0
0 0 0
0 0 0
) (
'
'
, ,
, ,
z s
y s
x s
z
y
x
s
s
s
z
y
x
that such
z
y
x
P
z
y
x
P
s
s
s
S
where P S P
z
y
x
z
y
x
z
y
x
sz sy sx
sz sy sx
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
Shweta Rajput
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

Shweta Rajput
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 Pitch
Yaw
Shweta Rajput
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.
Shweta Rajput
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.
Shweta Rajput
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.
Shweta Rajput
3D Geometric Rotations
x = xcos - ysin
y = xsin + ycos
z = z
x = x
y = ycos - zsin
z = ysin + zcos
x = zsin + xcos
y = y
z = zcos - xsin
The equations for the three kinds of rotations in 3-D are
Shweta Rajput
3D Geometric Rotations
The scaling of a point P(x,y,z) by an angle of u about
different axis about origin can be written in matrix form as:

(
(
(
(

=
(
(
(
(

=
(
(
(
(


=
(
(
(
(

=
(
(
(
(
(

'
'
=
'
=
'
1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
1 0 0 0
0 1 0 0
0 0 cos sin
0 0 sin cos
1
1
) (
, ,
,
'
,
u u
u u
u u
u u
u u
u u
u u
u
u
I J
K
axis
R R
R
z
y
x
P
z
y
x
P where
P R P
rx and rz is same as in
2d but ry differs.
x = zsin + xcos
y = y
z = zcos - xsin

Shweta Rajput
(
(
(
(

1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
u u
u u
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
Shweta Rajput
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.
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
Shweta Rajput
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' = M
xy
(P) where


Reflections about other planes can also be obtained by
symmetry.
(
(
(
(

=
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
xy
M
Shweta Rajput
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.
z
x
y
x
y
z
Geometric Transformations
Translation
Scaling
Rotation
Reflection
Shearing
Shweta Rajput
3D Geometric Shearing

These are not basic affine transformations, but they are
important so we deal with them separately.
Each shear is characterized by a single angle u which is the
angle formed with the axis used for the shear.
Like Rotations we have 3 shears
X shear
Y shear, and
Z shear

Shweta Rajput
3D Geometric Shearing
Shearing about X-axis is obtained by following set of
equations for X Shear
x'= x + y cot u
y' = y
z' = z


(
(
(
(

=
1 0 0 0
0 1 0 0
0 0 1 0
0 0 cot 1
,
u
u x
Sh
Similarly we can obtain Y-shears and Z shears.
Similarly
Shweta Rajput
Shweta Rajput
Any Question !
Shweta Rajput
3D Geometric Shearing

General Shearing Matrix is described in terms of %age

(
(
(
(

=
1 0 0 0
0 1
0 1
0 1
yz xz
zy xy
zx yx
h h
h h
h h
Sh
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Composite transformations
Shweta Rajput
Inverse Transformations
Inverse Translation:

Inverse Scaling:

Inverse Rotations:

Inverse Reflections:

p p
R R
,
1
, u u

=
v v
T T

=
1
sz sy sx sz sy sx
S S
/ 1 , / 1 , / 1
1
, ,
=

plane plane
M M =
1
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Combining transformations
Shweta Rajput
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.
Shweta Rajput
3D Coordinate Transformations
Coordinate Translation:

Coordinate Scaling:

Coordinate Rotations:

Coordinate Reflections:

p p
p
R R R
,
1
,
,
u u
u

= =
v v
v
T T T

= =
1
sz sy sx sz sy sx
sz sy sx
S S S
/ 1 , / 1 , / 1
1
, ,
, ,
= =

plane plane
plane
M M M = =
1
Shweta Rajput
Contents
1. 3D Coordinate System
2. Vector Fundamentals
3. 3D Homogeneous Coordinate
4. 3D Geometric Transformations
5. 3D Inverse Transformations
6. 3D Coordinate Transformations
7. Composite transformations
Shweta Rajput
Composite Transformation
Various composite transformations are

1. Scaling about arbitrary point P
2. Tilting as rotation about x-axis followed by y-axis
3. Aligning vector V with K (Z axis)
4. Rotation about arbitrary axis L

Shweta Rajput
Exercise 1
Scaling about arbitrary point P
Imagine scaling an object around a point (a,b,c) other than the origin
Translate point (a,b,c) to origin
Scale around origin
Translate back to point

Shweta Rajput
Exercise 1
Shweta Rajput
Exercise 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 :
1. Translate (a,b,c) to origin and the new object point is found as
P
1
= T
V
(P) where V= aI bJ cK

2. Scale object about origin and the new object point is
P
2
= S
sx,sy,sz
(P
1
)
3. Retranslate (a,b,c) back the final object point is
P
F
= T
-1
V
(P
2
) = T
-V
(P
2
)

The composite transformation can be obtained by back substituting
P
F
= T
-1
V
(P
2
)
= T
-V
S
sx,sy,sz
(P
1
)

= T
-V
S
sx,sy
.T
V
(P) where V= aI bJ cK
Shweta Rajput
Exercise 1
And the composite scaling transformation matrix is
(
(
(
(

+
+
+
=
(
(
(
(

(
(
(
(

(
(
(
(

=
1 0 0 0
. 0 0
. 0 0
. 0 0
1 0 0 0
1 0 0
0 1 0
0 0 1
1 0 0 0
0 0 0
0 0 0
0 0 0
1 0 0 0
1 0 0
0 1 0
0 0 1
) , , ( , ,
c sz c sz
b sy b sy
a sx a sx
c
b
a
sz
sy
sx
c
b
a
S
c b a sz sy sx
Thus we form the matrix to be S
sx,sy,sz(a,b,c)
= T
-V
S
sx,sy,sz
T
V
Shweta Rajput
Exercise 2
Define tilting as rotation about the x-axis followed by a
rotation about y-axis.

a) Find the tilting matrix T = R
uy,J
x R
ux,I
b) Does order of rotation matters ? Yes,result is different.

1.
Shweta Rajput
(
(
(
(


=
(
(
(
(

(
(
(
(

=
= -
1 0 0 0
0 cos cos sin cos sin
0 sin cos 0
0 cos sin sin sin cos
1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
, ,
x y x y y
x x
x y x y y
x x
x x
y y
y y
R R T
T
i x j y
u u u u u
u u
u u u u u
u u
u u
u u
u u
u u
2
Shweta Rajput
(
(
(
(


=
(
(
(
(

(
(
(
(

=
= -
1 0 0 0
0 cos cos sin sin cos
0 cos sin cos sin sin
0 sin 0 cos
1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
, ,
y x x y x
y x x y x
y y
x x
x x
y y
y y
R R T
T
i y j x
u u u u u
u u u u u
u u
u u
u u
u u
u u
u u
Shweta Rajput
Exercise 3
Aligning vector V with Vector K
Let V = aI+bJ+cK then the alignment can be
performed by following sequence of
operations:

Rotate V about X-axis by an angle of u
1
, so
that V rotates into upper -half of the xz
plane. V= R
u
1
,I
(V)

Rotate V about Y-axis by an angle of -u
2
,
so that V rotates and align with Z axis.
V= R
-u
2
,J
(V ).

How to get these two angles???
Y axis
Z axis
X axis
P(a,b,c)
a
b
c
V
k
Shweta Rajput
Exercise 3
Step1: Rotate V about X-axis by an angle of
u
1
, so that V rotates into upper -half of the xz
plane. V= R
u
1
,I
(V)

Let P be projection of P(a,b,c) in YZ plane.
P(0,b,c). If u
1
be the angle that OP
makes with +ve Z-axis, then from AOPC


Y axis
Z axis
X axis
P(a,b,c)
u
1
V
P(0,b,c)
O
A
B
C
Q(a,0,\b
2
+c
2
V
2 2
1
2 2
1
cos
sin
c b
c
c b
b
+
=
+
=
u
u
Shweta Rajput
Exercise 3
2 2
1
2 2
1
cos
sin
c b
c
c b
b
+
=
+
=
u
u
Rotate vector V about X-axis by an angle of u
1
V= R
u
1
,I
(V) or Q = R
u
1
,I
(P)
Where
(
(
(
(

=
1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1 1
1 1
,
1
u u
u u
u I
R
Does V have rotated into upper -half of the xz plane?
Shweta Rajput
Exercise 3
(
(
(
(
(
(

+ +
+

+
=
(
(
(
(

= =
1 0 0 0
0 0
0 0
0 0 0 1
1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
) (
2 2 2 2
2 2 2 2
1 1
1 1
,
1
c b
c
c b
b
c b
b
c b
c
P R Q
I
u u
u u
u
Shweta Rajput
Exercise 3
Step2: Rotate V about Y-axis by an angle of
u
2
, so that V aligns with +ve Z axis. V=
R
u
2
,j
(V)

Let Q be projection of Q(a,0,\b
2
+c
2
) on Z
axis, Q(0,0, \b
2
+c
2
). If u
2
be the angle
that OQ makes with +ve Z-axis, then from
AOQQ


2 2 2
2 2
2
2 2 2
2
cos
sin
c b a
c b
c b a
a
+ +
+
=
+ +
=
u
u
P(0,b,c)
Y axis
Z axis
X axis
P(a,b,c)
u
2
V
O
A
B
C
Q(a,0,\b
2
+c
2
)


\a
2
+b
2
+c
2
)
V
R(0,0,\a
2
+b
2
+c
2
)
Q(0,0,\b
2
+c
2
)

\b
2
+c
2
)
a
Shweta Rajput
Exercise 3
Rotate vector V about Y-axis by an angle of u
2(clockwise)
V= R
-u
2
,J
(V) or R = R
-u
2
,J
(Q)
Where
(
(
(
(

1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
2 2
2 2
,
2
u u
u u
u J
R
Does V have aligned Z axis?
2 2 2
2 2
2
2 2 2
2
cos
sin
c b a
c b
c b a
a
+ +
+
=
+ +
=
u
u
Shweta Rajput
Exercise 3
(
(
(
(
(
(
(

+ +
+
+ +
+ +

+ +
+
=
(
(
(
(


= =

1 0 0 0
0 0
0 0 1 0
0 0
1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
) (
2 2 2
2 2
2 2 2
2 2 2 2 2 2
2 2
2 2
2 2
,
2
c b a
c b
c b a
a
c b a
a
c b a
c b
Q R R
J
u u
u u
u
Shweta Rajput
2 2 2
2 2
2 2 2 2
2 2 2 2
2 2 2
2 2
2 2 2
2 2 2 2 2 2
2 2
, ,
1 0 0 0
0
0 0
0
1 0 0 0
0 0
0 0
0 0 0 1
.
1 0 0 0
0 0
0 0 1 0
0 0
1 0 0 0
0 0
0 0
0 0 0 1
.
1 0 0 0
0 0
0 0 1 0
0 0
*
1 2
c b a V
c b
where
V
c
V
b
V
a
b c
V
ac
V
ab
V
c b
b c
V V
a
V
a
V
c b
c
c b
b
c b
b
c b
c
c b a
c b
c b a
a
c b a
a
c b a
c b
R R R
I J
+ + =
+ =
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(

(
(
(
(
(
(


=
(
(
(
(
(
(

+ +
+

+
(
(
(
(
(
(
(

+ +
+
+ +
+ +

+ +
+
=
= =

u u
Exercise 3
Composite Matrix A
V,K
can be found as
Shweta Rajput
J
K V
R
a
a
a
a
A
and a V then
,
,
0
2
2
.
1 0 0 0
0 0 0
0 0 1 0
0 0 0
90 , 0
u
u

=
(
(
(
(
(
(


=
= = =
Exercise 3
Corollary I: If both b = c =0,then V=aI and so =0.so,only90 or -90 degree
rotation about y axis is required

Shweta Rajput
(
(
(
(
(
(
(
(

=
=
=
=

1 0 0 0
0
0
| |
0 0
) . (
.
) . (
1
, 2 ,
,
1
,
1
1
, ,
1
1
2 1
1 2
V
c b
V
ac
V
b c
V
ab
V
a
V
A
R R
R R
R R A
V
J I
J I
I J
V

u u
u u
u u
Exercise 3
Corollary II: The inverse of A
V,K
can be found that aligns vector K with vector V
as
Shweta Rajput
Exercise 4
Find transformation A
V,N
that aligns vector V = 2I J K with
another N = I+J+K.(matrices written in row major)
Step 1:Align v with vector k


using V = 2I J K


(
(
(
(
(
(
(
(

=
1 0 0 0
0
6
1
6
1
6
2
0
2
1
2
1
0
0
6 2
2
6 2
2
6
2
,K V
A
1 0 0 0
0
0 0
0
V
c
V
b
V
a
b c
V
ac
V
ab
V

Step 2:
Align vector k with vector n
The inverse of A
V,K
can be found that aligns vector K with vector V as
N = I+J+K(written in ro major)

Shweta Rajput
(
(
(
(
(
(
(
(

=
1 0 0 0
0
3
1
2
1
3 2
1
0
3
1
2
1
3 2
1
0
3
1
0
3
2
, N K
A
(
(
(
(
(
(
(
(

1 0 0 0
0
0
| |
0 0
1
V
c b
V
ac
V
b c
V
ab
V
a
V
A V

Multiply N k v
A
V,N
= A
K,N
.
A
V,K


Shweta Rajput
(
(
(
(
(
(
(
(

+
+
=
1 0 0 0
0
2
1
18
2
2
1
18
2
18
1
0
2
1
18
2
2
1
18
2
18
1
0
18
1
18
1
18
4
, N V
A

K,V
N
N,K,V
Shweta Rajput
Exercise 5
Rotation by an angle u about arbitrary axis L specified by a
direction vector V and fixed point P
0
.
Q. Find transformation for a rotation of degree about L
The transformation can be found as:
1. Translate P
0
to origin.
2. Align Vector V with K.
3. Rotate object about Z axis by angle u.
4. Realign vector V back.
5. Retranslate P
0
back.
Shweta Rajput
Exercise 5
If P is the object point the sequence of transformations is:
1. Translate P
0
to origin P
1
= T
-P
0
(P)

2. Align Vector V with K. P
2
= A
V,K
(P
1
)
3. Rotate object about Z axis by angle u. P
3
= R
u,K
(P
2
)
4. Realign vector V back. P
4
= A
-1
V,K
(P
3
)
5. Retranslate P
0
back. P
5
= T
-1
-P
0
(P
4
)


Thus P
5
= T
-1
-P
0
(P
4
)
= T
-1
-P
0
.A
-1
V,K
(P
3
)

= T
-1
-P
0
.A
-1
V,K
. R
u,K
(P
2
)

= T
-1
-P
0
.A
-1
V,K
. R
u,K
. A
V,K
(P
1
)
= T
-1
-P
0
.A
-1
V,K
. R
u,K
. A
V,K
. T
-P
0
(P)
Thus we form the matrix to be R
u,L
= T
-1
-P
0
A
-1
V,K
R
u,K
A
V,K
T
-P
0

Shweta Rajput
Exercise 5
Find the new coordinates of a unit cube 90-rotated
about an axis defined by its endpoints A(2,1,0) and
B(3,3,1).
A Unit Cube
Example
Shweta Rajput
Example
Step1. Translate point A to the origin
A(0,0,0)
x
z
y
B(1,2,1)
(
(
(
(

=
1 0 0 0
0 1 0 0
1 0 1 0
2 0 0 1
T
Shweta Rajput
x
z
y
l
( )
(
(
(
(
(
(

=
1 0 0 0
0
5
5
5
5 2
0
0
5
5 2
5
5
0
0 0 0 1
o
x
R
6 1 2 1
5
5
5
1
cos
5
5 2
5
2
1 2
2
sin
2 2 2
2 2
= + + =
= = o
= =
+
= o
l
B(1,2,1)
o
Projected point
(0,2,1)
B(1,0,\5)
Example
Step 2. Rotate axis AB about the x axis by an
angle o, until it lies on the xz plane.
Shweta Rajput
x
z
y
l
( )
(
(
(
(
(
(

=
1 0 0 0
0
6
30
0
6
6
0 0 1 0
0
6
6
0
6
30
|
y
R
6
30
6
5
cos
6
6
6
1
sin
= =
= =
|
|
|
B(1,0, \ 5)
(0,0,\6)
Example
Step 3. Rotate axis AB about the y axis by an
angle |, until it coincides with the z axis.
Shweta Rajput
Example
Step 4. Rotate the cube 90 about the z axis




Finally, the concatenated rotation matrix about
the arbitrary axis AB becomes,
( ) ( ) ( ) ( ) ( ) ( )T R R R R R T R o | | o u
x y z y x
=

90
1 1 1
( )
(
(
(
(


=
1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0
90
z
R
Shweta Rajput
( )
(
(
(
(

=
(
(
(
(

(
(
(
(
(
(

(
(
(
(
(
(

(
(
(
(


(
(
(
(
(
(

(
(
(
(
(
(

(
(
(
(

=
1 0 0 0
560 . 0 167 . 0 741 . 0 650 . 0
151 . 1 075 . 0 667 . 0 742 . 0
742 . 1 983 . 0 075 . 0 166 . 0
1 0 0 0
0 1 0 0
1 0 1 0
2 0 0 1
1 0 0 0
0
5
5
5
5 2
0
0
5
5 2
5
5
0
0 0 0 1
1 0 0 0
0
6
30
0
6
6
0 0 1 0
0
6
6
0
6
30
1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0
1 0 0 0
0
6
30
0
6
6
0 0 1 0
0
6
6
0
6
30
1 0 0 0
0
5
5
5
5 2
0
0
5
5 2
5
5
0
0 0 0 1
1 0 0 0
0 1 0 0
1 0 1 0
2 0 0 1
u R
Example
Shweta Rajput
| | ( ) | | P R P =
'
u
| |
(
(
(
(


=
(
(
(
(

(
(
(
(

= '
1 1 1 1 1 1 1 1
076 . 0 091 . 0 560 . 0 726 . 0 817 . 0 650 . 0 301 . 1 467 . 1
483 . 0 409 . 0 151 . 1 225 . 1 184 . 0 258 . 0 484 . 0 558 . 0
891 . 2 909 . 1 742 . 1 725 . 2 816 . 2 834 . 1 667 . 1 650 . 2
1 1 1 1 1 1 1 1
1 0 0 1 1 0 0 1
0 0 0 0 1 1 1 1
1 1 0 0 1 1 0 0
1 0 0 0
560 . 0 167 . 0 741 . 0 650 . 0
151 . 1 075 . 0 667 . 0 742 . 0
742 . 1 983 . 0 075 . 0 166 . 0
P
Example
Multiplying R() by the point matrix of the original cube
Shweta Rajput
Shweta Rajput
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 45
0
about line L in the direction of V = J+K passing
through P(0,1,0). Find the coordinates of rotated figure.
(
(
(
(
(
(
(
(

=
1 0 0 0
4
2 2
4
2 2
4
2 2
2
1
4
2 2
4
2 2
4
2 2
2
1
2
1
2
1
2
1
2
2
, 45
0
L
R
| |
(
(
(
(
(
(
(
(



+
=
1 1 1 1
2
2
0
4
4 2
4
2 2
2
2 2
1
4
2 4
4
2 2
1 0
2
2 1
2
1
' ' ' ' D C B A

Anda mungkin juga menyukai