Docsity

Lecture 9: Objects and Transformations in 3D Computer Graphics, Study notes of Introduction to Sociology

Partial preview of the text

Download Lecture 9: Objects and Transformations in 3D Computer Graphics and more Study notes Introduction to Sociology in PDF only on Docsity!

Introduction toComputer GraphicsFarhana Bandukwala, PhDLecture 9: Objects andTransformations in 3D

Outline

• Geometric objects & operators

(Angel, chapter 4.1)

• Coordinate systems and transformations^ (Angel, chapter 4.2) • Matrix representations

(Angel, chapter 4.3)

• Composite transformations

Coordinate systems

-^ Points in 3-d w/respect to 3 linearly independent vectors(basis or coordinate system)•^ Frame: coordinate system and defined origin

∆^ defines

all 3-d points uniquely• All 3-d points (or vectors) can be represented as a three-tuple in terms of basis vectors:• For example: a

1 = ae 1

2 + ae 2

3 + ae 3

a (^2) e (^1) e

(^3) e

Transformations in 3D

Use homogeneous coordinates, and represent 3Dpoints as four-tuples (x,y,z,W)

dx 0 1 0

d^ y 0 0 1

d^ z 0 0 0

Translation

s^0 0 x^

0 s^0 y^

0 0 sz

Scaling

Composite Transformations • To rotate about a fixed point: 1.^ Translate point to origin,2.^ Rotate object3.^ Reverse previous translationz x

z P x^

y P

z x P y^ x

z P y^ x

z

y P

-px 0 1 0

-p^ y 0 0 1

-p^ z 0 0 0

Translation T(-P) =

0 cosT^

-sinT^0 0 sinT^

cosT^0 0 0

Rotation around xR(T) =

px 0 1 0

p^ y 0 0 1

p^ z 0 0 0

TranslationT(P)=

M = T(P)R(

T)T(-P)

Composite TransformationTo rotate about an arbitrary axis (

A) by^ α:

-^ rotate such that rotation vector (

A) aligned with z-axis

-^ then rotate by desired angle–^ Reverse first rotation^ M = R(-

T) R(-T) R(x^ y

D) R(T) R(zy

T)x

x^

y z

z x Tx y

z x A P y

z x

y Ty

x^

y z

Rotate by

Tx around x axis

Rotate by

Ty around y axis

Rotate by

D

around z axis

Reverse rotationsaround x & y axes Remember:Dot products give anglesbetween 2 vectors

Changing coordinate systemsConsider three linearly independent vectors:^1 –^ v= v

1 e+ v 1112

2 e+ ve^13

3

2 – v= v

1 e+ v 2122

2 e+ ve^23

3

3 – v= v

1 e+ v 3132

2 e+ ve^33

3

  • coordinate system as a transformation matrix

(^2) e (^1) e

(^3) e (^2) v^1 v

(^3) v

Suppose b

is the vector coincident with a

but with respect to the 2

a^ same as nd^ basis

b

(^1) v^ = (^2) v (^3) v -1^ a = Vb

v^ v^11

v^13 vv^21

v^23 vv^31

e v 33 (^12) e (^3) e