Square Tree Renderer
Research
Last updated
Research
Last updated
This renderer is responsible for being able to infinitely subdivide a space into equal squares to represent a tree structure. Each square or 'tile' can be mapped back to a set of nodes in the tree. Each pixel in the image can then be coloured according to the set of nodes it belongs to. The branching factor of the tree must be a square number.
The renderer must be able to handle zooming and translating an arbitrary amount while maintaining an accurate representation of the tree within the viewport.
It is not known at present, but ideally the renderer must allow for infinite zooming without loss of precision. It is an objective of this research to know whether it is possible or not.
So, is there a formula / algorithm that exists that can give us the coordinate of the tile given a point.
The above diagram illustrates what happens when we scale our space by the lacunarity. We can now clearly see how we can get our tile coordinate, by multiplying our point by the lacunarity and then flooring the result.
E.g.
So what if we kept going? We have found the first tile, but if we subdivide it again what is the next?
Looking back at our tile coordinate diagram, this step is simple too!
If instead of flooring the point we take the remainder. This then gives us the point relative to the first tile!
The following (JavaScript-esk) pseudocode returns an infinite list of tile points represented by the point P.
E.g. for input P=(0.68,0.28) and L=3 getTilePoints will return:
(2,0)
(0,2)
(0,1)
(1,1)
...
So far we can find all tree nodes that are represented with a point. This point has always been relative to a specific tile.
Given a point in space, find which tree nodes it represents.
In this example and when we divide the space by 2 and 3 we see tiles (1,0) and (2,0) overlap with the point respectively.
Where is the tile coordinate, is the lacunarity and our original point.