Lesson 4, Topic 3
In Progress


John May 21, 2019
Lesson Progress
0% Complete

The final coordinate system transformation is scaling, which changes the size of the grid. Take a look at this program, which draws a square, then scales the grid to twice its normal size, and draws it again.

background(255, 255, 255);
stroke(120, 120, 120);
rect(20, 20, 40, 40);
stroke(0, 0, 0);
rect(20, 20, 40, 40);

First, you can see that the square appears to have moved. It hasn’t, of course. Its upper left corner is still at (20, 20) on the scaled-up grid, but that point is now twice as far away from the origin as it was in the original coordinate system.