Practical lesson
In the practical lesson the coordinates of the drawing are calculated with a loop. 1) “Nested squares”: Image 200×200, centre (100, 100). Set the brush to bsClear and for i := 1 to 8 do Rectangle(100 - 12 * i, 100 - 12 * i, 100 + 12 * i, 100 + 12 * i); – the side of the i-th square is 24·i pixels, and that of the largest is 192. 2) “Coordinate axes”: MoveTo(10, 100); LineTo(190, 100); is the horizontal axis, MoveTo(100, 10); LineTo(100, 190); the vertical axis, ticks: for i := 1 to 9 do { x = 20·i, a segment from y = 96 to 104 }. 3) “Coloured circles”: 5 circles with a common centre, the colour of each given by the formula RGB(50·i, 0, 255 – 50·i). In each application calculate the most important numbers (the side of the largest square, the number of ticks) before drawing, write them down and compare them with the picture.
A pupil designing a border for a class poster noticed that each next square is bigger than the one before by the same step. Instead of measuring each, the pupil repeated one rule. The border was ready in a few minutes.
Designers, architects and programmers who generate images create patterns from a repeating rule.
On squared paper draw 4 nested squares with a common centre, each one a cell bigger on every side than the one before.
| i | Rectangle | side |
|---|---|---|
| 1 | (88, 88, 112, 112) | 24 |
| 3 | (64, 64, 136, 136) | 72 |
| 8 | (4, 4, 196, 196) | 192 |
“Picture and calculation”: a group makes 6 nested circles with its own formula and calculates the diameter of the largest circle and the sum of all diameters in advance.