Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to...
Transcript of Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to...
![Page 1: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/1.jpg)
CS 148: Summer 2016Introduction of Graphics and ImagingZahid Hossain
Transformation
http://www.pling.org.uk/cs/cgv.html
![Page 2: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/2.jpg)
Fisher etal.(2012)
PlacementofObjects
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 2
![Page 3: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/3.jpg)
Fisher etal.(2012)
PlacementofObjects
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3
Oriented
![Page 4: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/4.jpg)
Fisher etal.(2012)
PlacementsofObjects
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 4
Translated
![Page 5: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/5.jpg)
PointsandVectors
5
p
Originx
y
z
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain
![Page 6: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/6.jpg)
PointsandVectors
6
Originx
y
z
Vector Points
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain
![Page 7: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/7.jpg)
Transformations
• What?Justfunctionsactingonpoints:
• Why?• Viewing:• Convertbetweencoordinatessystems• Virtualcamera,e.g.perspectiveprojections
• Modeling:• Createobjectsinaconvenientorientation• Usemultiple instancesofagivenshape• Kinematics– characters/robots
7
![Page 8: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/8.jpg)
LinearTransformation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 8
![Page 9: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/9.jpg)
LinearTransformation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 9
![Page 10: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/10.jpg)
LinearTransformation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 10
![Page 11: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/11.jpg)
LinearTransformation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 11
Lines Map to Lines
![Page 12: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/12.jpg)
CommonTransformation
12
Rotate Scale Shear
![Page 13: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/13.jpg)
13
![Page 14: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/14.jpg)
ComposingTransformations
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 14
FirstRotate45°
![Page 15: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/15.jpg)
ComposingTransformations
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 15
ThenScale2xalongy
![Page 16: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/16.jpg)
ComposingTransformations
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 16
RotationScale
Orderoftransformations
![Page 17: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/17.jpg)
ComposingTransformation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 17
Rotate->Scale Scale->Rotate
Not Commutative
![Page 18: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/18.jpg)
Translation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 18
![Page 19: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/19.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 19
For any non-zero c
![Page 20: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/20.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 20
![Page 21: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/21.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 21
![Page 22: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/22.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 22
4DHomogenous Coordinate 3DCartesianCoordinate
![Page 23: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/23.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 23
w=1
w-axis
x,y-axis
(x,y,w)
(x/w,y/w,1)
![Page 24: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/24.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 24
z=1
z-axis
x,y-axis
Decreasew
![Page 25: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/25.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 25
z=1
z-axis
x,y-axis
Decreasew
![Page 26: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/26.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 26
![Page 27: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/27.jpg)
HomogenousCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 27
Represents a Vector!(Homogenous Coordinates express both Vectors and Points)
![Page 28: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/28.jpg)
BacktoTranslation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 28
Homogenous CoordinateHomogenous Coordinate
![Page 29: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/29.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 29
(3,4,2):
Convert3DCartesianCoordinatetoHomogenousCoordinate
![Page 30: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/30.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 30
(3,4,2):(3,4,2,1)
Convert3DCartesianCoordinatetoHomogenousCoordinate
![Page 31: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/31.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 31
(3,4,2):(3,4,2,1)
Convert3DCartesianCoordinatetoHomogenousCoordinate
ConvertHomogenousCoordinatetoCartesianCoordinate
(3,4,2,2) :
![Page 32: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/32.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 32
(3,4,2):(3,4,2,1)
Convert3DCartesianCoordinatetoHomogenousCoordinate
ConvertHomogenousCoordinatetoCartesianCoordinate
(3,4,2,2) :(1.5,2,1)
![Page 33: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/33.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 33
Rotateaboutthecenterofthebox
![Page 34: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/34.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 34
Translatetocenter
![Page 35: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/35.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 35
Rotate
![Page 36: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/36.jpg)
SomeExercise
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 36
Translateback
![Page 37: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/37.jpg)
CoordinateSystem
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 37
![Page 38: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/38.jpg)
CoordinateSystem
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 38
![Page 39: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/39.jpg)
CoordinateSystem
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 39
![Page 40: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/40.jpg)
CoordinateSystem:Rotation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 40
![Page 41: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/41.jpg)
CoordinateSystem:Rotation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 41
![Page 42: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/42.jpg)
CoordinateSystem:Rotation
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 42
![Page 43: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/43.jpg)
CoordinateSystem:Hierarchy
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 43
![Page 44: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/44.jpg)
CoordinateSystem:Hierarchy
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 44
![Page 45: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/45.jpg)
CoordinateSystem:Hierarchy
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 45
![Page 46: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/46.jpg)
InterpretingTransformations
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 46
![Page 47: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/47.jpg)
TwoInterpretations
• WithrespecttoGlobalFrame• WithrespecttoLocalFrame
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 47
![Page 48: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/48.jpg)
CoordinateSystem:Hierarchy
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 48
![Page 49: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/49.jpg)
w.r.t GlobalFrame
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 49
Combined=Translate(0,1)Rotate(45°)Translate(1,1)
Translate(1,1) Rotate(45°) Translate(0,1)
OrderofTransforms
![Page 50: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/50.jpg)
w.r.t LocalFrame
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 50
Combined=Translate(0,1)Rotate(45°)Translate(1,1)
Translate(0,1) Rotate(45°) Translate(1,1)
OrderofTransform
![Page 51: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/51.jpg)
w.r.t LocalFrame
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 51
Combined=Translate(0,1)Rotate(45°)Translate(1,1)
Translate(0,1) Rotate(45°) Translate(1,1)
OrderofTransform
Both interpretations are equivalent
![Page 52: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/52.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 52
translate(0,4)drawTorso()pushMatrix()
translate(1.5,0)rotateX(leftHipRotate)drawThigh()pushMatrix()
translate(0,-2)rotateX(leftKneeRotate)drawLeg()...
popMatrix()popMatrix()pushMatrix()
translate(-1.5,0)rotateX(rightHipRotate)// Draw the right side...
...x
y
CurrentMatrix =Translate(0,4)
MatrixStack
![Page 53: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/53.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 53
translate(0,4)drawTorso()pushMatrix()
translate(1.5,0)rotateX(leftHipRotate)drawThigh()pushMatrix()
translate(0,-2)rotateX(leftKneeRotate)drawLeg()...
popMatrix()popMatrix()pushMatrix()
translate(-1.5,0)rotateX(rightHipRotate)// Draw the right side...
...x
y
CurrentMatrix =Translate(0,4)
MatrixStack
Translate(0,4)
![Page 54: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/54.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 54
translate(0,4)drawTorso()pushMatrix()
translate(1.5,0)rotateX(leftHipRotate)drawThigh()pushMatrix()
translate(0,-2)rotateX(leftKneeRotate)drawLeg()...
popMatrix()popMatrix()pushMatrix()
translate(-1.5,0)rotateX(rightHipRotate)// Draw the right side...
...x
y
CurrentMatrix =translate(0,4)translate(1.5,0)rotateX(leftHipRotate)translate(0,-2)rotate(leftKneeRotate)
MatrixStack
translate(0,4)translate(0,4)translate(1.5,0)rotateX(leftHipRotate)
![Page 55: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/55.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 55
translate(0,4)drawTorso()pushMatrix()
translate(1.5,0)rotateX(leftHipRotate)drawThigh()pushMatrix()
translate(0,-2)rotateX(leftKneeRotate)drawLeg()...
popMatrix()popMatrix()pushMatrix()
translate(-1.5,0)rotateX(rightHipRotate)// Draw the right side...
...x
y
CurrentMatrix =translate(0,4)translate(1.5,0)rotateX(leftHipRotate)
MatrixStack
translate(0,4)
![Page 56: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/56.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 56
translate(0,4)drawTorso()pushMatrix()
translate(1.5,0)rotateX(leftHipRotate)drawThigh()pushMatrix()
translate(0,-2)rotateX(leftKneeRotate)drawLeg()...
popMatrix()popMatrix()pushMatrix()
translate(-1.5,0)rotateX(rightHipRotate)// Draw the right side...
...x
y
CurrentMatrix =translate(0,4)
MatrixStack
![Page 57: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/57.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 57
translate(0,4)drawTorso()pushMatrix()
translate(1.5,0)rotateX(leftHipRotate)drawThigh()pushMatrix()
translate(0,-2)rotateX(leftKneeRotate)drawLeg()...
popMatrix()popMatrix()pushMatrix()
translate(-1.5,0)rotateX(rightHipRotate)// Draw the right side...
...x
y
CurrentMatrix =translate(0,4)translate(-1.5,0)rotateX(rightHipRotate)
MatrixStack
translate(0,4)
![Page 58: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/58.jpg)
HierarchicalModeling
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 58
x
y
Torso
RightThigh
RightLeg
translate(0,4)
translate(1.5,0)rotateX(rightHipRotate)
translate(0,-2)rotateX(rightLegRotate)popM
atrix()LeftSide
pushMatrix()
pushMatrix()
pushMatrix()
![Page 59: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/59.jpg)
CameraandProjectionMatrices
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 59
![Page 60: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/60.jpg)
3Dto2DConversion
• Theworldisin3D• ButourScreenisin2D• Imagineourscreenisacameralookingoutintotheworld.• Tasks
1. Convert3DworldcoordinatestoCameraCoordinates2. ProjecttheCameraCoordinateon2Dscreen
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 60
![Page 61: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/61.jpg)
CameraMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 61
![Page 62: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/62.jpg)
CameraMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 62
Homework!
![Page 63: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/63.jpg)
ProjectionMatrix(Basic)
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 63
![Page 64: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/64.jpg)
ProjectionMatrix(Basic)
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 64
![Page 65: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/65.jpg)
NormalizedDeviceCoordinates
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 65
http://www.songho.ca/opengl/gl_projectionmatrix.html
NDC(NormalizedDeviceCoordinate)
![Page 66: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/66.jpg)
OpenGLProjectionMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 66
Note the –n and –f (to be consistent with OpenGL)
![Page 67: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/67.jpg)
OpenGLProjectionMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 67
![Page 68: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/68.jpg)
OpenGLProjectionMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 68
Similarly for y
![Page 69: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/69.jpg)
OpenGLProjectionMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 69
z’ is a little tricky
SolvingforAandB
![Page 70: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/70.jpg)
OpenGLProjectionMatrix
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 70
![Page 71: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/71.jpg)
Non-LinearityinZ
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 71
-8 -6 -4 -2
-1.0
-0.5
0.5
1.0
1. Monotonic:valueskeepsincreasingaszgoesin–vedirection2. Resolutiondecreasesaszdecrease(along–ve)ordepthincreases
![Page 72: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/72.jpg)
Non-LinearityinZ
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 72
-8 -6 -4 -2
-1.0
-0.5
0.5
1.0
1. Monotonic:valueskeepsincreasingaszgoesin–vedirection2. Resolutiondecreasesaszdecrease(along–ve)ordepthincreases
For Later:Has interesting effects in Depth Buffering
![Page 73: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/73.jpg)
StartLearningOpenGLNow
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 73
![Page 74: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/74.jpg)
StartLearningOpenGLNow
CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 74
Suggestions OnlyFor OpenGL 3.3: http://learnopengl.com
For OpenGL < 2.0: Any GLUT or FreeGLUT tutorial
![Page 75: Transformation - GitHub Pages · Fisher et al. (2012) Placement of Objects CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain 3 Oriented](https://reader033.fdocuments.in/reader033/viewer/2022042113/5e8fc92ca2894628734abd16/html5/thumbnails/75.jpg)
CS 148: Summer 2016Introduction of Graphics and ImagingZahid Hossain
Transformation
http://www.pling.org.uk/cs/cgv.html