Some pattern math – regular patterns

| 1 Comment

There are now also various options to generate regular patterns in my pattern generator tool. The difficulty here is that from the map rendering side there is usually the constraint that the pattern has to be square with a size in pixel that equals a power of two. This makes it easily possible for map renderers to render it correctly tiled.

The problem is the most dense regular dot pattern where each point has six closest neighbors forming a hexagon (see above) does not have a square aspect ratio, it is sqrt(3)/2. So a most densely packed regular dot pattern cannot be rendered into a periodic square tile at any size. What you can do and what i did for the pattern generator tool is slightly stretch this grid so it fits into a square tiling. Depending on the size of the pattern compared to the size of the grid the required mismatch varies.

A square grid is of course no problem to fit into a square tile but its density and symmetry are often not what works best. There are other options though – the most interesting one is probably the snub square pattern which fits into a square tile at any scale. Its density is lower than of the triangular pattern where each point has six nearest neighbors but higher than of the square pattern with only four nearest neighbors. Based on the five nearest neightbors it is symbolized by the number ‘5’ in the jsdotpattern interface.

This pattern also does not have such an obvious long range symmetry as the other regular patterns meaning it looks more like the relaxed random patterns.

It can also produce some pretty cool results with some of the regularly shaped symbols:

All pattern images above are linked to the corresponding settings in jsdotpattern. In addition to these features i also added the possibility to set colors for the preview for background and symbols. Try it out or get the code.

One Comment

  1. they re interesting patterns.

Leave a Reply

Required fields are marked *.

By submitting your comment you agree to the privacy policy and agree to the information you provide (except for the email address) to be published on this blog.