Page 1 of 1

Difficulty tiling

Posted: Mon Dec 20, 2021 5:33 pm
by leastaction
Newbie here, really enjoying CF, but I've run into difficulty tiling a shape. I am running v3.2, installed as package contextfree on Linux Mint 20.2. When I include

Code: Select all

CF::Tile = []
in my code I only get one instance of the shape. When I increase the size of the lattice to, for example,

Code: Select all

CF::Tile = [s 5]
for example, I still get only one instance of the shape, but smaller. I tried running the example with the smiley face in the documentation on tiling, with the same result. Thanks for your help!

Re: Difficulty tiling

Posted: Sun Dec 26, 2021 2:54 pm
by MtnViewJohn
When you specify tiling you create an infinite grid of tiling points and your shapes are repeated infinitely many times. But Context Free only renders the rectangle surrounding the tiling grid point at the origin and only draws shapes that intersect this rendered rectangle.

Tiling only produces a noticeable result if a shape overlaps the edge of the tiling grid cell. When the shape extends beyond the edge of its cell then copies in adjacent tiling grid points are also drawn. If the shape fits completely within the cell then you will only see that one shape.

Here is an example of a shape that extends beyond the tiling grid cell:

Code: Select all

CF::Tile = []

startshape SQUARE[s 0.1 5 r 5 a -0.5]
The shape is just one tall, narrow, tilted, translucent rectangle. But the CF::Tile directive causes four additional rectangles to be drawn because four adjacent tiling cells overlap the the central tiling cell that Context Free renders.
tile_example.png (5.67 KiB) Viewed 5055 times
I think the examples on the wiki page don't express this. I should use something other than a simple smiley face.