Top Banner
IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal
29

IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Apr 04, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

IFT3355: InfographieTransformations Géométriques

© Victor Ostromoukhov

Dép. I.R.O.

Université de Montréal

Page 2: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Fenêtre (window)

• Région dans l’espace 3D à travers laquelle on voit la scène

• Note: concept différent de celui des fenêtres en Xwindow...

scène 3Dplan de vue

fenêtre

Page 3: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Clôture (viewport)

• Partie de l’écran où la fenêtre est affichée

système d’affichage

clôture

Page 4: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Série de transformations

• Modèle 3D• Système de coordonnées de vue

– construit un plan de vue en 3D– définit une fenêtre dans ce plan

• Coordonnées de vue pour chaque point en 3D• Définit un clôture dans un système normalisé [0,1]

• Coordonnées d’affichage

Projection

Mapping fenêtre-clôture

Page 5: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Mapping

• Coordonnées du monde : coordonnées d’affichage• Fenêtre : clôture• XY : UV

XY

UV

Page 6: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformation 2D: rectangle à rectangle

),( maxmax yx

),( minmin yx),( minma xminma x yyxx --

)0,0(

),( minmin yxT --

Y

X

Con

figu

ratio

nin

itial

e

U

V

Con

figu

ratio

nfi

nale

),( minmin vu

),( ma xma x vu

Page 7: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformation 2D: rectangle à rectangle

),( minma xminma x yyxx --

)0,0(

minmax

minmax

minmax

minmax , yyvv

xxuuS -

---

),( minma xminma x vvuu --

)0,0(

),( minma xminma x vvuu --

Page 8: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformation 2D: rectangle à rectangle

),( minma xminma x vvuu --

)0,0(

minmin ,vuT

),( ma xma x vu

),( minmin vu

),( , ),( minminminmin minmax

minmax

minmax

minmax yxTSvuTM yyvv

xxuu

vw -- --

--

Page 9: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Translation en 2D

),( yxP

),( yyxxP

x

y

PTP

y

x

y

x

y

x

T

Page 10: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Changement d’échelle en 2D (scaling)

),( yxP

),( yyxxP

SPP

y

x

y

x

y

x

0

0

Page 11: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Rotation en 2D

),( yxP

),( yxP

RPP

y

x

y

x

-

cossin

sincos

sens anti-horaire

sin

cos:

ry

rxP

-

-

cossin

cossinsincos

)sin(

sincos

sinsincoscos

)cos(

:

yx

rr

ry

yx

rr

rx

Pr

r

Page 12: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Cisaillement en 2D (shearing)

PShP

y

xa

y

x

x

10

1

PShP

y

x

by

x

y

1

01

Page 13: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Réflexion en 2D

-

y

x

y

x

10

01),( yxP ),( yxP

-

y

x

y

x

10

01),( yxP

),( yxP

),( yxP

),( yxP

y

x

y

x

01

10

Page 14: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Coordonnées homogènes

• T+P en addition mais les autres transformations sont des multiplications

• Représentation des transformations sous une forme matricielle unique:

+ uniformité

+ composition

+ opérations des 4x4 sont exécutées en parallèle en hardware sur la plupart des ordinateurs

- optimisations possibles...

x

xy

x

tymxmy

tymxmxy

x

tmm

tmm

2221

12112221

1211

1100(9 mult,6 add) vs. (4 mult,4 add)

Page 15: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Coordonnées homogènes en 2D

permis... pasest n' : )0,0,0(

)ou vecteur (direction infinil' àpoint : 0

homogènepoint ,1plan le danspoint : )1,,(

homogènepoint un d' ecartésienn coordonnée : 1,,

0 ,0 : ),,(

w

wyxP

P

twtwtytxP

twty

twtx

)0,0,0(

X

Y

W

)1,,( yx

1w

)0,,( yx

),,( ttytx

Page 16: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Pré-multiplication vs. post-multiplication

PyxTP

y

x

y

x

y

x

),(

1100

10

01

1

ttt yxTPP

yx

yxyx

),(

1

010

001

11

ttt TPTP )(

Nouvelle méthode Ancienne méthode

Page 17: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Combinaison de translations en 2D

PP

P

PyyxxT

y

x

yy

xx

y

x

y

x

y

x

PyxTyxT

PyxTP

PyxTP

),(

1100

10

01

1100

10

01

100

10

01

),(),(

),(

),(

2121

21

21

1

1

2

2

1122

22

11

Page 18: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Combinaison de changements d’échelle en 2D

PyyxxS

y

x

yy

xx

y

x

y

x

y

x

PyxSyxSP

),(

1100

00

00

1100

00

00

100

00

00

),(),(

2121

21

21

1

1

2

2

1122

Page 19: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Combinaison de rotations en 2D

PR

y

x

y

x

y

x

PRRP

)(

1100

0)cos()sin(

0)sin()cos(

1100

0coscossinsinsincoscossin

0cossinsincossinsincoscos

1100

0cossin

0sincos

100

0cossin

0sincos

)()(

-

----

-

-

Page 20: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Combinaisons de matrices de transformation

+ efficacité– une seule matrice composée est utilisée au lieu

d’une série de matrices• {R,T}

– (rigid-body) – préserve les longueurs et les angles

• {R,T,S}– transformation affine– préserve le parallélisme des lignes (mais pas les

longueurs ni les angles)

Page 21: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Propriétés des matrices de transformations

• Commutativité

• Associativité

• Inverses321321 )()( MMMMMM

)()()(

,),(

),(),(

1

111

1

t

yx

RRR

SyxS

yxTyxT

-

--

-

-

-

)()(1221

1221

1221

yxRSRyxS

RRRR

SSSS

TTTT

Page 22: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Exemple d’une série de transformations

• Rotation autour d’un point Q• On sait comment faire une rotation autour de

l’origine, mais pas autour d’un point arbitraire

1. Translation telle que Q est à l’origine

2. Rotation de autour de l’origine

3. Translation de l’origine jusqu’à Q

PyxTRyxTM ),()(),( --

),( yxT --

)(R),( yxT

Page 23: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Exemple de non-commutativité

100

0

0

100

10

01

100

00

00

100

0

0

100

00

00

100

10

01

),(),(),(),(

yss

xss

y

x

s

s

ST

ys

xs

s

s

y

x

TS

yxTssSssSyxT

yy

xx

y

x

y

x

y

x

yxyx

Page 24: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformations en 3D

2D: matrice 3x3 en coordonnées homogènes

3D: matrice 4x4 en coordonnées homogènes

),,,(),,( wzyxzyx

X

Y

Z

Système de coordonnées de la main droiterotation positive: sens anti-horaire

Page 25: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformations 3D de base

Translation

Changement d’échelle

1000

100

010

001

tz

ty

tx

T

1000

000

000

000

sz

sy

sx

S

Page 26: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformations 3D de base

Rotations

)(

1000

0cossin0

0sincos0

0001

xR

-

)(

1000

0cos0sin

0010

0sin0cos

yR

-

)(

1000

0100

00cossin

00sincos

zR

-

Page 27: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformation de normales

• Points, tangentes, vecteurs fonctionnent avec les matrices standards

• Normale à la surface fonctionne différemment

2.0,1S

Page 28: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformation de normales

0

0

0

0

1

-nMMt

IXM

XnMt

XnMt

ntnt

TTT

T

TT

T

T

Page 29: IFT3355: Infographie Transformations Géométriques © Victor Ostromoukhov Dép. I.R.O. Université de Montréal TexPoint fonts used in EMF. Read the TexPoint.

Transformations hiérarchiques

• Objet représenté par un arbre de primitives (feuilles) transformées (noeuds)

objet

transformation transformation

transformationsphère sphère

sphère