
Geometric illusions using Grids
When working with a lot of geometric shapes or objects of predetermined sizes and positions, it is useful to use a grid to make drawing and positioning easier.
In this recipe, we will recreate a famous geometric illusion: Curry's Missing Square Puzzle, also known as Curry's paradox.
In Curry's paradox, a right triangle is divided into several shapes, and those shapes are then rearranged to again form a right rectangle of seemingly the equal surface, but something doesn't add up!

Where did that extra square come from? We will investigate and solve the mystery in this recipe.
How to do it...
The following recipe will illustrate the use of grids:
- In the Document Properties (Shift + Ctrl + D) under the Grid tab, create a new rectangular grid by hitting the New button. Change the Spacing X: and Spacing Y: from the default 1 to 50 and close the Document Properties dialog:
- Select the Pen tool (Shift + F6 or B) and, on the toolbar, set the Mode: to Create a sequence of straight line segments
and Shape: to None.
- Make sure that Snap to grids
is enabled on the Snapping toolbar, so that when you're moving your mouse over grid intersections, you see snapping tooltips.
- Start drawing the green right rectangle by clicking on the left page border (the grid is aligned with it) on the second major horizontal grid line from top (major grid lines appear thicker) like in the preceding image, the mouse pointer will snap there.
- Move to the right along the horizontal direction counting eight grid intersections. Click there to create the second triangle corner, the pointer will snap to the grid.
- Move straight to the top counting three grid intersections, click there to create the third triangle corner, the pointer will snap to the grid.
- Go back to the first point and click there to close the triangle, set the triangle fill to Lime (#00FF00), stroke to Black, and width to 2.
- Start drawing the smaller right triangle by clicking on the top-right corner of the lime triangle.
- Create the second corner by clicking five grid units to the right.
- Create the third corner by clicking two grid units straight up.
- Finish the triangle by clicking on the first triangle corner, set its fill to Red (#FF0000), stroke to Black, and stroke width to 2.
- Draw the blue L-shaped object by clicking on the point where triangles meet, click again on the bottom-right corner of the red triangle, five more clicks one unit down, three left, one down, two left, and the last one to the starting point to close the shape. Set its fill to Blue (#0000FF), stroke to Black, and stroke width to 2.
- Draw the second L-shaped object to make the complete drawing a right triangle. Start at the bottom-left corner of the blue L-shaped object, then click 2 units right, 1 unit up, 3 units right, 2 units down, 5 units left, and 1 up to close the shape. Set its fill to Yellow (#FFFF00), stroke to Black, and stroke width to 2.
- Select Selector tool (F1 or S). Select all objects in the drawing (Ctrl + A), duplicate the selection (Ctrl + D). Move the selection by clicking on it and dragging downwards, it will snap to the grid.
- Rearrange the duplicated objects; move the red triangle left and down so its left corner aligns with the left corner of the green triangle, move the green triangle so its left corner aligns with the top corner of the red triangle, and finally move the blue shape left and down so it aligns with the red triangle. You will end up with the following figure:

How it works...
If you're wondering about how the illusion works, the hint is in the last step when moving the red triangle over the green one. Have fun figuring it out!
Note
Hint: try zooming on the hypotenuse of the composite shape, with the grid enabled.
Each document in Inkscape can have its own set of grids. When we zoom out, the grid lines become hard to distinguish so Inkscape hides some of them to improve legibility, only leaving the major ones. As we zoom in more, grid line levels appear. It is recommended to set the grid spacing to the minimum unit you want to deal with in your drawing.
As seen in this recipe, grids are normally used with snapping to the grid to speed up the drawing process or arranging objects on the canvas.
There's more...
Our blue object had the same fill hue as grid lines so they seem to disappear over the object. Depending on the predominant colors in the drawing, the grid color can be changed to a color that stands out more. If you think the lines stand out more than necessary, you can reduce their opacity or use the Show dots instead of lines option. Check the Document Properties panel (Shift + Ctrl + D) in the Grid section.
Anti-aliasing and snapping to pixel grid
The Inkscape renderer applies anti-aliasing to object edges which can cause the edges to look blurry. This can be suppressed by snapping to the pixel grid. It is helpful to create two rectangle pixel grids, one with no origin shift and the other one with 0.5 pixel origin shift for both X and Y axes. Changing the second grid color or lines/dots option can help with separating them visually.
To suppress anti-aliasing on horizontal and vertical lines, all stroke widths must be a whole number (integer), the objects without a stroke or with an even-number stroke should be snapped to the grid without origin shift, and the objects with odd-number stroke widths should be snapped to the 0.5 origin shift grid. When exporting, make sure the dpi is set to 90, which is Inkscape default.
Tip
PixelSnap extension
There is an automatic way to snap to the pixel grid with stroke widths considered: PixelSnap extension. Simply select all the objects you want aligned this way and go to Extensions | Modify Path | PixelSnap...
Axonometric grid
To help with creating axonometric drawings, we can use Axonometric grid. When creating a new grid, in the Document Properties, there is an option to choose between rectangular and axonometric grid. The default settings are for isometric grid:

In an additional file accompanying this chapter, you can find another optical illusion example made with a help of the axonometric grid. The file's name is GridAxonometric.svg
and the illusion is the Penrose Triangle illusion; try to recreate it yourself:

Just a couple of hints: you should use the Pen (Bezier) tool and draw three objects.
See also
For more information, refer to Creating a stylized fower using Snapping and Creating a simple fashlight using Guides, that can be found in this chapter.