Graphics 2 D Geometric Transformations http kucg korea

  • Slides: 30
Download presentation
Graphics 2 D Geometric Transformations 고려대학교 컴퓨터 그래픽스 연구실 http: //kucg. korea. ac. kr

Graphics 2 D Geometric Transformations 고려대학교 컴퓨터 그래픽스 연구실 http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Contents n Geometric Transformation n Basic 2 D Transformations o n KUCG Translation, Scaling,

Contents n Geometric Transformation n Basic 2 D Transformations o n KUCG Translation, Scaling, and Rotation Matrix Representation Homogeneous Coordinates n Matrix Composition n n Composite Transformations Pivot-Point Rotation n General Fixed-Point Scaling n Reflection and Shearing n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Geometric Transformation n KUCG Definition Alter the coordinate descriptions of objects n Translation, rotation,

Geometric Transformation n KUCG Definition Alter the coordinate descriptions of objects n Translation, rotation, scaling, etc. n n Motivation Why do we need geometric transformations in CG? As a viewing aid n As a modeling tool n As an image manipulation tool n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Example: 2 D Geometric Transformation KUCG Modeling Coordinates A Goal: change A to B

Example: 2 D Geometric Transformation KUCG Modeling Coordinates A Goal: change A to B B World Coordinates http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Example: 2 D Geometric Transformation KUCG Modeling Coordinates World Coordinates http: //kucg. korea. ac.

Example: 2 D Geometric Transformation KUCG Modeling Coordinates World Coordinates http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Example: 2 D Scaling KUCG Modeling Coordinates Scale(0. 3, 0. 3) World Coordinates http:

Example: 2 D Scaling KUCG Modeling Coordinates Scale(0. 3, 0. 3) World Coordinates http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Example: 2 D Rotation KUCG Modeling Coordinates Scale(0. 3, 0. 3) Rotate(-90) World Coordinates

Example: 2 D Rotation KUCG Modeling Coordinates Scale(0. 3, 0. 3) Rotate(-90) World Coordinates http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Example: 2 D Translation KUCG Modeling Coordinates Scale(0. 3, 0. 3) Rotate(-90) Translate(0, 3)

Example: 2 D Translation KUCG Modeling Coordinates Scale(0. 3, 0. 3) Rotate(-90) Translate(0, 3) World Coordinates http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation Transformations

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation Transformations can be combined n n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n

Basic 2 D Transformations n KUCG Translation n Scaling n n n Rotation n n http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Matrix Representation n 2 D transformation by a matrix n Apply the transformation to

Matrix Representation n 2 D transformation by a matrix n Apply the transformation to a point Transformation Matrix http: //kucg. korea. ac. kr KUCG Point Graphics Lab @ Korea University

Matrix Representation n KUCG Transformations can be combined by matrix multiplication Combination of the

Matrix Representation n KUCG Transformations can be combined by matrix multiplication Combination of the Transformation Matrices are a convenient and efficient way to represent a sequence of transformations http: //kucg. korea. ac. kr Graphics Lab @ Korea University

2× 2 Matrices n KUCG What types of transformations can be represented with a

2× 2 Matrices n KUCG What types of transformations can be represented with a 2× 2 matrix? 2 D Identity 2 D Scaling http: //kucg. korea. ac. kr Graphics Lab @ Korea University

2× 2 Matrices n KUCG What types of transformations can be represented with a

2× 2 Matrices n KUCG What types of transformations can be represented with a 2× 2 matrix? 2 D Rotation http: //kucg. korea. ac. kr Graphics Lab @ Korea University

2× 2 Matrices n KUCG What types of transformations can be represented with a

2× 2 Matrices n KUCG What types of transformations can be represented with a 2× 2 matrix? 2 D Mirror over Y axis 2 D Mirror over Origin(0, 0) http: //kucg. korea. ac. kr Graphics Lab @ Korea University

2× 2 Matrices n KUCG What types of transformations can be represented with a

2× 2 Matrices n KUCG What types of transformations can be represented with a 2× 2 matrix? 2 D Translation Impossible!! Only 2 D linear transformations can be represented with 2 x 2 matrices http: //kucg. korea. ac. kr Graphics Lab @ Korea University

2 D Translation n KUCG 2 D translation can be represented by a 3×

2 D Translation n KUCG 2 D translation can be represented by a 3× 3 matrix n Homogeneous coordinates http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Basic 2 D Transformations n KUCG Basic 2 D transformations as 3 x 3

Basic 2 D Transformations n KUCG Basic 2 D transformations as 3 x 3 matrices Translation Scaling Rotation http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Homogeneous Coordinates n KUCG Add a 3 rd coordinate to every 2 D point

Homogeneous Coordinates n KUCG Add a 3 rd coordinate to every 2 D point (x, y, w) represents a point at location (x/w, y/w) n (x, y, 0) represents a point at infinity n (0, 0, 0) is not allowed n y 2 (2, 1, 1) or (4, 2, 2) or (6, 3, 3) 1 1 2 x Convenient coordinate system to represent many useful transformations http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Matrix Composition n Combined transformations n n KUCG By matrix multiplication Efficiency with pre-multiplication

Matrix Composition n Combined transformations n n KUCG By matrix multiplication Efficiency with pre-multiplication n Matrix multiplication is associative http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Pivot-Point Rotation (xr, yr) Translation http: //kucg. korea. ac. kr (xr, yr) Rotation KUCG

Pivot-Point Rotation (xr, yr) Translation http: //kucg. korea. ac. kr (xr, yr) Rotation KUCG (xr, yr) Translation Graphics Lab @ Korea University

General Fixed-Point Scaling (xr, yr) Translation http: //kucg. korea. ac. kr (xr, yr) Scaling

General Fixed-Point Scaling (xr, yr) Translation http: //kucg. korea. ac. kr (xr, yr) Scaling (xr, yr) KUCG (xr, yr) Translation Graphics Lab @ Korea University

Matrix Composition n KUCG Rotate by around arbitrary point (a, b) n Transformation Order

Matrix Composition n KUCG Rotate by around arbitrary point (a, b) n Transformation Order n (a, b) Scale by (sx, sy) around arbitrary point (a, b) n Transformation Order http: //kucg. korea. ac. kr (a, b) Graphics Lab @ Korea University

Reflection n KUCG Reflection with respect to an axis X Axis y Y Axis

Reflection n KUCG Reflection with respect to an axis X Axis y Y Axis 1 1 2 3 2’ 3’ 1’ http: //kucg. korea. ac. kr 2 x y 3 Origin y 1’ 3’ 2’ x 1’ 3’ 3 1 2’ x 2 Graphics Lab @ Korea University

Reflection n KUCG Reflection with respect to a line y=x y x n Clockwise

Reflection n KUCG Reflection with respect to a line y=x y x n Clockwise rotation of 45º Reflection about the x axis Counterclockwise rotation of 45º y y x y 1 2 3 2’ 3’ x x 1’ http: //kucg. korea. ac. kr Graphics Lab @ Korea University

Shear n KUCG Parallelogram conversion n x-direction: y n (0, 1) (1, 1) (0,

Shear n KUCG Parallelogram conversion n x-direction: y n (0, 1) (1, 1) (0, 0) (1, 0) x hx= 2 y (0, 0) (2, 1) (3, 1) (1, 0) x y-direction: (1, 3) y http: //kucg. korea. ac. kr (0, 1) (1, 1) (0, 0) (1, 0) x hy= 2 y (1, 2) (0, 1) (0, 0) x Graphics Lab @ Korea University

Shear n KUCG A shifted parallelogram n x-direction shears relative to a reference line

Shear n KUCG A shifted parallelogram n x-direction shears relative to a reference line y (0, 1) x (0, 0) yref= – 1 n hx= 0. 5 (1, 1) yref= -1 (1, 0) : y (1, 1) (0. 5, 0) yref= – 1 y-direction shears relative to a reference line y (0, 1) (0, 0) xref= – 1 http: //kucg. korea. ac. kr y hy= 0. 5 (1, 1) xref= -1 (0, 1. 5) (0, 0. 5) (1, 0) x xref= – 1 (2, 1) x (1. 5, 0) : (1, 2) (1, 1) x Graphics Lab @ Korea University