Docsity

Matrix Composition - Introduction to Computer Graphics - Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Matrix Composition - Introduction to Computer Graphics - Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Lecture 11:

Viewing 1

Refresher

โ€ข Matrix composition:

โ€“ If I want to have an object thatโ€™s currently located at

position (a, b, c) to be

    1. Uniformly scaled by 3
    1. Rotated around the z-axis by 45 degrees
    1. Translated by (5, 10, 15)

โ€“ Write out the sequence of matrices that you need to

apply

โ€ข Now write out the inverse of this transformation

matrix

Composition (an example) (2D) (2/2)

  • ๐‘ปโˆ’๐Ÿ๐‘น๐‘บ๐‘ป
  • But what if we mixed up the order? Letโ€™s try ๐‘น๐‘ปโˆ’๐Ÿ๐‘บ๐‘ป

cos90 โˆ’๐‘ ๐‘–๐‘›90 0 ๐‘ ๐‘–๐‘›90 ๐‘๐‘œ๐‘ 90 0 0 0 1

1 0 2 0 1 2 0 0 1

3 0 0 0 3 0 0 0 1

1 0 โˆ’ 0 1 โˆ’ 0 0 1

  • Oops! We managed to scale it properly but when we rotated it we rotated the object about the origin, not its own center, shifting its positionโ€ฆ Order Matters!
  • http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/appl ets/transformationGame/transformation_game_guide.html (Transformations applet)

Rotating axis by axis (1/2)

  • Every rotation can be represented as the composition of 3 different angles of

CLOCKWISE rotation around 3 axes, namely

  • ๐‘ฅ-axis in the ๐‘ฆ๐‘ง plane by ๐œ“
  • ๐‘ฆ-axis in the ๐‘ฅ๐‘ง plane by ๐œƒ
  • ๐‘ง-axis in the ๐‘ฅ๐‘ฆ plane by ๐œ™
  • Also known as Euler angles, makes the problem of rotation much easier to

deal with

  • ๐‘น๐’š๐’› : rotation around the ๐‘ฅ axis, ๐‘น๐’™๐’› : rotation about the ๐‘ฆ axis,

๐‘น๐’™๐’š : rotation about the ๐‘ง axis

  • You can compose these matrices to form a composite rotation matrix

๐‘…๐‘ฅ๐‘ฆ(๐œ™) ๐‘…๐‘ฆ๐‘ง ๐œ“^ ๐‘…๐‘ฅ๐‘ง ๐œƒ

Rotation

  • Rotation by angle ๐œƒ around vector ๐’˜ =

๐’˜๐’™ ๐’˜๐’š ๐’˜๐’›

  • Hereโ€™s a not so friendly rotation matrix:

๐‘ค๐‘ฅ^2 + ๐‘๐‘œ๐‘ ๐œƒ(๐‘ค๐‘ฆ^2 + ๐‘ค๐‘ง^2 ) ๐‘ค๐‘ฅ๐‘ค๐‘ฆ 1 โˆ’ ๐‘๐‘œ๐‘ ๐œƒ + ๐‘ค๐‘ง๐‘ ๐‘–๐‘›๐œƒ ๐‘ค๐‘ฅ๐‘ค๐‘ง 1 โˆ’ ๐‘๐‘œ๐‘ ๐œƒ + ๐‘ค๐‘ฆ๐‘ ๐‘–๐‘›๐œƒ 0 ๐‘ค๐‘ฅ๐‘ค๐‘ฆ 1 โˆ’ ๐‘๐‘œ๐‘ ๐œƒ + ๐‘ค๐‘ง๐‘ ๐‘–๐‘›๐œƒ ๐‘ค๐‘ฆ^2 + ๐‘๐‘œ๐‘ ๐œƒ(๐‘ค๐‘ฅ^2 + ๐‘ค๐‘ง^2 ) ๐‘ค๐‘ง๐‘ค๐‘ฆ 1 โˆ’ ๐‘๐‘œ๐‘ ๐œƒ โˆ’ ๐‘ค๐‘ฅ๐‘ ๐‘–๐‘›๐œƒ 0 ๐‘ค๐‘ฅ๐‘ค๐‘ง 1 โˆ’ ๐‘๐‘œ๐‘ ๐œƒ โˆ’ ๐‘ค๐‘ฆ๐‘ ๐‘–๐‘›๐œƒ ๐‘ค๐‘ง๐‘ค๐‘ฆ 1 โˆ’ ๐‘๐‘œ๐‘ ๐œƒ + ๐‘ค๐‘ฅ๐‘ ๐‘–๐‘›๐œƒ ๐‘ค๐‘ง^2 + ๐‘๐‘œ๐‘ ๐œƒ(๐‘ค๐‘ฆ^2 + ๐‘ค๐‘ฅ^2 ) 0 0 0 0 1

  • This is called the coordinate form of Rodriguesโ€™s formula

How to Invert a Matrix

  • Weโ€™re going to use Gauss-Jordan elimination
  • Finding A-1^ with Gauss-Jordan elimination is done by augmenting A with I

to get [A|I], then reducing the new matrix into reduced row echelon form

(rref) to get a new matrix. This new matrix will be of the form [I|A-1]

  • What does rref really mean?
    • If a row does not consist entirely of zeros, then the first nonzero number in the row is a
      1. (Call this a leading 1)
    • If there are any rows that consist entirely of zeros, then they are grouped together at the bottom of the matrix.
    • If any two successive rows do not consist entirely of zeros, the leading 1 in the lower row occurs farther to the right than the leading 1 in the higher row
    • Each column that contains a leading 1 has zeros everywhere else.

How to Invert a Matrix, Example

  • Given: ๐ด =

, letโ€™s find ๐ดโˆ’1:

1. Augment this with the identity:

2. Row operation 1: multiply row 1 by 1/

13 11 19

1 11 0

3. Row operation 3: multiply row 1 by -17 and add it to row 2:

13 11 โˆ’

12 11

1 11 โˆ’

17 11

How to Invert a Matrix, Example

4. Row operation 1, multiply row 2 by โ€“ 11/

13 11 1

1 11 17 12

11 12

5. Row operation 3: multiply row 2 by โ€“ 13/11 and add to row 1

17 12

13 12 โˆ’

11 12

6. Therefore:

โ€“ ๐ดโˆ’1^ =

17 12 โˆ’^

11 12

Drawing as Projection (Turning 3D to

2D)

  • Painting based on mythical tale as told by Pliny

the Elder: Corinthian man traces shadow of departing lover

๏ฝ Detail from: The Invention of Drawing (1830) Karl Friedrich Schinkle (Mitchel p.1)

๏ฝ Projection through use of

shadows

Early Forms of Projection

โ€ข Plan view ( parallel ,

specifically orthographic,

projection) from

Mesopotamia (2150 BC):

Earliest known technical

drawing in existence

โ€ข Greek vase from the late 6th

century BC: Shows signs of

attempts at perspective!

  • Note relative sizes of thighs

and lower legs of minotaur

Linear Perspective

โ€ข Parallel lines converse (in 1, 2, or 3 axes) to

vanishing point(s).

โ€ข Objects farther away are more foreshortened

(i.e., smaller) than closer ones

edges same size, with farther ones smaller

parallel edges converging

๏ฝ Example: perspective cube

Early Attempts at Perspective

  • In art, an attempt to represent 3D space more realistically
  • Earlier works invoke a sense of 3D space but not systematically

Background for Inventing Perspective

Projection

  • Starting in the 13th^ century (AD): New emphasis on

importance of individual viewpoint, world interpretation, power of observation (particularly of nature: astronomy, anatomy, etc)

  • Massaccio
  • Donatello
  • Leonardo
  • Newton

๏ฝ Universe as clockwork: rebuilding the universe more

systemically and mechanically

Ender, Tycho Brahe and Rudolph II in Prague (detail of clockwork), c. 1855

Brunelleschi and Vermeer

  • Brunelleschi invented systematic method of determining perspective

projections (early 1400โ€™s). He created demonstration panels with specific

viewing constraints for complete accuracy of reproduction. Note the

perspective is accurate only from one Point of View (POV)

  • Vermeer created perspective boxes where picture, when viewed through

viewing hole, had correct perspective

Perspective Box Samuel van Hoogstraten National Gallery, London

Perspective Box of a Dutch Interior Samuel van Hoogstraten National Gallery, London

๏ฝ Vermeer on the web: ๏ฝ http://www.grand-illusions.com/articles/ mystery_in_the_mirror/ ๏ฝ http://essentialvermeer.20m.com/ ๏ฝ http://brightbytes.com/cosite/what.html