Lecture 3 Geometric Transformation
Lecture 3 Geometric Transformation
Transformation
• What is Design
• Transformation of geometry
• Colour Models
2
Objectives
• Learn about adding colour and shading to the display for better
visualization.
3
What is Design?
• As a noun, "a design" is used for both the final (solution) plan (e.g.
proposal, drawing, model, description) or the result of implementing
that plan (e.g. object produced, result of the process).
• More recently, processes (in general) have also been treated as products
of design, giving new meaning to the term "process design”
4
What is Design?
5
Some Popular Design
Approaches
6
Graphics Pipeline
7
What is CAD?
8
Major Benefits of CAD
• Productivity Increase
• Automation of repeated tasks
• Supports Changeability
• Keep track of previous design iterations
• Communication enhances
With other teams/engineers, e.g. manufacturing, suppliers
With other applications (CAE/FEM, CAM)
• Marketing, realistic product rendering
• Accurate, high quality drawings
• Mass Properties (Mass, Inertia)
• Collisions between parts, clearances
• Insert standard parts (e.g. fasteners) from database
9
Generic CAD Process
10
Coordinate systems
• In a 2-D coordinate system the X axis generally points from left to right,
and the Y axis generally points from bottom to top.
• When we add the third coordinate, Z, we have a choice as to whether
the Z-axis points into the screen or out of the screen.
• The right handed Cartesian coordinate system is used for defining the
geometry of the parts.
12
Coordinate systems
WCS
Display Coordinates
Display Coordinates
17
Transformation of Geometry
• Translation
• Scaling
• Reflection or Mirror
• Rotation
18
Transformation of Geometry
P*=[T]P
Where [T] is
transformation matrix
X* = X + dX or X1=X+Tx
Y* = Y + dY Y1=Y+Ty
X * X dX
P *
Y * Y dY
21
Translation
22
Scaling
S x 0 X
[ P* ] =
0 S y Y
23
Scaling
25
Reflection or Mirror
26
Reflection or Mirror
• Reflection about x-axis: The object can be reflected about x-axis with the
help of the following matrix
[T]=
• Reflection about y-axis: The object can be reflected about y-axis with the
help of following transformation matrix
[T]=
27
Reflection or Mirror
[T]=
[T]=
28
Reflection or Mirror
30
Rotation
x * cos sin x
[P ]=
*
y * sin cos y
31
Rotation About the Origin
observe: x-axis
(x1,y1)
• From the illustration we know that: r
B
sin (A + B) = y2/r cos (A + B) = x2/r
sin A = y1/r cos A = x1/r A
(0,0)
33
Rotation
(x1,y1) (x2,y2)
(x2,y2) (x1,y1)
r
r
A A
(0,0) (0,0)
34
Rotation about axes
rotation about the x axis rotation about the y axis rotation about the z axis
36
Rotation
Rotation transformation
38
Homogeneous Representation
x * 1 0 dX x
P * y * 0 1 dY y
1 0 0 1 1
Concatenation of transformations
• [P*] = [Tn] [Tn-1] [Tn-2] .. [T3] [T2] [T1]
39
Rotation about an arbitrary
point
• Translate the point P to O, the origin of the axes system.
40
Rotation about an arbitrary
point
• Rotate the mirror line such that it coincides with the X-axis.
• Rotate the mirror line back to the original angle with X-axis.
• Translate the mirror line along the Y-axis back to the original position.
42
Reflection about an arbitrary
line
44
Scaling about an arbitrary
Point
45
3D Transformations
x * 1 0 0 dX x
y * 0 1
0 dY y
z * 0 0 1 dZ z
1 0 0 0 1 1
46
3D Reflection
x * 1 0 0 0 x
y * 0 1 0 0 y
z * 0 0 1 0 z
1 0 0 0 1 1
47
3D Rotation about Z-axis
(XY plane)
x * cos sin 0 0 x
y * sin cos 0
0 y
z * 0 0 1 0 z
1 0 0 0 1 1
48
Homogeneous Representation
49
Homogeneous Representation
• The two types of coordinates are related to each other by the following
equation:
50
Homogeneous Representation
x * 1 0 xd x x* x xd
y * 0 1 y . y y* y yd
d
11
1 0 0 1 1
2D translation is now 3x3.
sx 0 0
S 0 sy 0
0 0 1
2D Scaling is now 3x3.
cos sin 0 x
Rz sin cos 0 . y
0 0 1 1
2D rotation is now 3x3.
1 0 0
M 0 1 0
0 0 1
2D reflection is now 3x3.
55
Concatenated Transformations
56
Concatenation
Q. The vertices of a triangle are situated at points (15, 30), (25, 35) and
(5, 45). Find the coordinates of the vertices if the triangle is first rotated 10°
counter clockwise direction about the origin and then scaled to twice its size.
15 25 5
P 30 35 45
1 1 1
P* T P
Multiplying the end points with the transformation matrix, we get new coordinates as
(51.276, 73.86), (75.896, 96.16) and (39.408, 87.48)
57
Concatenated Transformations
• Rotate the box 90 degrees around an axis that runs through P and is vertical
on the xy-plane. The box has side edges of length 1 and the coordinate
P(2,3,4) and Q (2,4,4), find the modified P2 and Q2 .
58
Summary
• Coordinate Systems :
World Coordinate system
User coordinate system
Display Coordinates
• Concatenated Transformations
59
Summary
• Geometric transformations can be handled conveniently using matrix
algebra.
60
References
4. https://www.javatpoint.com/computer-graphics-homogeneous-
coordinates
61
Thank you!!
Translation
Translate a triangle with vertices at original coordinates (10,20),
(10,10), (20,10) by tx=5, ty=10.
63
Scaling
Scale a triangle with respect to the origin, with vertices at original
coordinates (10,20), (10,10), (20,10) by sx=2, sy=1.5.
64
Reflection or Mirror
Find reflected position of the Triangle (3,4), (6,4), (4,8) w.r.t X axis .
65
66
Concatenated
Transformations
67
Concatenated
Transformations
68
Concatenated
Transformations
• Rotate the box 90 degrees around an axis that runs through P and is vertical
on the xy-plane. The box has side edges of length 1 and the coordinate
P(2,3,4) and Q (2,4,4), find the modified P2 and Q2 .
69
• With our knowledge about transformations it should be a good
strategy to:
1. Move the point P in to the z-axis, the matrix T1
2. Rotate around the z-axis, the matrix R
3. Move the box back, the matrix T2’
becomes
Positive
[X*]
71
Example – Transform 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 +30°about x-axis and +45°about y axis
The concatenated transformation matrix is:
Example – Consider the following cube. Rotate it by 30º about
an axis x’ passing through its centroid
73
74