Difficulty tiling

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
leastaction
Posts: 1
Joined: Fri Dec 17, 2021 5:56 pm

Difficulty tiling

Post 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!

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Difficulty tiling

Post 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
tile_example.png (5.67 KiB) Viewed 42420 times
I think the examples on the wiki page don't express this. I should use something other than a simple smiley face.

Post Reply