Beruflich Dokumente
Kultur Dokumente
Transformation
"Transformation" is the elementary term
used for a variety of operation such as
translation, rotation, scaling, reflection,
shearing etc.
CAD requires transformations from
conceptual design and layout, through
detailed engineering and analysis of
components to definition of manufacturing
methods.
Transformation
Every aspect of modeling in CAD is
dependent on the transformation to view
model from different directions we need to
perform rotation operation.
To move an object to a different location
translation operation is done.
Similarly Scaling operation is done to
resize the object.
Coordinate Systems
Conventions
Right-hand side system
y y
z
x
z x
( z out of page ).
Model Coordinate System
MCS is defined as the reference space of
the model with respect to which all the
model geometrical data is stored.
Matrix form y
P P T x
2D Translation
Moving a polygon from position (a) to position (b)
with the translation vector (-5, 10), i.e.
5
T
0
y y
20 20
15 15
10 10
5 5
5 10 15 20 x 5 10 15 20 x
(a) (b)
2D Rotation about the origin.
P(x,y)
P(x,y)
r
r
x
2D Rotation about the origin.
Repositioning an object along a circular path in the xy-plane
P(x,y)
x r.cos
P(x,y)
r
y r.sin
r
y
x
x
2D Rotation about the origin.
x r.cos
y r.sin
Given us
x x.cos y.sin
y x.sin y.cos
2D Rotation about the origin.
x x.cos y.sin
y x.sin y.cos
x cos sin x
sin .
cos y
y
cos sin
Define the matrix R P R P
cos
sin ,
2D Rotation about a Pivot
position
Rotating about pivot position (xr, yr)
y
(x,y)
r
r
(x,y)
yr
xr x
x xr (x xr ) cos ( y yr ) sin
y yr (x xr ) sin ( y yr ) cos
2D Scaling from the origin.
Point P defined as P(x, y),
Perform a scale (stretch) to Point P(x, y) by a factor s x along the x axis,
and s y along the y axis.
x sx.x, y s y .y
Define the matrix P
P
sx 0
S
Now
0 sy
x s x 0 x
P S P y 0 s y y
.
o
r
2D Scaling
Altering the size of an object. Sx and Sy are the
scaling factors. If Sx = Sy then uniform scaling.
x xSx y
y ySy
Matrix form x
Sx = Sy =
x S x 0 x
y 0 S y y
P S P
x x
Sx = Sy =
Reduced in size and moved
closer to the origin
2D Scaling relative to Fixed
point
Scaling relative to fixed point (xf, yf)
x x f (x x f )S x y P1
P1
(xf , yf)
y y f ( y y f )S y P2 P2
P3
OR P3
x xSx x f (1 S x ) Sx = , Sy = x
y ySy y f (1 S y )
W P
W=1 plane
Y
Translations in homogenised
coordinates
x 1 0 d x x x x d x
y 0 . y
1 d y y y d y
1
0 0 1
1
11
Concatenation.
P P T (dx1, d y1 )
P P T (d x 2 , d y 2 )
P P T (dx1, d y1 ) T (d x 2 , d y 2 ) P T (dx1 d x 2 , d y1 d y 2 )
So we expect :
T (dx1, d y1 ) T (d x 2 , d y 2 ) T (dx1 d x 2 , d y1 d y 2 )
Concatenation.
0 0 1 0 0 1 0 0 1
Matrix product is variously referred to as compounding,
concatenation, or composition.
This single matrix is called the Coordinate Transformation Matrix or
CTM.
Homogeneous form of scale.
s x 0 0
S(s x , s y ) 0 s y 0
0 0 1
Concatenation of scales.
x cos sin 0 x
y sin cos 0 . y
1 0 0 1
1
World Coordinates
Example: 2D Geometric
Transformation
Modeling
Coordinates
Scale
Translate
Scale
Rotate
Translate
World Coordinates
Matrix Representation
Use 33 matrices to combine transformations
x 1 0 tx x
y 0 y
Translation 1 ty
1 0 0 1 1
x cos sin 0 x
Rotation y sin cos 0 y
1 0 0 1
1
x S x 0 0 x
0 y
Scaling y
Sy 0
1 0 1
0 1
Inverse Transformations
1 0 tx
Translation T 1
0 1 t y
0 0 1
cos sin 0
Rotation R1
sin
0
0
cos 1
0
1S x 0
0
Scaling S 1
0 1
Sy
0
0 0 1
Example
Consider the line with endpoints (10, 10) and (30, 25).
Translate it by tx = -20, ty = -10 and then rotate it by = 90.
y
(30, 25)
(10, 10)
Right-to-left
x cos sin 0 1 0 20 x
y 90 90 cos 0 0 1 10 y
sin 90
1 0 90 0 1 0 1
0 1
Solution
x cos sin 0 1 0 20 x
y 90 90 cos 0 0 1 10 y
sin 90
1 0
90 0 1 0 0 1 1
0 1 0 1 0 20 x
1
0 0 0
1 10 y
0 0 1 0 0 1 1
0 1 10 x
1 0 20 y
y
0 1 (30, 25)
0 1
(10, 10)
x
Solution (continue)
x 0 1 10 x y
y 1
0 20 y
(30, 25)
1 0 1
0 1 (-15, 10)
(10, 10)
x
(0, -10)
Point (10, 10)
x 0 1 10 10 0
y 1 0 20 10 10
1 0 1
0 1 1
Point (30, 25)
x 0 1 10 30 15
y 1 0 25 10
20
1 0 1 1 1
0
Reflection
Relative to the coordinate origin
y
x 1 0 0 x
y 0 1 0 y
1 0 0 1 x
1
Matrix form (4 4) y
x 1 0 0 tx x
0
y 1 0 t y y T(tx, ty, tz)
z 0 0 1 tz z
1 0 1 x
0 0 1
z
P T (tx ,t y ,tz )P
3D Rotation
z-axis
The 2D z-axis rotation equations are extended to 3D.
y
x x cos y sin
y x sin y cos
z z x
z
Matrix form
x cos sin 0 0 x y
sin
y cos 0 0 y
z 0 0 1 0 z
1 0 1 1
0 0 x
P Rz ( )P z
3D Rotation
x-axis
y
y y cos z
sin z y sin
z cos x x
x
z
Matrix form
x 1 0 0 0 x
0
y cos sin 0y
z 0 sin 0 z
1 0 cos 1 1
0 0
P Rx ( )P
3D Rotation
y-axis
y
z z sin x
cos x z sin
x cos y y
x
z
Matrix form
x cos 0 sin 0 x
0
y 1 0 0y
z sin 0 cos 0 z
1 1 1
0 0 0
P Ry ( )P
3D transformations
.
Y
P1(X1,Y1,Z1)
.
Z (to the back)
P1(X1,Y1,Z1)
Right-hand system
X
O
3D transformations
Matrix representation
4 x 4 matrices for 3-D, analogous to 3 x 3 matrices
for 2-D using homogeneous coordinates
Wx x
x Wy x
y ; usual notation W 1: y
y
Wz z
z
z
W 1
Each point in 3D space a line throught the origin in 4D space
3D Rotation
Elementary rotation around X-axis
X = X
Y = Y cos() - Z sin()
Z = Y sin() + Z cos()
Can be represented in matrix form as
x' 0 0 0 x
y'1 cos 0 y
0
z' sin sin 0 z
0 cos
1 11
0 0 0
RX ()
3D Rotation
Similarly for rotations around other axes
1 0 0 0
0 cos 0
RX ( ) =
0 sin sin 0
cos
0 0 0
1
cos 0 sin cos sin 0
0 0 0 sin
0
RY () = sin
0 1 0 0 RZ () = 0 cos 0 0
0
0 1 0
0 1 1
cos 0 0
0 0
3D Scaling
x xsx y
y ysy
z zsz
x
Matrix form z
x sx 0 0 x
y 0 0
0 y
z 0 sy 0 0 z
1 0 0 sz
1 1
0 0
P S(sx , sy , sz )P
3D Shear
Shears z-axis
x 1 0 shx 0 x
y 0
1 shy 0 y
z 0 0 1 0 z
1 0 1 1
0 0
Case Study: Computer
Graphics in Automotive Design
In this case study, we explore how we take a
three-dimensional image and render it
effectively in two dimensions.
This type of operation is very important in
automotive design allows engineers to
experiment with images on a computer
screen instead of using a three dimensional
model of the automobile.
We will first discuss how to convert a three-
dimensional image to a two-dimensional
picture using a perspective projection.
Perspective projection
We are given the center of projection (b;
c; d) and some data point (x; y; z).
We wish to find the point (x; y; 0) in the xy
plane which lies on the same line as (b; c;
d) and (x; y; z) space.
To find the coordinates x and y, we will
need to find the equation of the line
through (b; c; d) and (x; y; z).
We will then plot the two points X* Y* in
two dimensional point
Then we are looking for the equation of the line through p parallel to v, which may be
written as
THANK YOU