P1C3 - Transformations géométriques Flashcards
Repères
objet, scène, observateur (caméra), écran
Repère indirect/direct (lié à l’observateur)
direct -> z vers l’arrière, y haut tete, x bras droit
Coordonnées cartésiennes/sphériques
x=RcosΦcosΘ
y=RcosΦsinΘ
z=RsinΦ
R=√(x²+y²+z²)
Θ=atan(y/x)
Φ=atan(z/√(x²+y²))
Transformation
X’=MX ->besoin de coordonnées homogènes pour translation
Coordonnées homogènes
à tout point (x,y,z) on fait correspondre (h1,h2,h3,s)
- h1 = s.x, h2=s.y, h3=s.z (s facteur d’échelle)
- s=0 -> point à l’infini
Translation
1 0 0 xt
0 1 0 yt
0 0 1 zt
0 0 0 1
Changement d’échelle
ex 0 0 0
0 ey 0 0
0 0 ez 0
0 0 0 1
Symétrie par rapport à un plan (xz)
1 0 0 0 0 -1 0 0 0 0 1 0 0 0 0 1 (identité avec -1 à l'axe normal)
Rotation (x,⍺)
1 0 0 0
0 cos⍺ -sin⍺ 0
0 sin⍺ cos⍺ 0
0 0 0 1
Rotation (y,⍺)
cos⍺ 0 sin⍺ 0
0 1 0 0
-sin⍺ 0 cos⍺ 0
0 0 0 1
Rotation (z,⍺)
cos⍺ -sin⍺ 0 0
sin⍺ cos⍺ 0 0
0 0 1 0
0 0 0 1
Composition des transformations
De droite à gauche
- Mise à l’échelle
- Rotation
- Translation
Rotation d’un objet en (a,b,c) autour d’un axe // à l’axe x
M = T(a,b,c).R(x,⍺).T(-a,-b,-c)
commence par une translation au centre
Transformation de coordonnées (ex: polarview)
à voir
Repère observateur openGL
matrice ModelView (combine déplacement de scène et position de l’observateur)
Transformations openGL
glTranslate( ), glRotate( ), glScale( )
glPushMatrix( ), glPopMatrix( ), glLoadMatrix( )
Attention : produit de matrice à droite, ordre inversé
(1. Translation, 2. Rotation, 3. Echelle)