Sie sind auf Seite 1von 30

3D geometric transformations

M.A.K JAILANI ASSISTANT PROFESSOR DEPT. OF COMPUTER APPLICATIONS SASTRA UNIVERSITY

TRANSLATION

In 3D coordinates representation, a point is translated from position P=(x, y, z) to p’=(x’, y’, z’) with the matrix operation

Translation (cont )

(or)

P’ = T.P

Equ(1)

Translation (cont )

The parameter t x , t y and t z specifying distances for the coordinate directions x, y, z are assigned any real values.

The matrix representation of the above equ (1)

X’ = x + t x

Y’ = y + t y

z’ = z + t z

An object is translated in three dimensional by transforming each of the defining points of the objects.

Rotation

Need to specify which axis the rotation is to be performed

To specify the amount of an angular rotation.

The Positive rotation directions about the coordinates axes are counterclockwise, when looking toward the origin from a positive coordinate position on each axis as follows

Fig ( a )

Rotation (cont…)

Fig ( b )

Rotation (cont…)

Fig ( c )

Coordinate-Axes rotation

2 dimensional Z axis rotation equation are easily extended to 3D x’ = x cos θ – y cos θ

y’ = x sin θ +

y cos θ

z’ = z Here θ specifies the rotation angle

Eqs 1

In homogeneous coordinate form, the three dimensional z-axis equation are expressed as follows

Which can write compactly as

p’ = R z (θ ) . p

Cyclic permutation of the Cartesian coordinate axes to produce the three sets of coordinates –axis rotation equation

Fig (a)

The transformation equation for rotations about the other two coordinates can be obtained with a cyclic permutation of the coordinate parameter x, y, and z in the eqs (1)

That’s, using the following replacement

x

y

z

x

As the above sequence illustrated in fig(a)

Substituting
x
y
z
x
we get the equations for an x-axis rotation
y’ = y cosθ
- z sinθ
z’ = y sinθ +
z cosθ

x’ = x

Which can be written in the homogeneous form

Or

p’=R x (θ).p

Equ 6

Equ 7

Rotation of an object around the x axis is demonstrated in the following fig (b)

Fig (b)

Cyclically permutation coordinates in equ (5) give us the transformation equation for y-axis rotation ( y ->z -> x -> y)

z’ = z cosθ x’ = z sinθ +

- x sinθ x cosθ

Equ 8

y’ = y The matrix representation for y-axis rotation is

Or

P’ = R y (θ) . P

Equ 9

An example of y-axis rotation is shown in the following fig ( c )

An inverse rotation matrix is formed by replacing the rotation angle θ by -θ.

We can calculate the inverse of any rotation matrix R by evaluating its transpose R 1 = R T

General Three-Dimensional Rotation

An object is to be rotated about an axis that is parallel to one of the coordinate axes

1.Translate the object so that the rotation axis coincides with the parallel coordinate axis

2.Perform the specified rotation about that axis

3.Translate the object so that the rotation axis is moved back to its original position

P

'

=

T

1

R

x

(

θ

)

T

P

Where the composite matrix for the transformation is

R

(

θ

)

=

T

1

R

x

(

θ

)

T

General Three-Dimensional Rotation (cont’d)

General Three-Dimensional Rotation (cont’d)

An object is to be rotated about an axis that is not parallel to one of the coordinate axes

1.Translate the object so that the rotation axis passes through the coordinate origin.

2.Rotate the object so that the axis of rotation coincide with one of the coordinate axes.

3.Perform the specified rotation about that coordinate axis.

4.Apply inverse rotations to bring the rotation axis back to its original orientation.

5.Apply the inverse Translation to bring the rotation axis back to its original position.

General Three-Dimensional Rotation (cont’d)

Scaling

Scaling with respect to the coordinate origin

x ' ⎤ ⎡

y z '

= ⎢

'

1

s

x

0

0

0

0

s

y

0

0

0

0

s

z

0

0 ⎤ ⎡ x

y

z

1

0

0

⋅ ⎢

1

⎦ ⎣

P '= S P

Scaling

Scaling with respect to a selected fixed position (x f , y f , z f )

1. Translate the fixed point to origin

2. Scale the object relative to the coordinate origin

3. Translate the fixed point back to its original position

T

(

x

f

,

y

f

,

z

f

)

(

S s

x

,

s

y

,

s

z

)

T

(

x

f

,

y

f

,

z

f

)

=

s

x

0

0

0

0

s

y

0

0

0

0

s

z

0

(1

(1

(1

)

x

)

s

x

f

s y

y

f

s

z

)

z

f

1

Scaling

Reflections

RF =

z

1

0

0

0

0

1

0

0

0

0

0

1

0

0

0

1

Shears

SH z =

1

0

0

0

0

1

0

0

a

b

1

0

0

0

0

1

Composite transformations

Carried out from right to left, where the rightmost matrix is the first transformation to be applied to an object and the leftmost matrix is the last transformation.