3 d transformations

17
Computer Graphics 3D Transformations Total Slides 17

Upload: sarvodhya-bahri

Post on 18-Aug-2015

26 views

Category:

Engineering


1 download

TRANSCRIPT

Computer Graphics3D Transformations

Total Slides 17

From 2D to 3D

• Translation is simple as in 2D

• Use of Homogeneous coordinate in 3D– In 3D transformation always use Matrices: 4x4

• All transformation in 3D is simple but only Rotation transformation is complex in 3D transformation.

3D Translation

Translate using (tx, ty, tz ):

x’=x+ tx, y’=y+ ty , z’=z+ tz

or

x

y

P

P+TT

z

z

y

x

t

t

t

z

y

x

z

y

x

TPP

TPP'

en ,

'

'

'

'

met ,

3D Translation 2

In 4D homogeneous coordinates:

x

y

P

P+TT

z

11000

100

010

001

1

'

'

'

or ,

z

y

x

t

t

t

z

y

x

z

y

x

MPP'

3D Rotation 1

z

P

x

yP’

1000

0100

00cossin

00sincos

)(

with,)(

Or

'

cossin'

sincos'

:as- around angleover Rotate

z

z

zz

yxy

yxx

z

R

PRP'

2D Rotation about the origin.

y

x

r

r

P’(x’,y’)

P(x,y)

y

sin.

cos.

ry

rx

x

cos.sin.sin.cos.)sin(.

sin.sin.cos.cos.)cos(.

rrry

rrrx

3D Rotation 2

z

x

y

Rotation around axis:- Counterclockwise, viewed from rotation axis

z

x

y z

x

y

3D Rotation 3

z

x

yz

x

y z

x

y

zy

yx

xz

xz

zy

yx

Rotation around axes:Cyclic permutation coordinate axes

xzyx

3D Rotation

zy

yx

xz

1000

0100

00cossin

00sincos

)(

with,)(

Or

'

cossin'

sincos'

:as- around angleover Rotate

z

z

zz

yxy

yxx

z

R

PRP'

1000

0cossin0

0sincos0

0001

)(

with,)(

Or

'

cossin'

sincos'

:as- around angleover Rotate

x

x

xx

zyz

zyy

x

R

PRP'

11000

000

000

000

1

'

'

'

or ,

z

y

x

s

s

s

z

y

x

z

y

x

SPP'

3D scaling

Scale with factors sx, sy,sz :

x’= sx x, y’= sy y, z’= sz z

or

3D scaling

3D shearing

3D rotation Example

3D rotation Example

Combine 3D Transformation

3D Combine Transformations

Thank You!!