![Page 1: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/1.jpg)
C o m p u t a c i ó n G r á f i c a
TRANSFORMACIONES LINEALES I I
![Page 2: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/2.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotaciones Transformación lineal que preserva producto punto entre vectores.
Transforma bases de mano derecha a bases de mano derecha.
En 3D, cada rotación fija un eje de rotación y rota por un ángulo alrededor de ese eje.
Vemos el caso 2D. Consideramo un vector:
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
~v =h
~
b1~
b2
i x
y
�
Suponemos que es una base ortonormal de mano derecha en 2D.
Supongamos que queremos rotar , grados en sentido anti-horario alrededor del origen.
Las coordenadas del vector rotado se pueden calcular:
~bt
~v ✓
⇥x
0y
0 ⇤t
x
0= x cos ✓ � y sin ✓
y
0= x sin ✓ + y cos ✓
![Page 3: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/3.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotaciones: 2D
Que se puede escribir:
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
h~
b1~
b2
i x
y
�)
h~
b1~
b2
i cos ✓ � sin ✓
sin ✓ cos ✓
� x
y
�
También podemos rotar una base:h
~b1 ~b2i)
h~b1 ~b2
i cos ✓ � sin ✓sin ✓ cos ✓
�
![Page 4: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/4.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotaciones: 3D
Usando un sistema coordenado de mano derecha, una rotación de un vector por θ grados alrededor del eje z de la base se expresa:
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
Una rotación de un vector por θ grados alrededor del eje x de la base se expresa:
h~
b1~
b2~
b3
i2
4x
y
z
3
5 )h
~
b1~
b2~
b3
i2
4cos ✓ � sin ✓ 0
sin ✓ cos ✓ 0
0 0 1
3
5
2
4x
y
z
3
5
h~
b1~
b2~
b3
i2
4x
y
z
3
5 )h
~
b1~
b2~
b3
i2
41 0 0
0 cos ✓ � sin ✓
0 sin ✓ cos ✓
3
5
2
4x
y
z
3
5
![Page 5: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/5.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotaciones: 3D
Una rotación de un vector por θ grados alrededor del eje y de la base se expresa:
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
La composición de rotaciones resulta en otra rotación.
Podemos tener una rotación arbitraria aplicando una rotación alrededor del eje-x, seguida de una alrededor del eje-y y luego una alrededor del eje-z.
Las cantidades angulares de las tres rotaciones se conocen como ángulos de Euler xyz. (roll-pitch-yaw)
h~
b1~
b2~
b3
i2
4x
y
z
3
5 )h
~
b1~
b2~
b3
i2
4cos ✓ 0 sin ✓
0 1 0
� sin ✓ 0 cos ✓
3
5
2
4x
y
z
3
5
![Page 6: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/6.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Matrices de rotación R
Matrices cuadradas, con elementos reales.
Matrices ortogonales: RT
= R-1
y det R =1.
Si incluimos aquellas cuyo det R = -1 incluimos también las reflexiones.
El conjunto de las matrices de tamaño n con det R = +1 forman un grupo llamado ortogonal especial SO(n).
En 3D es SO(3).
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
(1) Vectores renglón unitarios
(2) Vectores renglón perpendiculares entre si (producto punto es cero)
(3) Los vectores columna también verifican las propiedades (1) y (2).
ortogonal especial
![Page 7: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/7.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Axis-ang leOtra forma de representar una rotación arbitraria es tomar un vector unitario como eje de rotación y aplicar directamente una rotación de θ radianes alrededor de éste.
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
~k
~k =⇥kx
ky
kz
⇤t
~k =
2
4k2x
v + c kx
ky
v � kz
s kx
kz
v + ky
sky
kx
v + kz
s k2y
v + c ky
kz
v � kx
skz
kx
v � ky
s kz
ky
v + kx
s k2z
v + c
3
5
v := 1� cc := cos ✓s := sin ✓
![Page 8: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/8.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
RotacionesDos rotaciones alrededor de ejes diferentes no conmutan entre sí.
Cuando componemos dos rotaciones alrededor de dos ejes diferentes tenemos una rotación alrededor de un tercer eje.
Diferentes parametrizaciones de rotaciones:
Matrices de rotación
Axis-angle
Ángulos de Euler
Cuaternios
Mapa exponencialS.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
![Page 9: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/9.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Esca lam ientosPara escalar un vector por un factor s podemos usar:
S.J. Gortler. Foundations of 3D Computer Graphics. MIT Press. 2012.
~v =h
~
b1~
b2~
b3
i2
4x
y
z
3
5 )h
~
b1~
b2~
b3
i2
4s
x
0 00 s
y
00 0 s
z
3
5
2
4x
y
z
3
5
sx = sy = sz : escalamiento uniforme.sx ≠ sy ≠ sz : escalamiento diferencial.
![Page 10: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/10.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Ciza l lam iento (Shear)
Para cizallar un vector alrededor del eje-z:
~v =h
~
b1~
b2~
b3
i2
4x
y
z
3
5 )h
~
b1~
b2~
b3
i2
41 0 a
0 1 b
0 0 1
3
5
2
4x
y
z
3
5
http://140.129.20.249/~jmchen/cg/docs/rendering%20pipeline/rendering/transforms.html
![Page 11: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/11.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Transformaciones Linea les
De cuerpos rígidos:
secuencia arbitraria de translaciones y rotaciones.
preservan paralelismo, ángulos y longitudes.
Afines:
secuencia arbitraria de rotaciones, translaciones, escalamientos y cizallamientos (shear).
preserva paralelismo.
![Page 12: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/12.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Coordenadas Homogéneas
Coordenadas homogéneas o coordenadas proyectivas.
Introducidas por August Ferdinand Möbius en 1827.
Sistema de coordenadas utilizado en geometría proyectiva, como las coordenadas cartesianas se usan en geometría Euclideana.
En CG permiten que las operaciones como translación, rotación, escalamiento, proyecciones perspectivas se implementen con matrices.
![Page 13: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/13.jpg)
Permiten tratar a las transformaciones de manera consistente.
Un punto se representa con tripletas que son múltiplos entre si.
que es una línea en un espacio 3D.
Coordenadas cartesianas del punto homogéneo:
(x, y, 0) ?
puntos al infinito en dirección (x, y).
13
Features of the Beamer Class
� P � = T + P, donde P y P � son puntos en R2 y T =
�dx
dy
⇥.
� P � = S · P, donde P y P � son puntos en R2 y S =
�sx 00 sy
⇥.
� P � = R · P, donde P y P � son puntos en R2 y
R =
�cos � � sin �sin � cos �
⇥.
� (x , y ,W ) con W ⇥= 0.
Features of the Beamer Class
� P � = T + P, donde P y P � son puntos en R2 y T =
⇤dx
dy
⌅.
� P � = S · P, donde P y P � son puntos en R2 y S =
⇤sx 00 sy
⌅.
� P � = R · P, donde P y P � son puntos en R2 y
R =
⇤cos � � sin �sin � cos �
⌅.
��
xW , y
W , 1⇥
con W ⇥= 0.
Features of the Beamer Class
� P � = T + P, donde P y P � son puntos en R2 y T =
⇤dx
dy
⌅.
� P � = S · P, donde P y P � son puntos en R2 y S =
⇤sx 00 sy
⌅.
� P � = R · P, donde P y P � son puntos en R2 y
R =
⇤cos � � sin �sin � cos �
⌅.
� (tx , ty , tW ) con t ⇥= 0.
��
xW , y
W , 1⇥
con W ⇥= 0.
PW
x
y
plano W=1
Coordenadas Homogéneas
![Page 14: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/14.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Coordenadas homogéneas
Al menos una de las coordenadas homogéneas debe ser diferente a cero.
Si la coordenada W es diferente a cero podemos dividir entre ella:
(x,y,W) representa el mismo punto que (x/W, y/W, 1).
Cuando W es diferente a cero hacemos esta división y los números x/W, y/W se llaman coordenadas Cartesianas del punto homogéneo.
Los puntos con W=0 se llaman puntos en el infinito.
![Page 15: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/15.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Translación en coordenadas homogéneas
Features of the Beamer Class
� P � = T + P, donde P y P � son puntos en R2 y T =
⇤dx
dy
⌅.
� P � = S · P, donde P y P � son puntos en R2 y S =
⇤sx 00 sy
⌅.
� P � = R · P, donde P y P � son puntos en R2 y
R =
⇤cos � � sin �sin � cos �
⌅.
� (x , y , 0) con t ⇥= 0.
��
xW , y
W , 1⇥
con W ⇥= 0.
� P � = T (dx , dy ) · P con T (dx , dy ) =
⇧
⌥1 0 dx
0 1 dy
0 0 1
⌃
�.
Features of the Beamer Class
� P � = T + P, donde P y P � son puntos en R2 y T =
⇤dx
dy
⌅.
� P � = S · P, donde P y P � son puntos en R2 y S =
⇤sx 00 sy
⌅.
� P � = R · P, donde P y P � son puntos en R2 y
R =
⇤cos � � sin �sin � cos �
⌅.
� (x , y , 0) con t ⇥= 0.
��
xW , y
W , 1⇥
con W ⇥= 0.
� P � = T (dx , dy ) · P con T (dx , dy ) =
⇧
⌥1 0 dx
0 1 dy
0 0 1
⌃
�.
� P �� = T (dx1x2 , dy1y2) · P con T (dx , dy ) =
⇧
⌥1 0 dx
0 1 dy
0 0 1
⌃
�.
Features of the Beamer Class
T (dx1x2 , dy1y2) = T (dx2 , dy2) · T (dx1 , dy1)
=
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
=
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Features of the Beamer Class
T (dx1x2 , dy1y2) = T (dx2 , dy2) · T (dx1 , dy1)
=
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
=
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Features of the Beamer Class
T (dx1x2 , dy1y2) = T (dx2 , dy2) · T (dx1 , dy1)
=
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
=
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
![Page 16: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/16.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Escalamiento en coordenadas homogéneas
Escalamiento
� P � = S(sx , sy ) · P con S(sx , sy ) =
�
⇤sx 0 00 sy 00 0 1
⇥
⌅.
� P �� = T (dx1x2 , dy1y2) · P con T (dx1x2 , dy1y2) =
�
⇤1 0 dx
0 1 dy
0 0 1
⇥
⌅.
� T (dx1x2 , dy1y2) = T (dx2 , dy2) · T (dx1 , dy1).
� =
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
� =
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Escalamiento
� P � = S(sx , sy ) · P con S(sx , sy ) =
�
⇤sx 0 00 sy 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� T (dx1x2 , dy1y2) = T (dx2 , dy2) · T (dx1 , dy1).
� =
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
� =
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Escalamiento
� P � = S(sx , sy ) · P con S(sx , sy ) =
�
⇤sx 0 00 sy 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� S(sx1x2 , sy1y2) = S(sx2 , sy2) · S(sx1 , sy1).
� =
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
� =
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Escalamiento
� P � = S(sx , sy ) · P con S(sx , sy ) =
�
⇤sx 0 00 sy 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� S(sx1x2 , sy1y2) = S(sx2 , sy2) · S(sx1 , sy1).
� =
�
⇤sx2 0 00 sy2 00 0 1
⇥
⌅ ·
�
⇤sx1 0 00 sy1 00 0 1
⇥
⌅
� =
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Escalamiento
� P � = S(sx , sy ) · P con S(sx , sy ) =
�
⇤sx 0 00 sy 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� S(sx1x2 , sy1y2) = S(sx2 , sy2) · S(sx1 , sy1).
� =
�
⇤sx2 0 00 sy2 00 0 1
⇥
⌅ ·
�
⇤sx1 0 00 sy1 00 0 1
⇥
⌅
� =
�
⇤sx1 · sx2 0 0
0 sy1 · sy2 00 0 1
⇥
⌅ .
x = y : escalamiento uniforme.x ≠ y : escalamiento diferencial.
![Page 17: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/17.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotación en coordenadas homogéneasRotacion
� P � = R(�) · P con R(�) =
�
⇤cos � � sin � 0sin � cos � 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� S(sx1x2 , sy1y2) = S(sx2 , sy2) · S(sx1 , sy1).
� =
�
⇤sx2 0 00 sy2 00 0 1
⇥
⌅ ·
�
⇤sx1 0 00 sy1 00 0 1
⇥
⌅
� =
�
⇤sx1 · sx2 0 0
0 sy1 · sy2 00 0 1
⇥
⌅ .
Alrededor del origen.
Rotacion
� P � = R(�) · P con R(�) =
�
⇤cos � � sin � 0sin � cos � 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� S(sx1x2 , sy1y2) = S(sx2 , sy2) · S(sx1 , sy1).
� =
�
⇤sx2 0 00 sy2 00 0 1
⇥
⌅ ·
�
⇤sx1 0 00 sy1 00 0 1
⇥
⌅
� =
�
⇤sx1 · sx2 0 0
0 sy1 · sy2 00 0 1
⇥
⌅ .
(1) Vectores renglón unitarios
(2) Vectores renglón perpendiculares entre si (producto punto es cero)
(3) El primer y segundo vector al rotarse por R(θ) estarán en el eje-x positivo y eje-y positivo respectivamente.
(4) Los vectores columna también verifican las propiedades (1) y (2).
ortogonal especial
![Page 18: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/18.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Shear en coordenadas homogéneasShear
� P � = SHx · P con SHx =
�
⇤1 a 00 1 00 0 1
⇥
⌅.
� P �� = S(sx1x2 , sy1y2) · P
� S(sx1x2 , sy1y2) = S(sx2 , sy2) · S(sx1 , sy1).
� =
�
⇤sx2 0 00 sy2 00 0 1
⇥
⌅ ·
�
⇤sx1 0 00 sy1 00 0 1
⇥
⌅
� =
�
⇤sx1 · sx2 0 0
0 sy1 · sy2 00 0 1
⇥
⌅ .
Alrededor del eje-x.
Shear
� P � = SHx · P con SHx =
�
⇤1 a 00 1 00 0 1
⇥
⌅.
� P � = SHx ·
�
⇤xy1
⇥
⌅ =
�
⇤x + ay
y1
⇥
⌅
![Page 19: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/19.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Shear en coordenadas homogéneas
Shear
� P � = SHx · P con SHx =
�
⇤1 a 00 1 00 0 1
⇥
⌅.
� P � = SHx ·
�
⇤xy1
⇥
⌅ =
�
⇤x + ay
y1
⇥
⌅
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x + ay
y1
⇥
⌅
Alrededor del eje-y.
Shear
� P � = SHx · P con SHx =
�
⇤1 a 00 1 00 0 1
⇥
⌅.
� P � = SHx ·
�
⇤xy1
⇥
⌅ =
�
⇤x + ay
y1
⇥
⌅
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x
bx + y1
⇥
⌅
![Page 20: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/20.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Coordenadas Homogéneas
http://en.wikipedia.org/wiki/Affine_transformation
![Page 21: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/21.jpg)
Transformaciones en 3DTransformaciones en 2D ➔ matrices 3x3 con coordenadas homogéneas.
Transformaciones en 3D ➔ matrices 4x4 con coordenadas homogéneas.
(x,y,W) ➔ (x,y,z,W)
(x/W, y/W, z/W, 1) con W≠0.
Sistema coordenado con la mano derecha.
21
x
y
z
eje de rotacióndirección positiva de la
rotación
x y a z
y z a x
z x a y
![Page 22: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/22.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Transformaciones en 3D
Simple extensión de translación en 2D.Translacion 3D
� T (dx , dy , dz) =
�
⇧⇧⇤
1 0 0 dx
0 1 0 dy
0 0 1 dz
0 0 0 1
⇥
⌃⌃⌅.
� P �� = T (dx1x2 , dy1y2) · P con T (dx1x2 , dy1y2) =
�
⇤1 0 dx
0 1 dy
0 0 1
⇥
⌅.
� T (dx1x2 , dy1y2) = T (dx2 , dy2) · T (dx1 , dy1).
� =
�
⇤1 0 dx2
0 1 dy2
0 0 1
⇥
⌅ ·
�
⇤1 0 dx1
0 1 dy1
0 0 1
⇥
⌅
� =
�
⇤1 0 dx1 + dx2
0 1 dy1 + dy2
0 0 1
⇥
⌅ .
Translacion 3D
� T (dx , dy , dz) =
�
⇧⇧⇤
1 0 0 dx
0 1 0 dy
0 0 1 dz
0 0 0 1
⇥
⌃⌃⌅.
� T (dx , dy , dz) ·
�
⇧⇧⇤
xyz1
⇥
⌃⌃⌅ =
�
⇧⇧⇤
x + dx
y + dy
z + dz
1
⇥
⌃⌃⌅
Translación:
Escalamiento:
Translacion 3D
� T (dx , dy , dz) =
�
⇧⇧⇤
1 0 0 dx
0 1 0 dy
0 0 1 dz
0 0 0 1
⇥
⌃⌃⌅.
� T (dx , dy , dz) ·
�
⇧⇧⇤
xyz1
⇥
⌃⌃⌅ =
�
⇧⇧⇤
x + dx
y + dy
z + dz
1
⇥
⌃⌃⌅
� S(sx , sy , sz) =
�
⇧⇧⇤
sx 0 0 00 sy 0 00 0 sy 00 0 0 1
⇥
⌃⌃⌅.
� T (dx , dy , dz) ·
�
⇧⇧⇤
xyz1
⇥
⌃⌃⌅ =
�
⇧⇧⇤
x + dx
y + dy
z + dz
1
⇥
⌃⌃⌅
Translacion 3D
� T (dx , dy , dz) =
�
⇧⇧⇤
1 0 0 dx
0 1 0 dy
0 0 1 dz
0 0 0 1
⇥
⌃⌃⌅.
� T (dx , dy , dz) ·
�
⇧⇧⇤
xyz1
⇥
⌃⌃⌅ =
�
⇧⇧⇤
x + dx
y + dy
z + dz
1
⇥
⌃⌃⌅
� S(sx , sy , sz) =
�
⇧⇧⇤
sx 0 0 00 sy 0 00 0 sy 00 0 0 1
⇥
⌃⌃⌅.
� S(sx , sy , sz) ·
�
⇧⇧⇤
xyz1
⇥
⌃⌃⌅ =
�
⇧⇧⇤
sx · xsy · ysz · z
1
⇥
⌃⌃⌅
![Page 23: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/23.jpg)
Alrededor del eje-z
23
Rotacion 3D
� Rz(�) =
�
⇧⇧⇤
cos � � sin � 0 0sin � cos � 0 00 0 1 00 0 0 1
⇥
⌃⌃⌅.x
y
z
Alrededor del eje-x
Rotacion 3D
� Rz(�) =
�
⇧⇧⇤
cos � � sin � 0 0sin � cos � 0 00 0 1 00 0 0 1
⇥
⌃⌃⌅.
� Rx(�) =
�
⇧⇧⇤
1 0 0 00 cos � � sin � 00 sin � cos � 00 0 0 1
⇥
⌃⌃⌅. x
y
z
Alrededor del eje-y
Rotacion 3D
� Rz(�) =
�
⇧⇧⇤
cos � � sin � 0 0sin � cos � 0 00 0 1 00 0 0 1
⇥
⌃⌃⌅.
� Rx(�) =
�
⇧⇧⇤
1 0 0 00 cos � � sin � 00 sin � cos � 00 0 0 1
⇥
⌃⌃⌅.
� Ry (�) =
�
⇧⇧⇤
cos � 0 sin � 00 1 0 0
� sin � 0 cos � 00 0 0 1
⇥
⌃⌃⌅. x
y
z
![Page 24: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/24.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotaciones en 3D
Los renglones y columas de la submatriz superior izquierda de 3x3 de Rz(θ), Rx(θ) y Ry(θ) son:
vectores unitarios mutuamente perpendiculares.
la submatriz tiene determinante 1.
ortogonales especiales.
Una secuencia arbitraria de rotaciones y translaciones en 3D preserva ángulos, longitudes y paralelismo.
![Page 25: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/25.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Inversa de transformaciones en 3D
Todas las matrices de transformación tienen inversas.
La inversa de T se obtiene negando dx, dy, y dz.
La inversa de S se obtiene reemplazando sx, sy, y sz por su recíproco.
La inversa de las tres rotaciones se obtiene negando el ángulo de rotación.
La inversa de cualquier matriz ortogonal B es la transpuesta de B:
Rotacion 3D
� Rz(�) =
�
⇧⇧⇤
cos � � sin � 0 0sin � cos � 0 00 0 1 00 0 0 1
⇥
⌃⌃⌅.
� Rx(�) =
�
⇧⇧⇤
1 0 0 00 cos � � sin � 00 sin � cos � 00 0 0 1
⇥
⌃⌃⌅.
� Ry (�) =
�
⇧⇧⇤
cos � 0 sin � 00 1 0 0
� sin � 0 cos � 00 0 0 1
⇥
⌃⌃⌅.
� B�1 = BT
![Page 26: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/26.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Composición de transformaciones
Cualquier secuencia de transformaciones de rotación, escalamiento y translación se pueden multiplicar.
El resultado es de la forma:
� M =
�
⇧⇧⇤
r11 r12 r13 txr21 r22 r23 tyr31 r32 r33 tz0 0 0 1
⇥
⌃⌃⌅.
rotación y escalamiento
translación
![Page 27: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/27.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Rotación a lrededor de un punto arb itrario P1
P1
y
x
casa original
P1
y
x
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� R(�)
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x
bx + y1
⇥
⌅P1
y
xθ
P1
y
x
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� P � = SHx ·
�
⇤xy1
⇥
⌅ =
�
⇤x + ay
y1
⇥
⌅
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x
bx + y1
⇥
⌅
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� R(�)
� T (�x1,�y1)
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x
bx + y1
⇥
⌅
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� R(�)
� T (�x1,�y1)
� T (x1, y1) · R(�) · T (�x1,�y1) =�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤cos � � sin � 0sin � cos � 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅ =
�
⇤cos � � sin � x1(1� cos �) + y1 sin �sin � cos � y1(1� cos �)� x1 sin �0 0 1
⇥
⌅.
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� R(�)
� T (�x1,�y1)
� T (x1, y1) · R(�) · T (�x1,�y1) =�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤cos � � sin � 0sin � cos � 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅ =
�
⇤cos � � sin � x1(1� cos �) + y1 sin �sin � cos � y1(1� cos �)� x1 sin �0 0 1
⇥
⌅.
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� R(�)
� T (�x1,�y1)
� T (x1, y1) · R(�) · T (�x1,�y1) =�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤cos � � sin � 0sin � cos � 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅
� =
�
⇤cos � � sin � x1(1� cos �) + y1 sin �sin � cos � y1(1� cos �)� x1 sin �0 0 1
⇥
⌅.
![Page 28: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/28.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Esca lam iento a lrededor de un punto arb itrario P1
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� P � = SHx ·
�
⇤xy1
⇥
⌅ =
�
⇤x + ay
y1
⇥
⌅
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x
bx + y1
⇥
⌅
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� R(�)
� T (�x1,�y1)
� P � = SHy · P con SHy =
�
⇤1 0 0b 1 00 0 1
⇥
⌅.
� P � = SHy ·
�
⇤xy1
⇥
⌅ =
�
⇤x
bx + y1
⇥
⌅
P1
y
x
casa original
P1
y
x
P1
y
xP1
y
x
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� S(sx , sy )
� T (�x1,�y1)
� T (x1, y1) · R(�) · T (�x1,�y1) =�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤cos � � sin � 0sin � cos � 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅
� =
�
⇤cos � � sin � x1(1� cos �) + y1 sin �sin � cos � y1(1� cos �)� x1 sin �0 0 1
⇥
⌅.
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� S(sx , sy )
� T (�x1,�y1)
� T (x1, y1) · S(sx , sy ) · T (�x1,�y1)
� =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤sx 0 00 sy 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅
� =
�
⇤sx 0 x1(1� sx)0 sy y1(1� sy )0 0 1
⇥
⌅.
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� S(sx , sy )
� T (�x1,�y1)
� T (x1, y1) · S(sx , sy ) · T (�x1,�y1)
� =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤sx 0 00 sy 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅
� =
�
⇤sx 0 x1(1� sx)0 sy y1(1� sy )0 0 1
⇥
⌅.
Toto
� T (x1, y1) =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅.
� S(sx , sy )
� T (�x1,�y1)
� T (x1, y1) · S(sx , sy ) · T (�x1,�y1)
� =
�
⇤1 0 x1
0 1 y1
0 0 1
⇥
⌅ ·
�
⇤sx 0 00 sy 00 0 1
⇥
⌅ ·
�
⇤1 0 �x1
0 1 �y1
0 0 1
⇥
⌅
� =
�
⇤sx 0 x1(1� sx)0 sy y1(1� sy )0 0 1
⇥
⌅.
![Page 29: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/29.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Ejercicio
Encuentra las matrices de transformación para transformar el objeto (1) al objeto (2)
(1) (2) http://www2.it.lut.fi/kurssit/08-09/CT20A5700/exercises/05/
![Page 30: TRANSFORMACIONES LINEALES II - cimat.mxcesteves/cursos/cg/pdf/07_TranformacionesLinealesII.… · COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015](https://reader033.vdocumento.com/reader033/viewer/2022051405/5a7a09447f8b9adf778c2ea3/html5/thumbnails/30.jpg)
COMPUTACIÓN GRÁFICA | TRANSFORMACIONES LINEALES II | ENERO-JUNIO 2015 | 11/02/2015
Ejercicio
Encuentra las matrices de transformación para transformar el objeto (1) al objeto (2)
(1) (2) http://www2.it.lut.fi/kurssit/08-09/CT20A5700/exercises/05/