Mathematics for Computer Graphics

Post on 18-Mar-2016

33 views 0 download

description

Mathematics for Computer Graphics. Lecture Summary. Matrices Some fundamental operations Vectors Some fundamental operations Geometric Primitives: Points, Lines, Curves, Polygons. 2D Modeling Transformations. Modeling Coordinates. Scale Translate. y. x. Scale Rotate Translate. - PowerPoint PPT Presentation

transcript

Mathematics for Computer Graphics

Lecture Summary Matrices

Some fundamental operations

Vectors Some fundamental operations

Geometric Primitives: Points, Lines, Curves, Polygons

2D Modeling Transformations

ScaleRotate

Translate

ScaleTranslate

x

y

World Coordinates

ModelingCoordinates

2D Modeling Transformations

x

y

World Coordinates

ModelingCoordinates

Let’s lookat this indetail…

2D Modeling Transformations

x

y

ModelingCoordinates

Initial locationat (0, 0) withx- and y-axesaligned

2D Modeling Transformations

x

y

ModelingCoordinates

Scale .3, .3Rotate -90

Translate 5, 3

2D Modeling Transformations

x

y

ModelingCoordinates

Scale .3, .3Rotate -90

Translate 5, 3

2D Modeling Transformations

x

y

ModelingCoordinates

Scale .3, .3Rotate -90

Translate 5, 3

World Coordinates

Matrices A matrix is a rectangular array of elements (numbers,

expression, or function) A matrix with m rows and n columns is said to be an m-by-n

matirx ( matrix), e.g

In general, we can write an m-by-n matrix as

zyx

cbaxexe

x

x

,,,63.100.046.5

00.201.06.322

mnmm

n

n

aaa

aaaaaa

A

21

22221

11211

nm

Matrices A matrix with a single row or a single column represent a vector Single row : 1-by-n matrix is a row vector

Single column : n-by-1 matrix is a column vector

A square matrix is a matrix has the same number of rows as columns

In graphics, we frequently work with two-by-two, three-by-three, and four-by-four matrices

The zero matrix The identity matrix A diagonal matrix

321V

654

V

4231

A

0000

A

1001

I

Scalar Multiplication To multiply a martix A by a scalar value s, we multiply each

element amn by the scalar

Ex. , find 3A = ?

mnmm

n

n

sasasa

sasasasasasa

sA

21

22221

11211

654321

A

Matrix Addition Two matrices A and B may be added together when these two

matrices have the same number of rows and column the same shape

The sum is obtained by adding corresponding elements.

Ex. , find A+B = ?

Ex. , find A+B = ?

654321

A

121110987

B

0.100.65.10.0

654221BA

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

1

0

N

kkjikij bac

332211

3

2

1

321 babababbb

aaa

2222122121221121

2212121121121111

2221

1211

2221

1211

babababababababa

bbbb

aaaa

333232131

311222121

311212111

3

2

1

333231

232221

131211

bababababababababa

bbb

aaaaaaaaa

1x1 1x3 3x1

2x2 2x2 2x2

3x3 3x1 3x1

Matrix Multiplication

?542

113

?1001

3241

?154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Matrix Multiplication

15514123542

113

3241

1302031214010411

1001

3241

186

115040135140125041

154

100310201

e.g.:

Warning!!! but (AB)C = A(BC)

A(B+C) = AB + AC

(A+B)C = AC + BC

(AB)T = BTAT

A(sB) = sAB

BAAB

Determinant of a Matrix

Matrix Inverse IAA 1