1 / 30

Transformações Geométricas

Computação Gráfica Rodrigo Toledo. Transformações Geométricas. Índice. Exemplos de Transformações 2D Fórmulas e cálculos das transformações 2D Usando matriz de transformação (por que?) Coordenadas Homogêneas Concatenação de transformações Transformações 3D. Exemplos de Transformações 2D.

neal
Download Presentation

Transformações Geométricas

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computação Gráfica Rodrigo Toledo TransformaçõesGeométricas

  2. Índice • Exemplos de Transformações 2D • Fórmulas e cálculos das transformações 2D • Usando matriz de transformação (por que?) • Coordenadas Homogêneas • Concatenação de transformações • Transformações 3D

  3. Exemplos de Transformações 2D • Translação • Escala • uniforme • não uniforme • Rebatimento por um eixo (espelhamento) • Troca de eixos • Rotação pela origem

  4. -2 -1 3 3 1 2 Translação Translation of a point is simply vector addition y P1 P2 = P1 + P2 -2 -1 = + x

  5. Escala Scaling about the origin is scalar multiplication y 2 2 1 1 = 2 * P2 P1 P2 = P1 * 2 x

  6. Rebatimento por um eixo(espelhamento) x = x y = -y

  7. Troca de Eixos x = y y = x

  8. y x´ P´ = y´ x P = q y x Rotação pela Origem x´ = x.cos q - y.sen q y´ = x.sen q + y.cos q

  9. Por que usar Matriz nas Transformações? • Todas as transformações podem ser efetuadas através da multiplicação de matrizes (usando coordenadas homogêneas). • As transformações podem ser aninhadas e resolvidas de modo a haver apenas uma matriz de multiplicação a ser aplicada. • A característica descrita acima se torna muito importante quando a mesma seqüência de transformações deve ser aplicada para diversos pontos.

  10. x’ a b x é ù é ù é ù ê ú ê ú ê ú = ê ú ê ú ê ú y’ c d y ë û ë û ë û a x b y x’ = + c x d y y’ = + Multiplicação de Matrizes onde:

  11. s 0 x é ù é ù ê ú ê ú S , P M S P = = = ê ú ê ú 0 s y ë û ë û s 0 x s x é ù é ù é ù ê ú ê ú ê ú = ê ú ê ú ê ú 0 s y s y ë û ë û ë û 1 0 x é ù é ù ê ú ê ú I , M s = = ê ú ê ú ê ú ê ú 0 1 y ë û ë û Uniform Scaling , M s I P , =

  12. s 0 x é ù é ù 1 ê ú ê ú P = S = ê ú ê ú ê ú ê ú y ë û 0 s ë û 2 Non-uniform Scaling é s 0 ù é s x ù é x ù ê ú ê ú 1 1 ê ú ê ú = ê ú ê ú ê ú ê ú 0 s ë y û s y ë û ë û 2 2 Note orientation shift in line

  13. x y x y Non-uniform Scaling y Redução (0< sx <1) , Aumento (sy >1) P = x x´ P´ = y´ x´ sx 0 = sy y´ 0

  14. x 1 0 x é ù é ù é ù ê ú ê ú ê ú = ê ú ê ú ê ú ê ú ê ú ê ú y 0 -1 y ë - û ë û ë û Flip an Axis... What does this do to appearance of objects?

  15. y 0 1 x é ù é ù é ù ê ú ê ú ê ú = ê ú ê ú ê ú ê ú ê ú ê ú x 1 0 y ë û ë û ë û Swap Axes

  16. cos ( ) sin ( ) x é q - q ù é ù ê ú ê ú M R P , R , P = = = ê ú ê ú ê ú ê ú sin ( ) cos ( ) y ë q q û ë û cos ( ) x sin ( ) y cos ( ) sin ( ) x é q - q ù é q - q ù é ù ê ú ê ú ê ú = ê ú ê ú ê ú ê ú ê ú ê ú sin ( ) x cos ( ) y sin ( ) cos ( ) y ë q + q û ë q q û ë û Rotate by  

  17. tx tx x ty ty y tx ty x x y y Transformações Geométricas(Translação) y x’ P’ P’ = = + y’ t P = x x´ ? Não pode ser escrito na forma ?  = ? y´ ? x´  1 Ruim para implementação 0 = + 1 y´ 0

  18. x’ 1 0 tx x x’ y’ 0 1 ty y y’ 1 0 0 1 1 Vantagens das coordenadas homogêneas(Translação) w y t x yh w=1 xh P’ = = = [T] Matriz de Translação

  19. wx x xh x D D wy y yh = = y w 1 w w y x 6 3 9 3 yh w=1 D D 4 2 6 = = 2 2 1 3 xh Coordenadas homogêneas y P = = P x x = xh /w w>0 y = yh /w Ex.: =

  20. 2 3 2 2 2 2 2 3 3 3 3 3 2 2 1 1/2 1/4 ? 0 = 3 ? 0 1 2 4 8 12 1.5 3 6 Vantagens das coordenadas homogêneas (pontos no infinito) w H1 w u = y H2 = C2 C3 C1 w=1 x H3 u w=1 yh uh H1 H2 H3 H4 uh xh . . . C1 C2 C3 C4 infinito na direção (2,3)

  21. 3 0 -2 0 1 0 D y y A’ 1 0 0 A D’ 1 1 1 O 2 1 2 x O’ x infinito -1 -1 B’ B C’ C 3 0 -2 2 4 2 3 0 -2 1 1 0 1 0 2 2 1 0 1 0 1 1 1 0 0 1 2 1 1 0 0 1 1 3 0 -2 3 0 -2 0 1 0 0 1 0 1 0 0 1 0 0 Vantagens das coordenadas homogêneas (pontos no infinito, exemplo) J J = = = 1 1 2 4 2 J J -1 -1 -2 -2 -1 = = = 1 1 1 2 1

  22. Efeito de profundidade x x y y

  23. Simplificação da projeção cônica Projeção cônica Projeção ortográfica plano de projeção eye direção de projeção plano de projeção

  24. y a y0 x x0 a Concatenação y y0 x x0 y y x x

  25. y y x x y y x x y y x x Concatenação de Transformações T1 T2 R1 R2 E P’= T2 R2E R1 T1 P

  26. X X2 X3 X1 X2 X P P = = Y1 Y2 Y Y3 Y2 Y Y Y Y X X X P2 = Y Y Y y P3 = y x x X X X Composição com sistema local/móvel P2 = T P1 = R P1= T P e P2 = R P1 P2 = R T P  T’ R T’ = R T R-1 P2 = R T P ou P3= R P e P2 = T’ P3  P2 = R T R-1 R P

  27. m11 m12 m13m14 m21 m22 m23m24 m31 m32 m33 m34 m41 m42 m43m44 x y z 1 y xh yh zh w x = z x’ y’ z’ xh /w yh/w zh/w x y z = = = P’ P Geometria Projetiva e Coordenadas Homogêneas em 3D P’ P

  28. x’ y’ z’ 1 x’ y’ z’ 1 Transformações em 3D(translações e escalas) y 1 0 0 tx x 0 1 0 ty y = x 0 0 1 tz z 0 z 0 0 1 1 sx 0 0 0 x 0 sy 0 0 y = 0 0 sz 0 z 0 0 0 1 1

  29. x’ y y’ z’ 1 x x’ y’ z’ 1 x’ y’ z’ 1 Transformações em 3D(Rotações) 1 0 0 0 x 0 cos qx 0 y -sen qx = 0 sen qx cos qx 0 z qy 0 0 0 1 1 qx 0 x 0 sen qy cos qy qz z 0 1 0 y 0 = -sen qy 0 cos qy 0 z 0 0 0 1 1 0 0 cos qz x -sen qx sen qx 0 y cos qx 0 = 0 0 1 0 z 0 0 0 1 1

  30. x’ y’ y z’ z 1 1 Transformações em 3D(rotação em torno de um eixo qualquer) m11 m12 m13 0 x m21 m22 m23 0 = m31 m32 m33 0 z 0 0 0 1 v = (vx, vy, vz) m11 = vx2 + cosq (1- vx2) m12 = vxvy(1-cosq ) - vz sen q m13 = vzvx(1-cosq ) + vy sen q m21 = vxvy(1-cosq ) + vz sen q m22 = vy2 + cosq (1- vy2) m23 = vyvz(1-cosq ) - vx sen q m31 = vxvz (1-cosq ) - vy sen q m32 = vyvz(1-cosq )+ vx sen q m22 = vz2 + cosq (1- vz2) y x

More Related