Geometrical Transformations 2D Geometrical Transformations: Translation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Geometrical Transformations

2D Geometrical Transformations

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

2D Geometric Transformations Translation


Translation x=x+tx
y
Rotation y=y+ty
Scaling (x,y)

Shear x ' x t x
y ' = y + t
Homogenous Coordinates y
Matrix Representations (x,y)

Composite Transformations x

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Rotation Scaling
x=x cos - y sin x=Sx x
y y
y=x sin + y cos y=Sy y
(x,y)

x ' cos sin x (x,y) x' S x 0 x


y ' = sin cos y y ' = 0 S y
(x,y) y
(x,y)

x x

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

1
Shear Homogenous Coordinates
x=x + hx y Each position (x, y) is represented as (x, y, 1).
y=y
All transformations can be represented as matrix
multiplication.
x ' 1 hx x
y ' = 0 1 y Composite transformation becomes easier.

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Translation Rotation
in Homogenous Coordinates in Homogenous Coordinates
x=x+tx x=x cos - y sin
y y
y=y+ty y=x sin + y cos
P = (x,y)
x ' 1 0 t x x x ' cos sin 0 x P = (x,y)
y ' = 0 1 t y y ' = sin cos 0 y
y P = (x,y)
1 0 0 1 1 P = (x,y) 1 0 0 1 1

x x
P = T(tx , ty) P P = R( ) P
CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Scaling Shear
in Homogenous Coordinates in Homogenous Coordinates
x=sx x x=x + hx y
y
y=sy y y=y
(x,y)

x ' s x 0 0 x x ' 1 hx 0 x
y ' = 0 s 0 y y ' = 0
y 1 0 y

1 0 0 1 1 (x,y)
1 0 0 1 1
x
P = S(sx , sy) P P = SHx P
CSC5870 Computer Graphics I CSC5870 Computer Graphics I

2
2D Geometric Transformations 2D Geometric Transformations
Translation Translation
Rotation Rotation
Scaling Scaling
Shear Shear
Homogenous Coordinates Homogenous Coordinates
Composite Transformations Composite Transformations
Rotation about a fixed point

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Rotation About a Fixed Point Rotation About a Fixed Point

1. Translate the object to the origin.


2. Rotate around the origin.
(xr ,yr) (xr ,yr)
3. Translate the object back.

1. Translate the object to the origin

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Rotation About a Fixed Point Rotation About a Fixed Point

(xr ,yr)

2. Rotate about origin 3. Translate the object back

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

3
Rotation About a Fixed Point
1. Translate the object to the origin.
2. Rotate around the origin.
(xr ,yr)
3. Translate the object back.

1 0 xr cos sin 0 1 0 xr
3D Geometrical Transformations
0 1 y sin cos 0 0 1 y r
r
0 0 1 0 0 1 0 0 1
T(xr , yr) R( ) T(-xr , -yr)
P = T(xr , yr) R( ) T(-xr , -yr) P
CSC5870 Computer Graphics I CSC5870Computer
CS8610 ComputerGraphics
GraphicsII I University of Missouri at Columbia

3D Geometric Transformations Translation


Basic 3D Transformations y
Translation x ' 1 0 0 tx x
y ' 0 1 0 ty y
Rotation = (x,y,z)
Scaling z ' 0 0 1 tz z
Shear
1 0 0 0 1 1 (x, y, z)
Composite 3D Transformations x
Change of Coordinate systems P = T P
z

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Rotation about z-axis Rotation about x-axis


x ' cos sin 0 0 x y x ' 1 0 0 0 x y
y ' sin cos 0 0 y y ' 0 cos sin 0 y
= =
z ' 0 0 1 0 z z ' 0 sin cos 0 z

1 0 0 0 1 1 1 0 0 0 1 1
x x
P = Rz() P P = Rx() P
z z

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

4
Rotation about y-axis Rotation About a Fixed Point
x ' cos 0 sin 0 x y 1. Translate the object to the origin.
y ' 0 1 0 0 y 2. Rotate about the three axis, respectively.
=
z ' sin 0 cos 0 z 3. Translate the object back.

1 0 0 0 1 1 P = T (xr , yr, , zr) R T (-xr , -yr, , -zr) P
x
P = Ry() P R = Rx(x) Ry(y) Rz(z)
z

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Scaling Shear
y
x' sx 0 0 0 x x ' 1 0 hx 0 x
y ' 0 s y ' 0 1 hy 0 y
0 0 y
(x,y,z)
= y =
z ' 0 0 sz 0 z z ' 0 0 1 0 z
(x, y, z)
1 0 0 0 1 1 1 0 0 0 1 1
x
P = S P P = SHxy P
z

CSC5870 Computer Graphics I CSC5870 Computer Graphics I

Change in Coordinate Systems


y
y
y y x

x x
x z
z
z P = M P z

M can be a combination of translation,


rotation and scaling.

CSC5870 Computer Graphics I

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy