Follow the instructions to create pictures from shapes and learn about vector graphics.
There are two main ways of representing images: bitmap images and vector images. In bitmap images you store the colour of very individual pixel or square in the image. (See our pixel puzzles for more on bitmap images). In vector images you store instructions of the lines or shapes to draw and order to draw them in. It is a way of representing an image as an algorithm that draws it. These puzzles involve following a simplified form of vector drawing instructions to create a picture.
Draw the pictures on the square grid provided – or cut out and glue on shapes. You could also draw the pictures in a drawing package. Turn a class full of images in to bunting by stringing them together.
- representation of images
- vector graphics
- data representation
- computational thinking
- coordinate systems
- mathematical scaling
Also for younger children:
Teach as part of:
Instructions: Vector Drawing Puzzles
For example the following vector drawing instructions draw the picture of a Christmas tree above. If drawing it may be easier to lightly draw the bounding box for each shape first, then the shape outline, then colour it in. Use strong colours so the colours overwrite those underneath. Notice that the order the instructions are followed matters. If you were to draw the circles first then they would be covered by the later triangles.
- Rectangle Brown SIZE (4,4) AT (4,0)
- Triangle Green SIZE (12, 4) AT (0,4)
- Triangle Green SIZE (12, 4) AT (0, 6)
- Triangle Green SIZE (12, 4) AT (0, 8)
- Triangle Green SIZE (10, 4) AT (1,10)
- Triangle Green SIZE (8, 4) AT (2, 12)
- Triangle Green SIZE (6, 4) AT (3, 14)
- Star Yellow SIZE (3,3) AT (4.5, 17)
- Circle Red SIZE (1,1) AT (0,5)
- Circle Red SIZE (1,1) AT (3,9)
- Circle Red SIZE (1,1) AT (4,6)
- Circle Red SIZE (1,1) AT (6,10)
- Circle Red SIZE (1,1) AT (11,5)
- Circle Red SIZE (1,1) AT (7,12)
- Circle Red SIZE (1,1) AT (4,14)
- Circle Blue SIZE (1,1) AT (3,4)
- Circle Blue SIZE (1,1) AT (6,5)
- Circle Blue SIZE (1,1) AT (0,7)
- Circle Blue SIZE (1,1) AT (7,8)
- Circle Blue SIZE (1,1) AT (10,7)
- Circle Blue SIZE (1,1) AT (9,10)
- Circle Blue SIZE (1,1) AT (4,11)
- Circle Blue SIZE (1,1) AT (7,15)
- Circle Blue SIZE (1,1) AT (5,16)
The bounding box of a shape is the smallest rectangle the shape fits in. The size given for each shape is the size of its bounding box. The position in the above drawing is the bottom, left corner of its bounding box. Triangles in this puzzle are isosceles triangles with the base at the bottom. Sizes are given as (width, height). Positions are given as (x,y).
Once you have instructions like those above you can package them as a new instruction called ChristmasTree to be used in more complex pictures. This form of abstraction is a powerful feature of vector images. It allows pictures to be drawn using decomposition, breaking the picture down hierarchically into components. For example, for the Christmas tree we could have first created instructions for an undecorated Christmas tree, allowing it to be used for different trees with different decorations.
These puzzles demonstrate a practical use of mathematical scaling. One of the advantages of the vector image representation is that you can create larger or smaller versions that do not lose accuracy. Having drawn a picture, draw it again twice as large, by scaling the vector drawing instructions by a factor of 2. To scale a vector image (make a bigger or smaller version), multiply all numbers in the instructions with the scaling factor. For example to draw the image twice as big, first multiply all the numbers in the instructions by 2.
Resources: Vector Drawing Puzzle Sheet
Here is a Vector Drawing Puzzle Picture sheet and solution based on the above that you can download.
There are more christmas computing ideas here.
These collage based puzzles give pictures about Ancient Egypt.
These collage based puzzles give pictures based on Easter/ Spring Themes.
Circle-based Vector Drawings
Here are some more Vector Drawing Puzzle Picture sheets and solutions that you can download.
These are based on positions that give the top-left corner of the bounding box positions, and all bounding boxes are squares so only a single dimension is given. In these puzzles the shape, colour, position of the bounding box and size of the square are given. So for example
Circle, Light Green, 1, 18, 3
means draw a circle that is light green in a bounding box of size 3cm at position 1cm along and 18cm down from the top left.
Circle Christmas Picture
- Puzzle Sheet: Vector drawing puzzle – Circle Christmas Tree [PDF]
- Solution Sheet: Vector drawing puzzle – Circle Christmas Tree Solution [PDF]
Vector Graphics give you lots of flexibility, if you can do a little bit of maths…not surprisingly called vector maths. The instructions that tell you how to draw a program are just a simple program, but one where you can now change the numbers in consistent ways to get different effects.
Suppose you want to position the whole shape 5cm further across the page. Just add 5 to the first number of every instruction before you start to draw as those numbers give the position across the page to draw.
Perhaps you want to move the whole picture 1cm down the page. Add 1 to the second number of each instruction, as it gives the position down the page to draw.
Finally perhaps you want a drawing twice the size. Just multiply every number in every instruction by 2 before you start to draw. Or perhaps you’ve changed your mind and you want it to be 3 times the size, just multiply by 3 instead. If you only have a small piece of paper, halve the numbers and you will get a picture half the size.
When you draw a picture in a vector drawing package and move the whole thing around or expand or shrink it, that is all it is doing behind the scenes.
Of course the shapes could also be represented by numbers too. Suppose 1 is used to represent a circle, 4 a square and 5 a star. An instruction like
Circle, Blue, 6, 17, 1
would really be stored then as
1, Blue, 6, 17, 1
We can also use numbers for the colours (eg 1 for red, 2 for blue, 3 for yellow, 4 for light green and 5 for dark green). Our above instruction would now be written
1, 2, 6, 17, 1
It would still mean exactly the same thing though (we just need a key to keep track of what the numbers for shapes and colours mean. Once you use numbers to represent the other parts of the instructions like this you can start to manipulate the picture in other interesting ways.
- How would the picture change if we swapped all the shape number 1s for shape number 5s and vice versa?
- How would the picture change if we changed all the colour numbers 1 and 2 to 3?
- How would the picture change if we added 2 to each colour number (wrapping the numbers round so 6 becomes 1, and 7 becomes 2?
- Create your own Christmas tree circle picture, writing out the instructions as you draw it. Then manipulate the numbers to give instructions for a new version.
Puzzles: What is this?
1. Circle, Pink, 5, 2, 10 2. Circle, Pink, 14, 5, 1 3. Circle, Pink, 15, 5, 1 4. Circle, Pink, 16, 5, 1 5. Circle, Pink, 16, 4, 1 6. Circle, Pink, 17, 4, 1 7. Circle, Pink, 2, 2, 5 8. Circle, Pink, 4, 1, 1 9. Circle, Pink, 1, 3, 2 10. Circle, Pink, 7, 11, 1 11. Circle, Pink, 7, 12, 1 12. Circle, Pink, 7, 13, 1 13. Circle, Pink, 12, 11, 1 14. Circle, Pink, 12, 12, 1 15. Circle, Pink, 12, 13, 1 16. Circle, White, 3, 3, 1 17. Circle, Black, 3, 3, 0.5 18. Circle, Black, 3, 6, 0.5
Create Mondrian-inspired abstract art and see how images can be represented by a program that draws them.
Draw Kandinsky-inspired abstract art by following then creating instructions to place shapes linked to vector graphics.
Teaching London Computing is currently working with the Institute of Coding. It was originally funded by the Mayor of London, with further support from the British Computer Society, the Department for Education as a joint project between Queen Mary University of London and King’s College London.