Tuesday, February 10, 2015

[pusgtxpu] Hexagonalize

Given a rectangular image, tile it in an equilateral triangular lattice, when the underlying tiling infrastructure can only handle rectangular tiles laid orthogonally with the screen.  That is, create a rectangular tile that looks like a triangular tile.  This is not too difficult: pad the image to the right dimensions, then duplicate it in a second row (or column) split in half, swapping left and right.

Harder is if the input image is circular (so create a hexagonal close packing), or already a hexagon.  These are probably specified as a region within a rectangular image.  We probably need to use transparency to compose the tile.

Non-orthogonal angles are possible, but I think only rational slopes.

No comments :