graphics programming graphics programming: transformations

Post on 22-Dec-2015

291 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Graphics Programming

Graphics Programming:Transformations

Transformation (Isometry) Translations Rotations Scaling Mirror

Transformations

One example of a transformation is the window to viewport transformation.

Here we have seen an image in the world window scaled and translated (moved) into a viewport window.

We can build on this transformation to allow us to move objects to more complex locations.

Transformations A Transformation consists of:

a Rotation a Scaling and a Translation a Shearing

They occur in 2D

and 3D

Transformations

Transformations allow for: scene composition

Transformations Transformations allow for:

easily create symmetrical objects

Transformations

Transformations allow for:

viewing objects at different angles

computer animation where several objects need to move relative to one another

Translation

Scaling

Rotation

Reflection (flip)

Combining Transforms

Combining Transforms

Combining Transforms

Transforming Points

A transformation simply takes a point and maps it to another location.

Transforming Points

In the 2D case this means…. Q = M(P)

where M is some mapping matrix

P

Q

Matrices : Addition

Matrices : Multiplication

2x - y + 2z = 1x + 2y - 4z = 33x - y + z = 0

Matrices : Multiplication

Matrices : Rotation

Matrices :Identity Matrix

1 0 0

0 1 0

0 0 1

2 3 4

4 7 5

5 2 8

=

2 3 4

4 7 5

5 2 8

x

Further Reading

See Rowe – Chapter 2 for a discussion on homogenous coordinates and further examples of matrix transformations.

Also see discussions and technical articles on:

www.gamedeveloper.com

www.gamedev.net

www.ddj.com Dr. Dobb’s Journal

- been around since 1976

top related