SlideShare a Scribd company logo
1 of 27
Download to read offline
1
CHAPTER 2.1 : FUNDAMENTAL OF COMPUTER GRAPHICS
Prof. RATNADEEPSINH M. JADEJA
Assistant Professor
Mechanical Department
Mechanical Engineering Department – School Of Engineering
GEOMETRIC TRANSFORMATIONS
2
All the changes performed on the graphic image are done by changing the database of
the original picture.
These changes are called as transformations.
Geometric transformations are used for the following purposes:
1. They are a must in the creation of a model, or the purpose of viewing it.
2. They are used to express location of objects relative to others.
3. Geometric transformations can be used to view an object from different positions and
directions.
4. They can be used to perform certain transformations such as translate/move, rotate,
scale and mirror.
5. They can also be used to obtain orthographic and perspective views of a model.
6. Geometrical Transformations with the help of kinematic analysis can be used to create
animation to study the motion of the model.
Mechanical Engineering Department – School Of Engineering
FORMULATION
3
P2(x2,y2)
P1(x1,y1)
Y
X
X2
X1
Y2
Y1
A point represented by a 1 × 2 matrix
P1 = [x1,y1]
Similarly, a line can be represented as :
L =
1
2
=
1 1
2 2
Line represented after transformation
L’ = L [TM]
Where, [TM] = Transformation Matrix
0
Mechanical Engineering Department – School Of Engineering
TRANSLATION
4
(x1, y1)
(x2, y2)
(x1’, y1’)
(x2’, y2’)
Translation Matrix T = [tx ty]
Equation of line L =
1 1
2 2
Transferred line represented as
L’ = L + [T] =
1 1
2 2
+ [tx ty]
X
Y
0
Mechanical Engineering Department – School Of Engineering
TRANSLATION
5
A(1,1)
B(7,3)
C(1,4)
A(4,3)
B(4,1)
C(4,6)
A triangle translated 3 unit in x direction and 2
unit in y direction.
Triangle ABC represented as
ΔABC =
1 1
4 1
1 4
Translation equation of triangle is
ΔA’B’C’ = ΔABC + [tx ty]
ΔA’B’C’ =
1 1
4 1
1 4
+ [3 2]
=
4 3
7 3
4 6
X0
Y
Mechanical Engineering Department – School Of Engineering
ROTATION
6
X
Y
P(x,y)
P’(x’,y’)
r
r
x=r cosф
y=rsinф
X’=r cos(Ɵ+ф)
y’=rsin(Ɵ+ф)
ф
Ɵ
Point P is represented as
P = [x y]
= [r cos ф r sin ф]
The rotated point be represented as :
P’ = [r cos(Ɵ+ф) r sin(Ɵ+ф)]
= [r (cos Ɵcos ф – sinƟ sin ф) r (sin Ɵ cos ф + cos
Ɵ sin ф )
= [(x cos Ɵ – y sin Ɵ) (x sin Ɵ + y cos Ɵ)
This can be expressed as :
P’ = [x y]
cos Ɵ sin Ɵ
− Ɵ cos Ɵ
= = P × [R]
where R is rotation matrix
R =
cos Ɵ sin Ɵ
− Ɵ cos Ɵ
If rotation is anticlockwise then Ɵ is +VE
If rotation is clockwise then Ɵ is -VE
Mechanical Engineering Department – School Of Engineering
SCALING
7
B’(4,2)
A(1,1)
C(1,2)
A’(2,2)
B(2,1)
C’(2,4)
X0
Y Scaling transformation alters the size of the object.
Scaling can be uniform(in X and Y direction) or non-
uniform (either in x direction or in Y direction.
Scaling in X = Sx
Scaling in Y = Sy
Example: A uniform scaling factor Sx = Sy = 2
ΔA’B’C’ = ΔABC · S
ΔA’B’C’ =
1 1
2 1
1 2
·
0
0
=
2 2
4 2
2 4
Mechanical Engineering Department – School Of Engineering
REFLECTION (MIRROR)
8
Reflection transformation equation.
P’ = P · M
Where M is a reflection matrix
X
Y
1 2
3
1’2’
3’
(a) Reflection about Y axis
M =
−1 0
0 1
1 2
3
1’ 2’
3’
(b) Reflection about X axis
M =
1 0
0 −1 1 2
3
1’
2’ 3’ (c) Reflection about y = x axis
M =
0 1
1 0
Reflection is the process of obtaining a mirror of the original shape
Mechanical Engineering Department – School Of Engineering
REFLECTION (MIRROR)
9
Reflection is the process of obtaining a mirror of the original shape
Reflection transformation equation.
P’ = P · M
Where M is a reflection matrix
X
Y
(d) Reflection about y = -x
M =
0 −1
−1 0
(e) Reflection about x and y axis
M =
−1 0
0 −1
X
Y
1 2
3
1’
2’3’
1 2
3
1’2’
3’
1’’2’’
3’’
Mechanical Engineering Department – School Of Engineering
SHEAR
10
This transformation causes the image to slant.
The y shear preserves all the x coordinate values
but shifts the y values.
The x shear preserves all the y coordinate values
but shifts the x values.
P’ = P · SH
SH =
1
0 1
for y shear
SH =
1 0
1
for x shear
X
Y
A B
CD
A’ B’
C’D’
Mechanical Engineering Department – School Of Engineering
HOMOGENEOUS COORDINATES
11
P (x, y) which can be expressed as P (x’ y’ h)
Where x = x’/h and y = y’/h
Where h is non zero number. A convenient value for h = 1.
So in homogeneous coordinate system point P is expressed as P (x, y, 1)
The general transformation matrix is also modified to a 3 × 3 matrix expressed in the form :
0
0
1
Mechanical Engineering Department – School Of Engineering
e). Shear :
HOMOGENEOUS COORDINATES
12
The important matrix transformations in the homogeneous coordinate system will now be modified as under.
T =
1 0 0
0 1 0
1
a). Translation : b). Rotation :
R =
Ɵ sin Ɵ 0
− sin Ɵ cos Ɵ 0
0 0 1
c). Scaling :
S =
0 0
0 0
0 0 1
d). Reflection / Mirror :
M =
0
0
0 0 1
For y shear, SHy =
1 0
0 1 0
0 0 1
For x shear, SHx =
1 0 0
1 0
0 0 1
Mechanical Engineering Department – School Of Engineering
INVERSE TRANSLATIONS
13
T =
0
0
1
Find out the inverse matrix of T
inv
0
0
1
=
− 0
− 0
− − −
inv
1 0 0
0 1 0
1
=
1 0 0
0 1 0
− − 1
Inverse Transformation for Translation:
Inverse Transformation for Rotation:
inv
cos Ɵ sin Ɵ 0
− sin Ɵ cos Ɵ 0
0 0 1
=
cos Ɵ − sin Ɵ 0
sin Ɵ cos Ɵ 0
0 0 1
=
cos(− Ɵ) sin(−Ɵ) 0
−sin(−Ɵ) cos(− Ɵ) 0
0 0 1
Inverse Transformation for Scaling:
inv
0 0
0 0
0 0 1
=
1/ 0 0
0 1/ 0
0 0 1
Mechanical Engineering Department – School Of Engineering
CONCATENATION OR COMPOSITE TRANSFORMATION
14
With homogeneous coordinates, composite transformations (more than one) can be done
by calculating the matrix product for all individual transformations.
First let us consider some properties of matrices.
1. As general rule, matrix multiplication is not commutative. A·B ≠ B · A
2. Matrix multiplication is associative. For any three matrices, A, B and C,
A · B · C = (A · B) · C = A · (B · C)
Mechanical Engineering Department – School Of Engineering
ROTATION ABOUT ANY POINT
15
1
1’
2
2’
3
3’
(a) Rotation about Origin
+
(a) Rotation about any given point
Mechanical Engineering Department – School Of Engineering
ROTATION ABOUT ANY POINT
16
+
P (x, y)
x
Y
a) Original shape
+
+
b) Translate to Origin
+
+
c) Rotation about Origin
+
d) Translate back to Original Point
P’ = P · T · R · (inv T)
Mechanical Engineering Department – School Of Engineering
SCALING ABOUT ANY POINT
17
+
P(X, Y)
X
Y
a) Original shape
+
b) Translation to Origin
+ +
+
c) Scaling about Origin
+
d) Translate back to Original Point
P’ = P · T · S · (inv T)
Mechanical Engineering Department – School Of Engineering
REFLECTION ABOUT ANY AXIS y = mx + c
18
a) Original Shape b) Translation to Origin
c) Rotation
d) Reflection
e) Inverse Rotation f) Inverse Translation
Original Image
Mirror Image
P’ = P · T · R · M · [inv R] · [inv T]
Mechanical Engineering Department – School Of Engineering
Example
19
Ex 1. A rectangle is formed by four points ABCD whose coordinates are: A (50, 50), B(100, 50),
C(100, 80) and D(50,80). Calculate the new coordinates of the rectangle in reduced size using
the scaling factors Sx = 0.5 and Sy = 0.6
Ans. =
25 30 1
50 30 1
50
25
48
48
1
1
Mechanical Engineering Department – School Of Engineering
Example
20
Ex 2. Write a 3 × 3 transformation matrix for the following effects:
a). Scale the image to be twice as large and then translate it 1 unit to the left.
b). Scale X direction to be half as large and then rotate anticlockwise by 90° about the origin
c). Rotate anticlockwise about origin by 90° and then scale the X direction by half as large.
d). Translate down 0.5 unit, right 0.5 unit, and then rotate anticlockwise by 45°.
Ans. = a) G = S · T
=
2 0 0
0 2 0
−1 0 1
Ans. = b) G = S · R
=
0 0.5 0
−1 0 0
0 0 1
Ans. = c) G = R · S
=
0 1 0
−0.5 0 0
0 0 1
Ans. = d) G = T · R
=
0.707 0.707 0
−0.707 0.707 0
0.707 0 1
Mechanical Engineering Department – School Of Engineering
Example
21
Ex. 3 A triangle ABC has its Vertices at A(0, 0), B(4, 0), and C(2, 3). It is to be translated by
4 units in X direction, and 2 units in Y direction, then it is to be rotated in anticlockwise
direction about the new position of point C through 90°. Find the new position of the
triangle
Ans. ΔA’B’C’ = ΔABC · T
=
4 2 1
8 2 1
6 5 1
ΔA’’B’’C’’ = ΔA’B’C’ · T · R · (inv T)
=
9 3 1
9 7 1
6 5 1
Mechanical Engineering Department – School Of Engineering
Example
22
Ex. 4 Triangle PQR has vertices as P(2, 4), Q(4, 6) and R(2, 6). It is Desired to reflect through an
arbitrary line L whose equation is y = 0.5 X + 2. Calculate the new vertices of triangle and show
the results graphically.
ΔPQR =
2 4 1
4 6 1
2 6 1
Reflection about y = 0.5 X +2
ty = -2,
m = slope =tan Ɵ
Ɵ = 26.565°
ΔP’Q’R’ = ΔPQR · T · R · M · (inv R) · (inv T)
ANS =
2.8 2.4 1
5.6 2.8 1
4.4 1.2 1
Mechanical Engineering Department – School Of Engineering
THREE DIMENSIONAL TRANSFORMATIONS
23
X
Z
Y
a). Translation :
[x’ y’ z’ 1] = [x y z 1] ·
1 0 0 0
0 1 0 0
0 0 1 0
1
b). Rotation :
Rz =
Ɵ Ɵ 0 0
− Ɵ Ɵ 0 0
0 0 1 0
0 0 0 1
i). Rotation about Z axis: ii). Rotation about X axis :
Rx =
1 0 0 0
0 Ɵ Ɵ 0
0 − Ɵ Ɵ 0
0 0 0 1
ii). Rotation about Y axis :
Ry =
Ɵ 0 − Ɵ 0
0 1 0 0
Ɵ 0 Ɵ 0
0 0 0 1
Mechanical Engineering Department – School Of Engineering
THREE DIMENSIONAL TRANSFORMATIONS
24
c). Scaling :
S =
0 0 0
0 0 0
0 0 0
0 0 0 1
d). Reflection :
Mxy =
1 0 0 0
0 1 0 0
0 0 −1 0
0 0 0 1
i). Reflection about XY plane: ii). Reflection about YZ plane :
Myz =
−1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
ii). Reflection about XZ plane :
Mxz =
1 0 0 0
0 −1 0 0
0 0 1 0
0 0 0 1
X
Y
Z
Mechanical Engineering Department – School Of Engineering
Example
25
Ex 5. State the homogeneous transformation matrices for the following operations.
a) Rotation through 120° about origin.
b) Translation through 10 and -20 units along the x and y direction respectively.
c) Rotation through 30° about origin.
Find concatenated matrix if the operations are done in above sequence. Will the order
in which the operations are done affect the end result?
Mechanical Engineering Department – School Of Engineering
Example
26
Ex 6. A triangle ABC having coordinates A (3, 4, -2) and B (-4, 6, 3), C (-6, 4, 3) is to be
rotated about X axis by 20° anticlockwise. Determine the new coordinates of the triangle.
Mechanical Engineering Department – School Of Engineering
Example
27
Ex 7. Given a point P (1, 3, -5), find :
a) Transformed point P’ if P is Translated by 2 unit in X 3 unit in Y and -4 unit in Z and
then rotated by 30° about the Z axis.
b). Same as in (a), but the point P is rotated first and then translated.
c). Is the final point P’ the same in both (a) and (b) ? Explain your answer.

More Related Content

What's hot

What's hot (20)

Robotics position and orientation
Robotics position and orientationRobotics position and orientation
Robotics position and orientation
 
Hermite bicubic-surface-patch
Hermite bicubic-surface-patchHermite bicubic-surface-patch
Hermite bicubic-surface-patch
 
Graphics Kernel System (GKS).pptx
Graphics Kernel System (GKS).pptxGraphics Kernel System (GKS).pptx
Graphics Kernel System (GKS).pptx
 
Geometric Curves
Geometric Curves Geometric Curves
Geometric Curves
 
Visual realism
Visual realismVisual realism
Visual realism
 
CADCAM CAE Notes
CADCAM CAE NotesCADCAM CAE Notes
CADCAM CAE Notes
 
Curve and Surface
Curve and SurfaceCurve and Surface
Curve and Surface
 
Visual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSVisual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODS
 
Reverse engineering
Reverse engineeringReverse engineering
Reverse engineering
 
191483523 geometric-modeling
191483523 geometric-modeling191483523 geometric-modeling
191483523 geometric-modeling
 
Surfaces
SurfacesSurfaces
Surfaces
 
Geometric model & curve
Geometric model & curveGeometric model & curve
Geometric model & curve
 
ppt of solid modeling for cad
ppt of solid modeling for cadppt of solid modeling for cad
ppt of solid modeling for cad
 
Graphics standards
Graphics standardsGraphics standards
Graphics standards
 
Coons bicubic surface
Coons bicubic surfaceCoons bicubic surface
Coons bicubic surface
 
4. graphics standard
4. graphics standard4. graphics standard
4. graphics standard
 
Cnc control systems
Cnc control systemsCnc control systems
Cnc control systems
 
Solid modelling
Solid modellingSolid modelling
Solid modelling
 
Geometric Modeling
Geometric Modeling Geometric Modeling
Geometric Modeling
 
Reverse engineering & its application
Reverse engineering & its applicationReverse engineering & its application
Reverse engineering & its application
 

Viewers also liked

Intro to mechanical vibrations
Intro to mechanical vibrationsIntro to mechanical vibrations
Intro to mechanical vibrationsFizah Amer
 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.Mohd Arif
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALVivek Kumar Sinha
 
Bresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmBresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmMahesh Kodituwakku
 
1 introduction to mechanical vibrations (eng. ahmed abd el aleem amin)
1     introduction to mechanical vibrations (eng. ahmed abd el aleem amin)1     introduction to mechanical vibrations (eng. ahmed abd el aleem amin)
1 introduction to mechanical vibrations (eng. ahmed abd el aleem amin)Ahmed Abdel-Aleem
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Vapour compression refrigeration system
Vapour compression refrigeration systemVapour compression refrigeration system
Vapour compression refrigeration systemnaphis ahamad
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Saikrishna Tanguturu
 
vapour compression refrigeration system
vapour compression refrigeration systemvapour compression refrigeration system
vapour compression refrigeration systemAbhishek Choksi
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 

Viewers also liked (16)

Primitives
PrimitivesPrimitives
Primitives
 
Cs580
Cs580Cs580
Cs580
 
CAD STANDARDS
CAD STANDARDSCAD STANDARDS
CAD STANDARDS
 
Intro to mechanical vibrations
Intro to mechanical vibrationsIntro to mechanical vibrations
Intro to mechanical vibrations
 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
 
graphic stadards
graphic stadardsgraphic stadards
graphic stadards
 
Bresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmBresenham Line Drawing Algorithm
Bresenham Line Drawing Algorithm
 
1 introduction to mechanical vibrations (eng. ahmed abd el aleem amin)
1     introduction to mechanical vibrations (eng. ahmed abd el aleem amin)1     introduction to mechanical vibrations (eng. ahmed abd el aleem amin)
1 introduction to mechanical vibrations (eng. ahmed abd el aleem amin)
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Graphic standards
Graphic standardsGraphic standards
Graphic standards
 
Vapour compression refrigeration system
Vapour compression refrigeration systemVapour compression refrigeration system
Vapour compression refrigeration system
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
vapour compression refrigeration system
vapour compression refrigeration systemvapour compression refrigeration system
vapour compression refrigeration system
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Mechanical Vibration- An introduction
Mechanical Vibration- An introductionMechanical Vibration- An introduction
Mechanical Vibration- An introduction
 

Similar to 2.1. fundamental of computer graphics

Two dimensional geometric transformation
Two dimensional geometric transformationTwo dimensional geometric transformation
Two dimensional geometric transformationjapan vasani
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling TransformationsTarun Gehlot
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D2013901097
 
Jee advanced-2020-paper-1-solution
Jee advanced-2020-paper-1-solutionJee advanced-2020-paper-1-solution
Jee advanced-2020-paper-1-solutionAnkitBiswas17
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transformPatel Punit
 
Geometry unit 9.3
Geometry unit 9.3Geometry unit 9.3
Geometry unit 9.3Mark Ryder
 
Rotation in 3d Space: Euler Angles, Quaternions, Marix Descriptions
Rotation in 3d Space: Euler Angles, Quaternions, Marix DescriptionsRotation in 3d Space: Euler Angles, Quaternions, Marix Descriptions
Rotation in 3d Space: Euler Angles, Quaternions, Marix DescriptionsSolo Hermelin
 
Electromagnetic theory Chapter 1
Electromagnetic theory Chapter 1Electromagnetic theory Chapter 1
Electromagnetic theory Chapter 1Ali Farooq
 
2D Transformation
2D Transformation2D Transformation
2D TransformationShahDhruv21
 
Geometry unit 9.5
Geometry unit 9.5Geometry unit 9.5
Geometry unit 9.5Mark Ryder
 
TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...Yong Heui Cho
 

Similar to 2.1. fundamental of computer graphics (20)

Two dimensional geometric transformation
Two dimensional geometric transformationTwo dimensional geometric transformation
Two dimensional geometric transformation
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
Modeling Transformations
Modeling TransformationsModeling Transformations
Modeling Transformations
 
Transforms UNIt 2
Transforms UNIt 2 Transforms UNIt 2
Transforms UNIt 2
 
Computer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2DComputer Graphic - Transformations in 2D
Computer Graphic - Transformations in 2D
 
Computer Graphics - transformations in 2d
Computer Graphics - transformations in 2dComputer Graphics - transformations in 2d
Computer Graphics - transformations in 2d
 
Jee advanced-2020-paper-1-solution
Jee advanced-2020-paper-1-solutionJee advanced-2020-paper-1-solution
Jee advanced-2020-paper-1-solution
 
Two dimentional transform
Two dimentional transformTwo dimentional transform
Two dimentional transform
 
Circunfêrencia 3
Circunfêrencia 3Circunfêrencia 3
Circunfêrencia 3
 
Geometry unit 9.3
Geometry unit 9.3Geometry unit 9.3
Geometry unit 9.3
 
Cônicas 2
Cônicas 2Cônicas 2
Cônicas 2
 
Trigfinal
TrigfinalTrigfinal
Trigfinal
 
Rotation in 3d Space: Euler Angles, Quaternions, Marix Descriptions
Rotation in 3d Space: Euler Angles, Quaternions, Marix DescriptionsRotation in 3d Space: Euler Angles, Quaternions, Marix Descriptions
Rotation in 3d Space: Euler Angles, Quaternions, Marix Descriptions
 
Centroid
CentroidCentroid
Centroid
 
1533 game mathematics
1533 game mathematics1533 game mathematics
1533 game mathematics
 
Electromagnetic theory Chapter 1
Electromagnetic theory Chapter 1Electromagnetic theory Chapter 1
Electromagnetic theory Chapter 1
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Geometry unit 9.5
Geometry unit 9.5Geometry unit 9.5
Geometry unit 9.5
 
TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...TM plane wave scattering from finite rectangular grooves in a conducting plan...
TM plane wave scattering from finite rectangular grooves in a conducting plan...
 
1.3428190.pdf
1.3428190.pdf1.3428190.pdf
1.3428190.pdf
 

More from Ratnadeepsinh Jadeja (20)

Alloys and phase diagrams
Alloys and phase diagramsAlloys and phase diagrams
Alloys and phase diagrams
 
Solid solution
Solid solutionSolid solution
Solid solution
 
Crystal structures
Crystal structuresCrystal structures
Crystal structures
 
Ferrous material
Ferrous materialFerrous material
Ferrous material
 
Engineering Materials
Engineering MaterialsEngineering Materials
Engineering Materials
 
Measurement of surface finish
Measurement of surface finishMeasurement of surface finish
Measurement of surface finish
 
Force, torque and power measurement
Force, torque and power measurementForce, torque and power measurement
Force, torque and power measurement
 
Work measurement
Work measurementWork measurement
Work measurement
 
Pressure measurement
Pressure measurementPressure measurement
Pressure measurement
 
Method study
Method studyMethod study
Method study
 
Productivity
ProductivityProductivity
Productivity
 
Tempreture measurement
Tempreture measurementTempreture measurement
Tempreture measurement
 
Production planning and control
Production planning and controlProduction planning and control
Production planning and control
 
Site selection and plant layout
Site selection and plant layoutSite selection and plant layout
Site selection and plant layout
 
Introduction to generalized measurement system
Introduction to generalized measurement systemIntroduction to generalized measurement system
Introduction to generalized measurement system
 
Standards of Measurement
Standards of MeasurementStandards of Measurement
Standards of Measurement
 
Introduction to metrology
Introduction to metrologyIntroduction to metrology
Introduction to metrology
 
Gear boxes
Gear boxesGear boxes
Gear boxes
 
Brakes
BrakesBrakes
Brakes
 
Corrosion in Metal
Corrosion in MetalCorrosion in Metal
Corrosion in Metal
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

2.1. fundamental of computer graphics

  • 1. 1 CHAPTER 2.1 : FUNDAMENTAL OF COMPUTER GRAPHICS Prof. RATNADEEPSINH M. JADEJA Assistant Professor Mechanical Department
  • 2. Mechanical Engineering Department – School Of Engineering GEOMETRIC TRANSFORMATIONS 2 All the changes performed on the graphic image are done by changing the database of the original picture. These changes are called as transformations. Geometric transformations are used for the following purposes: 1. They are a must in the creation of a model, or the purpose of viewing it. 2. They are used to express location of objects relative to others. 3. Geometric transformations can be used to view an object from different positions and directions. 4. They can be used to perform certain transformations such as translate/move, rotate, scale and mirror. 5. They can also be used to obtain orthographic and perspective views of a model. 6. Geometrical Transformations with the help of kinematic analysis can be used to create animation to study the motion of the model.
  • 3. Mechanical Engineering Department – School Of Engineering FORMULATION 3 P2(x2,y2) P1(x1,y1) Y X X2 X1 Y2 Y1 A point represented by a 1 × 2 matrix P1 = [x1,y1] Similarly, a line can be represented as : L = 1 2 = 1 1 2 2 Line represented after transformation L’ = L [TM] Where, [TM] = Transformation Matrix 0
  • 4. Mechanical Engineering Department – School Of Engineering TRANSLATION 4 (x1, y1) (x2, y2) (x1’, y1’) (x2’, y2’) Translation Matrix T = [tx ty] Equation of line L = 1 1 2 2 Transferred line represented as L’ = L + [T] = 1 1 2 2 + [tx ty] X Y 0
  • 5. Mechanical Engineering Department – School Of Engineering TRANSLATION 5 A(1,1) B(7,3) C(1,4) A(4,3) B(4,1) C(4,6) A triangle translated 3 unit in x direction and 2 unit in y direction. Triangle ABC represented as ΔABC = 1 1 4 1 1 4 Translation equation of triangle is ΔA’B’C’ = ΔABC + [tx ty] ΔA’B’C’ = 1 1 4 1 1 4 + [3 2] = 4 3 7 3 4 6 X0 Y
  • 6. Mechanical Engineering Department – School Of Engineering ROTATION 6 X Y P(x,y) P’(x’,y’) r r x=r cosф y=rsinф X’=r cos(Ɵ+ф) y’=rsin(Ɵ+ф) ф Ɵ Point P is represented as P = [x y] = [r cos ф r sin ф] The rotated point be represented as : P’ = [r cos(Ɵ+ф) r sin(Ɵ+ф)] = [r (cos Ɵcos ф – sinƟ sin ф) r (sin Ɵ cos ф + cos Ɵ sin ф ) = [(x cos Ɵ – y sin Ɵ) (x sin Ɵ + y cos Ɵ) This can be expressed as : P’ = [x y] cos Ɵ sin Ɵ − Ɵ cos Ɵ = = P × [R] where R is rotation matrix R = cos Ɵ sin Ɵ − Ɵ cos Ɵ If rotation is anticlockwise then Ɵ is +VE If rotation is clockwise then Ɵ is -VE
  • 7. Mechanical Engineering Department – School Of Engineering SCALING 7 B’(4,2) A(1,1) C(1,2) A’(2,2) B(2,1) C’(2,4) X0 Y Scaling transformation alters the size of the object. Scaling can be uniform(in X and Y direction) or non- uniform (either in x direction or in Y direction. Scaling in X = Sx Scaling in Y = Sy Example: A uniform scaling factor Sx = Sy = 2 ΔA’B’C’ = ΔABC · S ΔA’B’C’ = 1 1 2 1 1 2 · 0 0 = 2 2 4 2 2 4
  • 8. Mechanical Engineering Department – School Of Engineering REFLECTION (MIRROR) 8 Reflection transformation equation. P’ = P · M Where M is a reflection matrix X Y 1 2 3 1’2’ 3’ (a) Reflection about Y axis M = −1 0 0 1 1 2 3 1’ 2’ 3’ (b) Reflection about X axis M = 1 0 0 −1 1 2 3 1’ 2’ 3’ (c) Reflection about y = x axis M = 0 1 1 0 Reflection is the process of obtaining a mirror of the original shape
  • 9. Mechanical Engineering Department – School Of Engineering REFLECTION (MIRROR) 9 Reflection is the process of obtaining a mirror of the original shape Reflection transformation equation. P’ = P · M Where M is a reflection matrix X Y (d) Reflection about y = -x M = 0 −1 −1 0 (e) Reflection about x and y axis M = −1 0 0 −1 X Y 1 2 3 1’ 2’3’ 1 2 3 1’2’ 3’ 1’’2’’ 3’’
  • 10. Mechanical Engineering Department – School Of Engineering SHEAR 10 This transformation causes the image to slant. The y shear preserves all the x coordinate values but shifts the y values. The x shear preserves all the y coordinate values but shifts the x values. P’ = P · SH SH = 1 0 1 for y shear SH = 1 0 1 for x shear X Y A B CD A’ B’ C’D’
  • 11. Mechanical Engineering Department – School Of Engineering HOMOGENEOUS COORDINATES 11 P (x, y) which can be expressed as P (x’ y’ h) Where x = x’/h and y = y’/h Where h is non zero number. A convenient value for h = 1. So in homogeneous coordinate system point P is expressed as P (x, y, 1) The general transformation matrix is also modified to a 3 × 3 matrix expressed in the form : 0 0 1
  • 12. Mechanical Engineering Department – School Of Engineering e). Shear : HOMOGENEOUS COORDINATES 12 The important matrix transformations in the homogeneous coordinate system will now be modified as under. T = 1 0 0 0 1 0 1 a). Translation : b). Rotation : R = Ɵ sin Ɵ 0 − sin Ɵ cos Ɵ 0 0 0 1 c). Scaling : S = 0 0 0 0 0 0 1 d). Reflection / Mirror : M = 0 0 0 0 1 For y shear, SHy = 1 0 0 1 0 0 0 1 For x shear, SHx = 1 0 0 1 0 0 0 1
  • 13. Mechanical Engineering Department – School Of Engineering INVERSE TRANSLATIONS 13 T = 0 0 1 Find out the inverse matrix of T inv 0 0 1 = − 0 − 0 − − − inv 1 0 0 0 1 0 1 = 1 0 0 0 1 0 − − 1 Inverse Transformation for Translation: Inverse Transformation for Rotation: inv cos Ɵ sin Ɵ 0 − sin Ɵ cos Ɵ 0 0 0 1 = cos Ɵ − sin Ɵ 0 sin Ɵ cos Ɵ 0 0 0 1 = cos(− Ɵ) sin(−Ɵ) 0 −sin(−Ɵ) cos(− Ɵ) 0 0 0 1 Inverse Transformation for Scaling: inv 0 0 0 0 0 0 1 = 1/ 0 0 0 1/ 0 0 0 1
  • 14. Mechanical Engineering Department – School Of Engineering CONCATENATION OR COMPOSITE TRANSFORMATION 14 With homogeneous coordinates, composite transformations (more than one) can be done by calculating the matrix product for all individual transformations. First let us consider some properties of matrices. 1. As general rule, matrix multiplication is not commutative. A·B ≠ B · A 2. Matrix multiplication is associative. For any three matrices, A, B and C, A · B · C = (A · B) · C = A · (B · C)
  • 15. Mechanical Engineering Department – School Of Engineering ROTATION ABOUT ANY POINT 15 1 1’ 2 2’ 3 3’ (a) Rotation about Origin + (a) Rotation about any given point
  • 16. Mechanical Engineering Department – School Of Engineering ROTATION ABOUT ANY POINT 16 + P (x, y) x Y a) Original shape + + b) Translate to Origin + + c) Rotation about Origin + d) Translate back to Original Point P’ = P · T · R · (inv T)
  • 17. Mechanical Engineering Department – School Of Engineering SCALING ABOUT ANY POINT 17 + P(X, Y) X Y a) Original shape + b) Translation to Origin + + + c) Scaling about Origin + d) Translate back to Original Point P’ = P · T · S · (inv T)
  • 18. Mechanical Engineering Department – School Of Engineering REFLECTION ABOUT ANY AXIS y = mx + c 18 a) Original Shape b) Translation to Origin c) Rotation d) Reflection e) Inverse Rotation f) Inverse Translation Original Image Mirror Image P’ = P · T · R · M · [inv R] · [inv T]
  • 19. Mechanical Engineering Department – School Of Engineering Example 19 Ex 1. A rectangle is formed by four points ABCD whose coordinates are: A (50, 50), B(100, 50), C(100, 80) and D(50,80). Calculate the new coordinates of the rectangle in reduced size using the scaling factors Sx = 0.5 and Sy = 0.6 Ans. = 25 30 1 50 30 1 50 25 48 48 1 1
  • 20. Mechanical Engineering Department – School Of Engineering Example 20 Ex 2. Write a 3 × 3 transformation matrix for the following effects: a). Scale the image to be twice as large and then translate it 1 unit to the left. b). Scale X direction to be half as large and then rotate anticlockwise by 90° about the origin c). Rotate anticlockwise about origin by 90° and then scale the X direction by half as large. d). Translate down 0.5 unit, right 0.5 unit, and then rotate anticlockwise by 45°. Ans. = a) G = S · T = 2 0 0 0 2 0 −1 0 1 Ans. = b) G = S · R = 0 0.5 0 −1 0 0 0 0 1 Ans. = c) G = R · S = 0 1 0 −0.5 0 0 0 0 1 Ans. = d) G = T · R = 0.707 0.707 0 −0.707 0.707 0 0.707 0 1
  • 21. Mechanical Engineering Department – School Of Engineering Example 21 Ex. 3 A triangle ABC has its Vertices at A(0, 0), B(4, 0), and C(2, 3). It is to be translated by 4 units in X direction, and 2 units in Y direction, then it is to be rotated in anticlockwise direction about the new position of point C through 90°. Find the new position of the triangle Ans. ΔA’B’C’ = ΔABC · T = 4 2 1 8 2 1 6 5 1 ΔA’’B’’C’’ = ΔA’B’C’ · T · R · (inv T) = 9 3 1 9 7 1 6 5 1
  • 22. Mechanical Engineering Department – School Of Engineering Example 22 Ex. 4 Triangle PQR has vertices as P(2, 4), Q(4, 6) and R(2, 6). It is Desired to reflect through an arbitrary line L whose equation is y = 0.5 X + 2. Calculate the new vertices of triangle and show the results graphically. ΔPQR = 2 4 1 4 6 1 2 6 1 Reflection about y = 0.5 X +2 ty = -2, m = slope =tan Ɵ Ɵ = 26.565° ΔP’Q’R’ = ΔPQR · T · R · M · (inv R) · (inv T) ANS = 2.8 2.4 1 5.6 2.8 1 4.4 1.2 1
  • 23. Mechanical Engineering Department – School Of Engineering THREE DIMENSIONAL TRANSFORMATIONS 23 X Z Y a). Translation : [x’ y’ z’ 1] = [x y z 1] · 1 0 0 0 0 1 0 0 0 0 1 0 1 b). Rotation : Rz = Ɵ Ɵ 0 0 − Ɵ Ɵ 0 0 0 0 1 0 0 0 0 1 i). Rotation about Z axis: ii). Rotation about X axis : Rx = 1 0 0 0 0 Ɵ Ɵ 0 0 − Ɵ Ɵ 0 0 0 0 1 ii). Rotation about Y axis : Ry = Ɵ 0 − Ɵ 0 0 1 0 0 Ɵ 0 Ɵ 0 0 0 0 1
  • 24. Mechanical Engineering Department – School Of Engineering THREE DIMENSIONAL TRANSFORMATIONS 24 c). Scaling : S = 0 0 0 0 0 0 0 0 0 0 0 0 1 d). Reflection : Mxy = 1 0 0 0 0 1 0 0 0 0 −1 0 0 0 0 1 i). Reflection about XY plane: ii). Reflection about YZ plane : Myz = −1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ii). Reflection about XZ plane : Mxz = 1 0 0 0 0 −1 0 0 0 0 1 0 0 0 0 1 X Y Z
  • 25. Mechanical Engineering Department – School Of Engineering Example 25 Ex 5. State the homogeneous transformation matrices for the following operations. a) Rotation through 120° about origin. b) Translation through 10 and -20 units along the x and y direction respectively. c) Rotation through 30° about origin. Find concatenated matrix if the operations are done in above sequence. Will the order in which the operations are done affect the end result?
  • 26. Mechanical Engineering Department – School Of Engineering Example 26 Ex 6. A triangle ABC having coordinates A (3, 4, -2) and B (-4, 6, 3), C (-6, 4, 3) is to be rotated about X axis by 20° anticlockwise. Determine the new coordinates of the triangle.
  • 27. Mechanical Engineering Department – School Of Engineering Example 27 Ex 7. Given a point P (1, 3, -5), find : a) Transformed point P’ if P is Translated by 2 unit in X 3 unit in Y and -4 unit in Z and then rotated by 30° about the Z axis. b). Same as in (a), but the point P is rotated first and then translated. c). Is the final point P’ the same in both (a) and (b) ? Explain your answer.