1.TRANSFORMARI GEOMETRICE 2D

download 1.TRANSFORMARI GEOMETRICE 2D

of 18

Transcript of 1.TRANSFORMARI GEOMETRICE 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    1/18

    Trans ormariTrans ormariTrans ormariTrans ormariTrans ormariTrans ormariTrans ormariTrans ormari EOMETRICE 2DEOMETRICE 2DEOMETRICE 2DEOMETRICE 2DEOMETRICE 2DEOMETRICE 2DEOMETRICE 2DEOMETRICE 2D

    1

    Prof. univ. dr. ing. Florica MoldoveanuProf. univ. dr. ing. Florica MoldoveanuProf. univ. dr. ing. Florica MoldoveanuProf. univ. dr. ing. Florica Moldoveanu

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    2/18

    TransformariTransformari GEOMETRICE(1)GEOMETRICE(1)

    Obiectele 2D/3D sunt reprezentate prin:

    Coordonatele varfurilor, raportate la un sistem de coordonate

    carteziene 2D sau 3D;

    Atribute to olo ice laturi ciclul de laturi al unei fete s.a.

    2

    Atribute de aspect: culoare, tipul de interior pentru suprafete 2D,

    atribute de material(ex.: reflexia/refractia luminii de catre suprafata),

    texturi, s.a.

    Transformarile geometrice se aplica (coordonatelor) varfurilorobiectului si nu afecteaza atributele sale!

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    3/18

    TransformariTransformari GEOMETRICE(2)GEOMETRICE(2)

    - Sunt operatii fundamentale in sinteza imaginilor

    - Folosite entru:

    3

    - Redarea desenelor la diferite marimi

    - Compunerea desenelor sau a scenelor 3D

    - Realizarea animatiei

    - Transformarea obiectelor dintr-un spatiu logic, in care sunt

    definite, in spatiul fizic de afisare

    - Etc.

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    4/18

    1 .1 . T R A N S F O R M A R IT R A N S F O R M A R I G E O M E T R I C EG E O M E T R I C E E L E M E N T A R EE L E M E N T A R E

    TransformariTransformari GEOMETRICE 2D(1)GEOMETRICE 2D(1)

    4

    Translatia Scalarea fata de origine

    Rotatia fata de origine

    Forfecarea fata de origine Oglindiri fata de axele principale, fata de origine

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    5/18

    TransformariTransformari geometricegeometrice 2D2D elementareelementare(1)(1)

    Translatia

    Este definita printr-un vector, T[tx,ty].

    5

    Se doreste o reprezentare matriciala a transformarilor, necesara pentrucompunerea lor.

    P(x,y) [x,y] si P(x, y) [x,y]Se doreste: [x, y] = [x, y] * M Nu exista o matrice de 2x2 pt exprimarea

    translatiei in coordonate cartezieneEGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    6/18

    TransformariTransformari geometricegeometrice 2D2D elementareelementare(2)(2)

    Scalarea fata de origine

    Este definita prin 2 numere reale, de regula pozitive:

    - sx - scalarea de-a lungul axei OX

    - - -

    6

    Efecte:..

    sx = sy , scalare uniforma

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    7/18

    TransformariTransformari geometricegeometrice 2D2D elementareelementare(3)(3)

    Rotatia fata de origine

    Relatia dintre coordonatele carteziene sicoordonatele polare ale unui punct

    7

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    8/18

    TransformariTransformari geometricegeometrice 2D2D fatafata de unde un punctpunct oarecareoarecare

    din plan(1)din plan(1)

    Scalarea fata de un punct oarecare din plan

    - Punctul fix al transformarii este un punct oarecare F(xf,yf) coordonatele sale nu semodifica prin aplicarea transformarii.

    - Scalarea se aplica vectorului FP:x xf = sx*(x-xf)

    8

    y yf = sy*(y yf)

    Rezulta:x = x*sx + xf xf*sxy = y*sy + yf yf*sy

    Nu poate fi exprimata printr-o matrice de 2x2!

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    9/18

    TransformariTransformari geometricegeometrice 2D2D fatafata de unde un punctpunct oarecareoarecaredin plan(2)din plan(2)

    Rotatia fata de un punct oarecare din plan

    Punctul fix al transformarii este F(xf,yf)

    Rotatia se aplica vectorului FP, in jurul punctului F:

    x xf = (x-xf)* cos(u) - (y yf) * sin(u)

    9

    y yf = (x-xf)* sin(u) + (y yf) * cos(u)

    Rezulta:x = x*cos(u) y*sin(u) + xf xf*cos(u) + yf*sin(u)y = x*sin(u) + y*cos(u) + yf xf*sin(u) yf*cos(u)

    Nu poate fi exprimata printr-o matrice de 2x2!

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    10/18

    CompunereaCompunerea transformarilortransformarilor geometricegeometrice 2D2DDe ce este necesara?

    - Pentru a aplica o singura transformare care inglobeaza o secventa de transformari elementare,

    in locul aplicarii in secventa a transformarilor elementare; de ex., se aplica tuturor varfurilor o

    transformare care inglobeaza scalare, rotatie si translatie in loc sa se aplice fiecarui varf secventa

    de transformari elementare.

    - Matricea unei transformari compuse se obtine prin inmultirea matricilor transformarilor

    10

    e emen are. xemp u:

    RS = R*S =

    SR = S*R =

    - Translatia fata de origine nu poate fi reprezentata printr-o matrice de 2x2!

    - Aceasta impune reprezentarea transformarilor in coordonate omogene:

    RS # SR

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    11/18

    ReprezentareaReprezentarea transformarilortransformarilor geometricegeometrice 2D in2D incoordonatecoordonate omogeneomogene(1)(1)

    Coordonate omogene:

    11

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    12/18

    ReprezentareaReprezentarea transformarilortransformarilor elementareelementare 2D in2D incoordonatecoordonate omogeneomogene(2)(2)

    12

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    13/18

    TransformarileTransformarile inverse aleinverse ale transformarilortransformarilorelementareelementare

    T(tx, ty): matricea translatiei, in coordonate omogene

    S(0, 0, sx, sy): matricea scalarii fata de origine, in coordonate omogene

    R(0,0,u): matricea rotatiei fata de origine, in coordonate omogene

    13

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    14/18

    TransformariTransformari geometricegeometrice 2D2D compusecompuse(1)(1)

    Exemple de transformari compuse:

    Expresiile matematice ale scalrii i rotaiei fa de un

    punct oarecare din plan se pot obine prin compunerea urmtoarelor

    transformri:

    14

    Translaia prin care punctul fix al transformrii ajunge n origine: T(-xf, -yf);

    Scalarea / rotaia fa de origine: S(0,0,sx,sy)/R(0,0,u);

    Translaia invers celei de la punctul 1: T(xf, yf).

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    15/18

    TransformariTransformari geometricegeometrice 2D2Dcompusecompuse(2)(2)

    15

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    16/18

    AlteAlte transformaritransformari geometricegeometrice 2D(1)2D(1)

    Oglindirea

    Fata de axa OX

    Fata de axa OY

    16

    Fata de origine

    Fata de dreapta x=y

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    17/18

    AlteAlte transformaritransformari geometricegeometrice 2D(2)2D(2)

    Oglindirea fa de o dreapt oarecare

    Se exprima ca transformare compusa prin inmultirea matricilor care exprima urmatoarele

    transformari:

    1. O translaie, astfel nct dreapta sa treaca prin origine.

    2. O rotaie fa de origine, a.. dreapta s se suprapun peste una dintre axele principale.

    17

    3. Oglindirea fa de axa principal peste care a fost suprapus dreapta.

    4. Rotaia invers celei de la punctul 2.

    5. Translaia invers celei de la punctul 1.

    n notaie matricial:M = T * R* O* R-1 *T-1 (folosind vectori linie) sau M = T-1 * R-1 *O *R *T (folosind vectori coloana)

    Deduceti T, R, O, atunci cand dreapta este data printr-un punct, (xd, yd) si o directie, D[a, b].

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D

  • 7/22/2019 1.TRANSFORMARI GEOMETRICE 2D

    18/18

    AlteAlte transformaritransformari geometricegeometrice 2D(4)2D(4)

    Forfecarea

    Este definita prin 2 numere reale:

    Fx: factorul de forfecare pe axa OX

    18

    Deduceti formele matriciale aletransformarilor de forfecare:

    1. Translatie prin care punctul (xf, yf) ajunge in origine2. Forfecarea fata de origine3. Translatia inversa celei de la pasul 1

    Forfecarea fata de un punct oarecare din plan, (xf,yf) , exprimata ca transformare compusa:

    EGCEGCEGCEGC Transformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2DTransformari geometrice 2D