Online Impossible Figure Builder
This block is a recreation which allows me to continue my journey into impossible geometries, and allows you to create some of them.
Before words
Just remember:
- impossible geometries are optical illusions involving objects that can be drawn in 2D but are infeasible in 3D (i.e., cannot be physically constructed)
- this experimentation deals with impossible geometries that resemble 3D objects that can be constructed out of blocks/cubes under parallel projection; cubes are drawn one after the others, some covering part of others, depending on the order they are drawn
- impossible geometries are so called because they preserve local consistency, but not global consistency. Meaning that parts of the geometry (taken into isolation) look like valid 3D objects, but the overall figure is not a valid 3D object. This is possible with some hacks (see next paragraph).
Where does the magic come from?
In this experimentation, when adding a cube, it automatically expands to the closest ones in each 6 directions (x/-x (right/left), y/-y (bottom left/top right) and z/-z (top left/bottom right)). Expanding means: add intermediate cubes in a straight line between 2 user-defined cubes.
In order to draw impossible geometries, all user-defined cubes and its 6 immediate neighbor cubes (i.e. distant by 1 unit) preserve local consistency: they are drawn so that they form a valid 3D object. But expansions between user-defined cubes introduce global inconsistency: all expansions are drawn behind user-defined cubes, so that the drawing precedence is broken, leading to an impossible geometry.
How expansions works?
- by default, a cube can expand in all 6 directions
- if no distant cube is found for a particular direction, there is no expansion in that direction
- one can produce intricated impossible geometries by limiting the directions a cube could expand to (see below paragraphs dedicated to user interactions)
- if a cube is allowed to expand in a certain direction and there is distant cube in that direction, but that distant cube is not allowed to expand in the direction of the initial cube, there is no expansion between the two cubes
- all the above rules applie only to user-defined cubes and not to automatically added cubes. Expansions exist only between user-defined cubes. There is no expansion between a user-defined cube and an automatically added and already drawn cube
Mouse interactions
- click the grid to add a cube; by default, it is allowed to expand in all 6 directions
- double-click a cube to delete it
- click a cube to select it (it's contour stays in green)
- click a selected cube a second time to deselect it
- the axes on the bottom right of the interface allow you to handle the directions a cube is allowed to expand to:
- the allowed directions appear darker than the disallowed ones
- when hovering a cube, axes informs you about its allowed directions
- when a cube is selected and no cube is hovered, axes inform you about the allowed directions of the selected cube; you can also click an axe to allow/disallow the selected cube to expand to that particular direction
Input text field
The input text field allows you to define a set of cubes via a mini-language:
- directives to add a cube:
- M2,3: move to oblique coordinate (2,3) and add a new cube
- X4: from the last added cube, move in x direction (i.e. to the right) by 4 units, and add a new cube
- X-4: same as above, except in -x direction (i.e. to the left)
- Y4, Y-4, Z4, Z-4: same as X4/X-4 along the adequate axe
- directives to redefine the directions a cube is allowed to expand to:
- Ex: the cube is allowed to expand in the x direction
- E-x: the cube is allowed to expand in the -x direction
- Ey, E-y, Ez, E-z: same as Ex and E-x along the adequate axe
- Ex-x-yz: allow a cube to expand in severall directions
- E (wihtout any direction): the cube is not allowed to expand in any direction
- don't use this directive to let the cube allowed to expand to all the 6 directions
If a particular drawing is appealing to you, you can temporarily store it by clicking the Import geometries from UI link. This will store the currently drawn user-defined cubes into the input text field using the mini-language. For longer storage, you can copy/paste between your favorite text editor and the input text field.
Limitations
- the algortihm fails when cube are too close (distance < 3 grid units).
- it is not easy to define crossing lines that gives the impression that a line is drawn in front of another one. Even if expansions are drawn one after another and may lead to crossing lines, handling the way they are drawn (and hence the way they cross each others) is mesmerizing
Acknowledgments to :
Bibliography
PS
- Scrollytelling the Penrose triangle
- Performance/code enhancement:
- define a Cube class, with appropriate functions/helpers
- use the fact that z-aligned cubes all have the same (y-x) value
- when adding/deleting a cube, don't recompute closests cubes from scratch; reuse what is already computed
- same as above for closest-to-mouse fake cube