0% found this document useful (0 votes)
58 views12 pages

Transform 04

This document discusses various geometric transformations used in computer graphics including translation, rotation, scaling, reflection, shear, and their representation using homogeneous coordinates. It explains how transformations can be combined into a single composite transformation matrix and how raster operations allow transforming pixel values directly in the frame buffer for translation, rotation and scaling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views12 pages

Transform 04

This document discusses various geometric transformations used in computer graphics including translation, rotation, scaling, reflection, shear, and their representation using homogeneous coordinates. It explains how transformations can be combined into a single composite transformation matrix and how raster operations allow transforming pixel values directly in the frame buffer for translation, rotation and scaling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

GeometricTransformations

EricC.McCreath
SchoolofComputerScience
TheAustralianNationalUniversity
ACT0200Australia
[email protected]

Overview

BasicGeometricTransformation

HomogeneousCoordinates

RasterTransformations

Graphics2DAffineTransformDemo

Transformations

Transformationsareusefulformodellingandviewingascene.

Modellingtransformationsareusedtoconstructascene.

Geometrictransformationsareusedformovingobjectswithinthe
sceneandcontrolingtheviewingofthoseobjects.

Suchtransformationsareusefulandpowerfultoolsforcomputer
graphicsapplications,however,attimestheycanbetrickytoget
workingproperly.

Translation

Translationprovidesasimplewayofrepositioningobjects.
Newpoint

Originalpoint

[]

P n= P o t x
ty

[]
tx
ty

Rotation

Rotationabouttheorigin.
P n=

cos sin
P
sin cos o

x
Note,forsmallthetaonecanuse:

sin
cos 1

Rotation

RotationaboutapointPr.

P n= P r

cos sin
P o P r
sin cos
y

Pr
x

Scaling

Scalingfromtheorigin.Ifscalingvaluesarethesamethenitis
calleduniformscaling.
P n=

[ ]
sx
0

0
Po
sy

Scalingfromafixedpoint.

[ ][ ] [ ]
[ ] [ ]

s
P n= x f x
0
yf
P n=

sx
0

0
P o x f
sy
yf

0
P o x f 1s x
sy
y f 1 s y

x
Noticehowallthesetransformations(translation,
rotation,andscaling)areoftheform:

P n= M 1 P o M 2

HomogeneousCoordinates

Byexpandingtoa3x3matrixwecancombineallthese
transformationsintoasinglematrixmultiplication.
TheCartesianpoint(x,y)isrepresentedbythehomogeneous
coordinate(hx,hy,h),wherehisnonezero.Oftenhissetto1so
(x,y)isrepresentedby(x,y,1).
Alsothehomogeneouscoordinate(a,b,c)representstheCartesian
point(a/c,b/c).AsinglepointinCartesianspaceisrepresentedby
alineinhomogeneousspace.
Allofthetransformationswehavelookedatcanberepresentedbya
singlematrix:
Translation

[ ]

1 0 tx
T t x , t y = 0 1 t y
0 0 1

Scaling

Rotation

cos sin 0
R= sin cos 0
0
0
1

[ ]

sx
S s x , s y = 0
0

0 0
sy 0
0 1

CompositeTransformations

Asequenceoftransformationscanbecombinedintoasingle
compositetransformationmatrix.

Supposewewishtoconductthesequence:T(5,4),R(0.4),T(5,4)
oftransformationsonapointPo.Wecouldcalculate:
P n =T 5,4 R 0.4T 5,4 P o

thisisthesameas:
P n =T 5,4R 0.4T 5,4 P o

Compositetransformationscombineasexpected:

T a , bT c , d =T ac , bd

R R= R
S a , b S c , d =S ac , bd
Orderisgenerallyimportantfor
matrixmultiplication!

Reflection

[ ]
[ ]

Reflectionaboutthexaxis:

Reflectionabouttheyaxis: 1 0 0

1 0 0
0 1 0
0 0 1

0
0

10

1 0
0 1

Reflectionaboutboth(sameasrotationby180):

Howwouldyoureflectaboutanarbitraryaxis??

1 0 0
0 1 0
0
0 1

Shear

11

Ashearwilldistorttheshapeofanobject.
y
Thisisshearalongthexaxis:

1 sh x 0
0 1 0
0 0 1

]
x

RasterOperations

Geometrictransformationscantakeplacedirectlyintheframebuffer.
Thesecanbedoneefficientlybymanipulatingthearrayofpixel
values.
2Dblocktranslationcanbedonebycopyingblocksofmemory(bitblt,
blocktransfer).
Rotationofa2Dblockby90,180,270canbedonebycopying
pixels.
Rotationbyotheranglescanbedonebysamplingpixelcolours.
Scalingcanbealsodoneasarasteroperation,thismayalsorequire
samplingpixelcolours.

12

You might also like