[OpenGL] 4. Transformations

scarleter99ยท2023๋…„ 4์›” 13์ผ
0

OpenGL

๋ชฉ๋ก ๋ณด๊ธฐ
4/10

๐Ÿ“Œ Transformations

Homogeneous Coordinates

  • n์ฐจ์› ์ขŒํ‘œ๋ฅผ n+1์ฐจ์›์œผ๋กœ ํ‘œํ˜„ํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค.
  • Point๋Š” n+1 ๋ฒˆ์งธ Scalar์— 1๋กœ, Vector๋Š” 0์œผ๋กœ ๋ช…์‹œํ•œ๋‹ค.

Affine Space

  • Vector ์—ฐ์‚ฐ์ž
    • Scalar * Vector = Vector
    • Vector + Vector = Vector
    • Dot_Product(Vector, Vector) = Scalar
    • Cross_Product(Vector, Vector) = Vector
  • Point ์—ฐ์‚ฐ์ž
    • Point - Point = Vector
    • Point + Vector = Point
    • 0 * Point = 0(Zero Vector)

Linear Transformations

Translation

  • ์ขŒํ‘œ๋ฅผ (dx,dy,dz)(d_{x}, d_{y}, d_{z})๋งŒํผ ์ด๋™์‹œํ‚จ๋‹ค.

Rotation

  • ์ขŒํ‘œ๋ฅผ ์›์ ์„ ๊ธฐ์ค€์œผ๋กœ ฮธ\theta๋งŒํผ ํšŒ์ „์‹œํ‚จ๋‹ค.

Scale

  • ์ขŒํ‘œ๋ฅผ ๊ฐ ์ถ• ๋ฐฉํ–ฅ์œผ๋กœ (dx,dy,dz)(d_{x}, d_{y}, d_{z})๋ฐฐ ํ™•๋Œ€/์ถ•์†Œํ•œ๋‹ค.

Composite Transformation

  • ํ•ฉ์„ฑ ๋ณ€ํ™˜ ์‹œ Scale -> Rotation -> Translate ์ˆœ์œผ๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค.
    • xโ€ฒ=T(R(S(p)))x' = T(R(S(p)))
  • ์›์ ์ด ์•„๋‹Œ ์ ์„ ๊ธฐ์ค€์œผ๋กœ Rotation/Scale ํ•  ์‹œ
    (์›์ ์œผ๋กœ Translate) -> Rotation/Scale -> (์›๋ž˜ ์œ„์น˜๋กœ Translate) ์ˆœ์œผ๋กœ ์ง„ํ–‰ํ•œ๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€