Lecture 7 2D Transformation. What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.)

Similar presentations

Presentation on theme: "Lecture 7 2D Transformation. What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.)"— Presentation transcript:

2
What is a transformation? Exactly what it says - an operation that transforms or changes a shape (line, shape, drawing etc.) They are best understood graphically first. There are several basic ways you can change a shape: Translation (moving it somewhere else). Rotation (turning it round). Scaling (making it bigger or smaller).

3
Translation Essentially, we want to move the shape dx pixels along the x-axis and dy pixels up the y-axis. In fact all this means is moving each constituent point by dx and dy. To move a point in this manner, simply add the values of dx and dy to its existing coordinates. Example 15 shows what a translate() method of the Point2D class might look like.

5
Rotation ( about the origin) To rotate any shape about the origin requires rotating each of its individual points. To work out how this is done, consider the coordinates of a point before and after the rotation: Both points will lie on the perimeter of a circle of radius r with its center on the origin.

7
Scaling Scaling a shape simply means making a it bigger or smaller. We can specify how much bigger or small be means of a “scale factor” - to double the size of an object we use a scale factor of 2, to half the size of an object we use a scale factor of 0.5.

8
Scaling Again, scaling of a shape is achieved by applying an operation to the individual points that make up the shape. In this case, the distance of a point from the origin changes by the scale factor. Simply multiplying the coordinates by the scale factor gives the new values of the coordinates.

9
Scaling Note that the scaling can be different in different directions: i.e. the x scale factor can be different to the y scale factor. By doing this we can stretch or squeeze a shape: Simply multiplying the coordinates by the scale factor gives the new values of the coordinates.

11
Order of Transformation The order in which transformations are applied to a shape is important. e.g. performing a translation followed by a rotation, will give an entirely different drawing to a performing the rotation followed by the same translation.

About project

Feedback

To ensure the functioning of the site, we use cookies. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy &amp Terms.
Your consent to our cookies if you continue to use this website.