Professional Documents
Culture Documents
L6 3dtrans
L6 3dtrans
L6 3dtrans
3D TRANSFORMATIONS
1. Linear 3D Transformations:
Translation, Rotation, Scaling
Shearing, Reflection
2. Perspective Transformations
Transformations in 3 dimensions
Geometric transformations are mappings from
one coordinate system onto itself.
The geometric model undergoes change
relative to its MCS (Model Coordinate
System)
The Transformations are applied to an object
represented by point sets.
Rigid Body Motion: The relative distances
between object particles remain constant
Affine and Non-Affine maps
Transformed point set X* = f(P, transformation
parameters)
1
Homogeneous coordinates in 3 dimensions
A point in homogeneous coordinates (x, y, z,
h), h 0, corresponds to the 3-D vertex (x/h,
y/h, z/h) in Cartesian coordinates.
Homogeneous coordinates in 3D give rise to 4
dimensional position vector.
h (x, y, z, h)
a d g p L
Sc ocal
b e i q ali
ng
[T ] =
c f j r
l m n s
Perspective transformations
Linear transformations – local scaling, shear,
rotation / reflection
Translations l, m, n along x, y, and z axis
Overall scaling
2
3D Scaling
a 0 0 0
0 e 0 0
[Ts ] =
0 0 j 0
0 0 0 1
Ex: Required scaling to scale the
RPP to a unit cube is ½, 1/3, 1
0 2 2 0 0 2 2 0
0 0 3 3 0 0 3 3
[ X ′] = [Ts ]
1 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1
Overall Scaling 1 0 0 0
0 1 0 0 If S<1
[Ts ] = Enlargement of
0 0 1 0 volume
S>1 Reduction
in volume
0 0 0 s
[Ts ][X ] = [x' y' z ' s]
T
= [x' / s z ' / s 1]
T
y' / s
Ex: Uniformly scale the unit cube by a factor of 2
requires s= ½
0 2 2 0 0 2 2 0
0 0 2 2 0 0 2 2
[ X ′] =
2 2 2 2 0 0 0 0
1 1 1 1 1 1 1 1
3
3D SHEARING 1 d g 0 x
b 1 i 0 y
[TSH ] =
c f 1 0 z
0 0 0 1 1
[Ts ][X ] = [x + yd + gz bx + y + iz cx + fy + z 1]
T
Det[T]=+1
4
3D ROTATIONS – (ii) Rotation about x-axis
Similarly we can obtain rotation matrix
about x-axis
1 0 0 0
0 cos ϑ sin ϑ 0
[TRx ] =
0 − sin ϑ cos ϑ 0
0 0 0 1
5
Example – for the RPP given by the matrix below
obtain -90 rotation about x -axis
0 3 3 0 0 3 3 0
0 0 2 2 0 0 2 2
[ X ]=
1 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1
1 0 0 0
0 0 1 0
[TRx ] =
0 −1 0 0
0 0 0 1
0 3 3 0 0 3 3 0
1 1 1 1 0 0 0 0
[ X ′] =
0 0 −2 −2 0 0 −2 −2
1 1 1 1 1 1 1 1
0 0 1 0
0 1 0 0
[TRy ] =
−1 0 0 0
0 0 0 1
1 1 1 1 0 0 0 0
0 0 2 2 0 0 2 2
[ X ′] =
0 − 3 − 3 0 0 −3 − 3 0
1 1 1 1 1 1 1 1
6
3D REFLECTIONS – As in 2D, we can perform 3D
transformations about a plane now.
Rotation of 180°about an axis passing through
origin out into 4-D space and projection back onto
3D space. 1 0 0 0
Through x-y plane 0 1 0 0
Det[T]=-1
[Txy ] =
0 0 −1 0
0 0 0 1
1 0 0 0
0 1 0 0
[Txy ] =
0 0 −1 0
0 0 0 1
1 2 2 1 1 2 2 1
0 0 1 1 0 0 1 1
[X ] =
1 1 1 1 2 2 2 2
1 1 1 1 1 1 1 1
7
COMBINATION OF TRANSFORMATIONS – As in
2D, we can perform a sequence of 3D linear
transformations.
This is achieved by concatenation of
transformation matrices to obtain a combined
transformation matrix
A combined matrix [T ][ X ] = [ X ][T1 ][T2 ][T3 ][T4 ] [Tn ]
Where [Ti] are any combination of
Translation
Scaling
Shearing linear trans. but not perspective
Rotation transformation
Reflection (Results in loss of info)
1 0 0 −1 1 0 0 0 cosθ 0 sin θ 0
0 1 0 −1 0 cosθ −sin θ 0 0 1 0 0
0 0 1 −1 0 sin θ cosθ 0 −sin θ 0 cosθ 0
0 0 0 1 0 0 0 1 0 0 0 1
8
Rotation about an axis parallel to a coordinate axis
Translate the axis(line) to coincide with the axis to
which it is parallel
Rotate the object by required angle
Translate the object back to its original position
Example – Consider the following cube. Rotate it
by 30º about an axis x’ passing through its centroid
1 0 0 −l 1 0 0 0 1 0 0 l 1 2 2 1 1 2 2 1
0 1 0 −m 0 cos θ −sin θ 0 0 1 0 m 1 1 2 2 1 1 2 2
[T ] =
0 0 1 −n 0 sin θ cos θ 0 0 0 1 n 2 2 2 2 2 1 1 1
0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1
1 0 0 0 1 2 2 1 1 2 2 1
0 0.866 − 0.5 0.951 1 1 2 2 1 1 2 2
[T ] =
0 0.5 0.866 − 0.549 2 2 2 2 2 1 1 1
0 0 0 1 1 1 1 1 1 1 1 1
1 2 2 1 1 2 2 1
0.817 0.817 1.683 1.683 1.317 1.317 2.183 2.183
=
1.683 1.683 2.183 2.183 0.817 0.817 1.317 1.317
1 1 1 1 1 1 1 1
9
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
Make the arbitrary axis coincide with one of the
coordinate axes.
Consider an arbitrary axis passing through a point
(x0, y0 ,z0)
Procedure
Translate (x0, y0 ,z0) so that the point is at origin
Make appropriate rotations to make the line
coincide with one of the axes, say z-axis
Rotate the object about z-axis by required angle
Apply the inverse of step 2
Apply the inverse of step 1
Coinciding the arbitrary axis with any axis
the rotations are needed about other two axes
α d
cz β
Y 1
Y
cx
d
cx
X
cz cy X
d = c y2 + c z2 cos α = sin α =
d d
cos β = d sin β = c x
10
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
The complete sequence of operations can be
summarised as follows:
1 0 0 0 1 0 0 0 cos β 0 −sin β 0
−1 0 1 0 0 −1 0 cos( −α ) sin( −α ) 0 −1 0 1 0 0
[Tr ] = [ Rα ] = [ Rβ ] =
0 0 1 0 0 −sin( −α ) cos( −α ) 0 sin β 0 cos β 0
x0 y0 z0 1 0 0 0 1 0 0 0 1
cos( − β ) 0 −sin( − β ) 0 d 0 cx 0
0 1 0 0 0 1 0 0
[ Rβ ] = =
sin( − β ) 0 cos( − β ) 0 −c x 0 d 0
0 0 0 1 0 0 0 1 cos δ sin δ 0 0
− sin δ cos δ 0 0
[ R] =
0 0 1 0
0 0 0 1
11
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
Direction cosines of a an arbitrary axis when two
points on the line are known:
( x1 , y1 , z1 )
V
( x0 , y0 , z0 )
[
[V ] = ( x1 − x0 ) ( y1 − y0 ) ( z1 − z 0 ) ]
( x1 − x0 ) ( y1 − y0 ) ( z1 − z 0 )
[c x cy cz ] =
( x1 − x0 ) 2 + ( y1 − y0 ) 2 + ( z1 − z 0 ) 2
[
| n | = 12 12 12 ]1 / 2 = 3
[c x cy cz ] = 1 1 1
3
12