Presentation is loading. Please wait.

Presentation is loading. Please wait.

Two-Dimensional Geometric Transformations

Similar presentations


Presentation on theme: "Two-Dimensional Geometric Transformations"— Presentation transcript:

1 Two-Dimensional Geometric Transformations
5

2 Contents Preliminary Basic transformations
Homogeneous coordinate System Composite transformations Reflection and Shearing Transformations between coordinate systems

3 Geometric Transformation
물체의 좌표를 바꾸는 것 Translation, Rotation, Scaling Motivation - Why do we need transformations in computer graphics? As a viewing aid As a modeling tool As an image manipulation tool

4 Translation y P x (a) y P’ x (b)

5 Rotation 회전 : 원호를 따라 이동  회전각이 양수  반시계방향 좌표계의 중심이 회전점인 경우 행렬식
x = r cos  , y = r sin  x’ = r cos ( + ) = r cos  cos  - r sin  sin  y’ = r sin ( + ) = r cos  sin  + r sin  cos   x’= x cos  - y sin , y’ = x sin  + y cos  행렬식 P’ = R P (x,y) r (x’,y’) 죄표중심을 회전점으로 각  만큼 회전

6 Rotation (계속) 임의의 점을 회전점으로 회전하는 경우 
x’ = xr + (x-xr) cos  - (y-yr) sin  y’ = yr + (x-xr) sin  + (y-yr) cos  회전점을 원점으로 이동(translation) 원점 중심 회전(rotation) 회전점 위치 복원(translation) (x,y) r (x’,y’) 점 (xr,yr)을 회전점으로 각  만큼 회전 (xr,yr)

7 정사각형을 sx=2, sy=1로 직사각형으로 변환
Scaling Scaling : 물체의 크기 변환 x’ = x · sx , y’ = y · sy Scaling factor : sx (x축으로 크기 조정), sy (y축으로 크기 조정) 행렬식 P’ = S · P 균일신축(Uniform Scaling) sx = sy 정사각형을 sx=2, sy=1로 직사각형으로 변환

8 Scaling (계속) Scaling factor < 1 고정된 점(xf, yf) 에 대해 비율을 유지하는 신축
크기 줄임과 동시에 물체를 좌표 중심 쪽으로 이동 고정된 점(xf, yf) 에 대해 비율을 유지하는 신축 x’ x P2 (xf, yf) : fixed point x y (xf,yf) P1 P3 x’ = xf + (x-xf) sx , y’ = yf + ( y- yf) sy

9 Homogeneous Coordinates
In basic Transformations, ( Addition ) Only Translation is treated differently ( Multiplication ) ( Multiplication ) How can we represent the composite transformaiton into a single matrix? M

10 Extend the matrix We can solve this problem by extending 2 by2 matrix
into 3 by 3 matrix Translation Rotation Scaling Ex) P2 (xf, yf) : fixed point x y (xf,yf) P1 P3

11 3D Representarion of homogeneous space
Any two dimensional point can be represented by one of the points along the ray in 3D space y x z =3 z =2 z =1 P(3x1,3y1,3) P(2x1,2y1,2) P(x1,y1,1) P(hx1,hy1,h) = P(X,Y, h) 3D Representarion of homogeneous space

12 Point at Infinity The points with h=0 are called points at infinity,
and this will not appear very often. Ex) [ X Y h ] = [ 4 3 1]

13 Point at Infinity(Cont’d)
Ex) The intersection point of two Parallel lines There is no inverse matrix in the matrix… So we choose another alternative formulation

14 Point at Infinity(Cont’d)
The resulting homogeneous coordinates [1 -1 0] represent the ‘point of intersection’ for the two parallel lines, i.e. a point at infinity.

15 Non-Homogeneous treatment !!
Why Homogeneous? B A Two Lines are intersect each other if they are not parallel Non-Homogeneous treatment !!

16 General 2D Transformation Matrix
Rotation Scaling Translation Perspective transformation Where,

17 Composite Transformation
Composite Transformation Matrix

18 Composite Transformation
연속적인 두 번 평행이동 (5-23) P’ = T(tx2, ty2) · {T (tx1, ty1)·P} = {T(tx2, ty2) · T (tx1, ty1)} · P (5-24) (5-25) T(tx2, ty2) · T (tx1, ty1) = T(tx1 + tx2, ty1 + ty2) 연속적인 두 번 회전 (5-26) P’ = R(2) · {R(1) · P} = {R(2) · R(1)} · P (5-27) R(2) ·R(1) = R(2+1) (5-28) P’ = R(2+1) · P

19 Composite Transformation (계속)
연속적인 두 번 신축 (5-29) (5-30) S(sx2, sy2) · S (sx1, sy1) = S(sx1· sx2, sy1 · sy2)

20 Pivot-Point Rotation 고정된 점을 중심으로 회전 1. 중심점을 좌표축의 중심으로 이동
2. 원점을 중심으로 회전 3. 중심점을 원래 위치로 이동 (5-31) (5-32) T(xr, yr) · R() · T (-xr, -yr) = R(xr, yr, ) (xr,yr) (xr,yr) 고정점(xr,yr)을 중심으로 물체 회전

21 General Fixed-Point Scaling
고정점에 대한 신축 1. 중심점을 좌표축의 중심으로 이동 2. 원점을 중심으로 크기 변경 3. 중심점을 원래 위치로 이동 (5-33) (5-34) T(xf, yf) · S(sx, sy) · T (-xf, -yf) = S(xf, yf, sx, sy) (xf,yf) (xf,yf) 고정점(xf,yf)을 중심으로 물체 신축

22 General Scaling Directions
임의의 방향으로 신축 (5-35) y s2 y y (2,2) (1/2,3/2) (0,1) (1,1) (3/2,1/2) x x x (0,0) (1,0) (0,0) s1 x축으로부터 경사진 방향에 신축 적용 정사각형을 평행사변형으로 바꿈

23 Concatenation Property
합성의 성질 일반적인 행렬 (5-36) A· B· C = (A· B) · C = A· ( B· C ) 변환행렬의 교환법칙은 성립하지 않는다. 평행이동후 회전, 회전후 평행이동의 결과

24 Reflection 좌표축에 대한 반사 : 180도 회전
• x축에 대한 반사 • y축에 대한 반사 • xy축(원점)에 대한 반사 (5-48) (5-49) (5-50) y 1 2 3 x 2’ 3’ 1’ x축에 대한 반사 y축에 대한 반사 원점에 대한 반사

25 y=x 축에 대한 반사 (5-51) - 시계방향으로 45도 회전  x축에 반사  반시계 방향으로 45도 회전

26 y=-x 축에 대한 반사 (5-52) - 반시계 방향으로 45도 회전  y축에 반사  시계방향으로 45도 회전

27 Shear x 축으로 밀림 reference line y=yref에 대한 밀림 (5-53)
(5-54) x’ = x + shx · y, y’ = y reference line y=yref에 대한 밀림 (5-55) (5-56) x’ = x + shx · (y-yref), y’ = y x축으로 밀림 (Shx=2) 선분에 대한 밀림 (Shx=1/2, yref=-1)

28 Shear (계속) y축으로 밀림 (선분 x=xref에 대한) (5-57)
(5-58) x’ = x, y’ = shy · (x-xref) + y 선분에 대한 밀림 (Shy=1/2, xref=-1)

29 Transformation between Coordinate Systems
다른 좌표계 간의 이동 예 1. x’y’ 좌표계의 중심 (x0, y0)을 xy좌표계의 중심으로 이동 2. x’축을 x축으로 회전  M(xy,x’y’) = R(-) T(-x0, -y0) xy좌표계와  의 각을 이루고 중심이(x0, y0)인 x’y’ 좌표계 x’y’ 좌표계의 xy좌표계로의 중심 이동

30 Transformation between Coordinate Systems (계속)
x’y’ 좌표계의 축 방향과 같은 방향 벡터 구하기 (5-62) (5-63) u = (vy, -vx) = (ux, uy) (5-64) P0에 대한 V의 방향을 구하는 것이 편리 (5-65) u = R(90) ·v y’축 방향이 벡터 V와 같고 중심이 P0=(x0, y0)인 x’y’ 좌표계 xy좌표계의 두 점 P0, P1에 의해 정의된 x’y’ 좌표계

31 Raster Method for Transformation
Raster system은 frame buffer에 pixel정보 저장 저장된 픽셀 정보의 이동으로 변형을 나타냄 적은 수행 명령(raster op)을 사용하므로 유용 block transfer bitblt : bit-block transfer pixBlt : pixel이 여러 bit으로 이뤄진 경우 래스터 영역의 블록 이동 read, copy, write 래스터 영역 블럭 이동

32 Raster Method for Transformation (계속)
래스터 90°회전(반시계) 1. 각 열을 reverse 2. 행과 열 바꿈 래스터 180°회전 1. 각 열 원소의 순서 바꿈 2. 각 열의 순서 바꿈 90°의 배수가 아닌 경우 회전 1. 목적지에 회전된 영역을 매핑 2. 매핑된 영역의 비율로 intensity 계산 신축 1. 지정된 sx, sy 로 원래 영역을 scale 2. 목적지 pixel에 매핑 3. Scale된 intensity 로 변경 é 1 2 3 ù é 12 11 10 ù ê ú é 3 6 9 12 ù , ê ú ê 4 5 6 ú ê ú 9 8 7 2 5 8 11 ê ú ê ê ú 7 8 9 ú ê 6 5 4 ú ê ú ê ë 1 4 7 10 û ú ê ú ë 10 11 12 û ë 3 2 1 û 래스터 90°, 180°도 회전 임의의 각 래스터 회전 신축된 배열 매핑


Download ppt "Two-Dimensional Geometric Transformations"

Similar presentations


Ads by Google