Download presentation
Presentation is loading. Please wait.
Published byRidwan Santoso Modified over 5 years ago
1
CS1550 Fundamentals For Computer Graphics Transformations-2
Sumanth Shankar California State University, Los Angeles
2
Homogeneous Coordinates
Homogeneous coordinates define a point in a plane using three coordinates instead of two. For a point P with coordinates (X, Y) there exists homogeneous point (x, y, t) such that X = x/t and Y = y/t. For example the point(3, 4) has homogeneous coordinates (6, 8, 2).
3
2D Translation The matrix notation for 2D translation is 𝑥′ 𝑦′ 1 = 1 0 𝑡𝑥 0 1 𝑡𝑦 * 𝑥 𝑦 1 x’ = x + tx y’ = y + ty
4
2D Scaling The matrix notation for 2D scaling is
𝑥′ 𝑦′ 1 = 𝑠𝑥 𝑠𝑦 * 𝑥 𝑦 1 Scaling is relative to the origin. It means the point (0, 0) remains (0, 0) all other points move away from the origin
5
2D Scaling To scale relative to another point (px, py) we first subtract (px, py) from (x, y) and add (px, py) back to (x, y). x’ = sx(x – px) + px y’ = sy(y – py) + py x’ = sx x + px(1 – sx) y’ = sy y + py(1 – sy)
6
2D Scaling In matrix form it is represented using
𝑥′ 𝑦′ 1 = 𝑠𝑥 0 𝑝𝑥(1 −𝑠𝑥) 0 𝑠𝑦 𝑝𝑦(1 −𝑠𝑦) * 𝑥 𝑦 1
7
2D Reflections To make reflection about the vertical axis when x = 1, we subtract 1 from the x coordinate, then we reverse the sign of the modified x coordinate and finally we add 1 to the x coordinate. x1 = x – 1 x2 = -(x – 1) x’ = -(x – 1) + 1 y’ = y
8
2D Reflections In general when for ax the following transformation is required. x’ = -(x – ax) + ax = -x + 2ax y’ = y In matrix form 𝑥′ 𝑦′ 1 = −1 0 2𝑎𝑥 * 𝑥 𝑦 1
9
2D Reflections Similarly when for ay the following transformation is required. x’ = x y’ = -(y – ay) + ay = -y + 2ay In matrix form 𝑥′ 𝑦′ 1 = −1 2𝑎𝑦 * 𝑥 𝑦 1
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.