l6_3dtrans.pdf
TRANSCRIPT
-
7/27/2019 L6_3dtrans.pdf
1/12
3D TRANSFORMATIONS
1. Linear 3D Transformations:Translation, Rotation, Scaling
Shearing, Reflection
2. Perspective Transformations
AML710 CAD LECTURE 6
Transformations in 3 dimensions
Geometric transformations are mappings fromone coordinate system onto itself.
The geometric model undergoes changerelative to its MCS (Model CoordinateSystem)
The Transformations are applied to an objectrepresented by point sets.
Rigid Body Motion: The relative distances
between object particles remain constantAffine and Non-Affine maps
Transformed point set X* = f(P, transformationparameters)
-
7/27/2019 L6_3dtrans.pdf
2/12
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.
y
h
x
(x, y, z, h)
Generalized 4 x 4 transformation matrix inhomogeneous coordinates
=
snml
rjfc
qieb
pgda
T][
Perspective transformations
Linear transformations local scaling, shear,rotation / reflection
Translations l, m, n along x, y, and z axis
Overall scaling
LocalScaling
-
7/27/2019 L6_3dtrans.pdf
3/12
3D Scaling
=
1000
000000
000
][j
e
a
Ts
=
1111111100001111
33003300
02200220
][][ sTX
Ex: Required scaling to scale theRPP to a unit cube is , 1/3, 1
Overall Scaling
=
s
Ts
000
0100
0010
0001
][
=
11111111
00002222
22002200
02200220
][X
Ex: Uniformly scale the unit cube by a factor of 2requires s=
[ ] [ ]
[ ]T
T
s
szsysx
szyxXT
1/'/'/'
'''][
=
=
If S1 Reduction
in volume
-
7/27/2019 L6_3dtrans.pdf
4/12
3D SHEARING
=
11111111
7.095.025.007.195.125.11
115.085.00215.115.01
75.025.01025.075.05.15.0
][X
Ex: Uniformly scale the unit cube by a factor of 2requires d= -0.75, g=0.5,i=1, b=-0.85,c=0.25,f=0.7
[ ] [ ]Ts zfycxizybxgzydxXT 1][ ++++++=
=
11000
01
01
01
][z
y
x
fc
ib
gd
TSH
3D ROTATIONS (i) Rotation about z-axis
We are already familiar with rotation
about z-axis ( in 2D rotations)
=
1000
0100
00cossin
00sincos
][
RzT
Det[T]=+1
The position vector is assumed to be a row vector in right handed system
-
7/27/2019 L6_3dtrans.pdf
5/12
3D ROTATIONS (ii) Rotation about x-axis
Similarly we can obtain rotation matrix
about x-axis
=
1000
0cossin0
0sincos0
0001
][
RxT
3D ROTATIONS (iii) Rotation about y-axis
We can obtain rotation
about y-axis as
=
1000
0cos0sin
0010
0sin0cos
][
RyT
-
7/27/2019 L6_3dtrans.pdf
6/12
Example for the RPP given by the matrix belowobtain -90 rotation about x -axis
=
11111111
00001111
22002200
03300330
][X
=
1000
0010
0100
0001
][RxT
=
11111111
2200220000001111
03300330
][X
Example for the RPP given by the matrix belowobtain 90 rotation about y -axis
=
11111111
00001111
22002200
03300330
][X
=
1000
0001
0010
0100
][Ry
T
=
11111111
03300330
22002200
00001111
][X
-
7/27/2019 L6_3dtrans.pdf
7/12
3D REFLECTIONS As in 2D, we can perform 3Dtransformations about a plane now.
Rotation of 180about an axis passing throughorigin out into 4-D space and projection back onto3D space.
Through x-y plane
Similarly through y-z and x-z planes are
and
=
1000
0100
0010
0001
][xyT
=
10000100
0010
0001
][yz
T
=
10000100
0010
0001
][xz
T
Det[T]=-1
Example for the RPP given by the matrix belowobtain 3D reflection through xy - plane
=
11111111
22221111
11001100
12211221
][X
=
1000
0100
0010
0001
][xy
T
=
11111111
22221111
1100110012211221
][X
-
7/27/2019 L6_3dtrans.pdf
8/12
COMBINATION OF TRANSFORMATIONS As in2D, we can perform a sequence of 3D linear
transformations.This is achieved by concatenation of
transformation matrices to obtain a combinedtransformation matrix
A combined matrix
Where [Ti] are any combination of
Translation
Scaling
Shearing linear trans. but not perspective
Rotation transformation
Reflection (Results in loss of info)
nTTTTTXXT 4321][]][[ =
ExampleTransform the given position vector [ 3 2 1 1]by the following sequence of operations(i) Translate by 1, -1, -1 in x, y, and z respectively(ii) Rotate by +30about x-axis and +45about y axisThe concatenated transformation matrix is:
==
1000
0cos0sin
0010
0sin0cos
1000
0cossin0
0sincos0
0001
1000
1100
1010
1001
])45(
][)30(
][[][
ryTrxTtrTT
=
=
1
061.1
866.0
768.1
1
1
2
3
1000
259.0612.0354.0707.0
366.05.0866.00
673.1612.0354.0707.0
]][[ XT
-
7/27/2019 L6_3dtrans.pdf
9/12
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 itby 30 about an axis x passing through its centroid
l=3/2,m3/2 and n=3/2
=
11111111
11122222
22112211
12211221
1000
100
010
001
1000
0cossin0
0sincos0
0001
1000
100
010
001
][n
m
l
n
m
l
T
=
=
11111111
317.1317.1817.0817.0183.2183.2683.1683.1
183.2183.2317.1317.1683.1683.1817.0817.0
12211221
11111111
11122222
22112211
12211221
1000
549.0866.05.00
951.05.0866.00
0001
][T
-
7/27/2019 L6_3dtrans.pdf
10/12
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 linecoincide 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
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
To calculate the angles of rotations about the x andy axes consider direction cosines (cx, cy ,cz)
d
c
d
cccd
yzzy ==+= sincos22
xcd == sincos
Y
X
Z
cx
1
d
Y
X
Z
cy
cz
cx
d
-
7/27/2019 L6_3dtrans.pdf
11/12
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
The complete sequence of operations can be
summarised as follows:
111][][]][][][][[][= TrRRRRRTrT
=
1
0100
0010
0001
][
000 zyx
Tr
=
1000
0)cos(0)sin(
0010
0)sin(0)cos(
][
R
=
1000
0cossin0
0sincos0
0001
][
R
=
1
01000010
0001
][
000
1
zyx
Tr
=
1000
0)cos()sin(00)sin()cos(0
0001
][1
R
=
1000
0cos0sin0010
0sin0cos
][ 1
R
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
Substituting for the respective angles we obtain thefollowing matrices:
111][][]][][][][[][= TrRRRRRTrT
=
=
1000
00
0010
00
1000
0)cos(0)sin(
0010
0)sin(0)cos(
][dc
cd
Rx
x
=
=
1000
0//0
0//0
0001
1000
0cossin0
0sincos0
0001
][dcdc
dcdcR
zy
yz
=
1000
0100
00cossin
00sincos
][
R
-
7/27/2019 L6_3dtrans.pdf
12/12
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
Direction cosines of a an arbitrary axis when two
points on the line are known:
)()()(][ 010101 zzyyxxV =
),,( 000 zyx
),,( 111 zyx
V
++
= 2
012
012
01
010101
)()()(
)()()(
][ zzyyxxzzyyxx
zyx ccc
ROTATION ABOUT AN ARBITRARY AXIS IN SPACE
Find the transformation matrix for reflection withrespect to the plane passing through the origin andhaving normal vector n = i+j+k
[ ] 3111|| 2/1222 ==n
n
=
3
111][ zyx ccc