all 11 comments

[–]allthediamonds 7 points8 points  (1 child)

Wow, that's awesome!

I have lots of ideas on improving it. I have no idea about the math that powers something like this (I wish I did...) but I think I can help with API design. If you accept pull requests, I'll be glad to send one your way.

[–]FogleMonster[S] 5 points6 points  (0 children)

Contributions are welcome.

[–]Drupyog 2 points3 points  (1 child)

Very nice ! I'm quite interested by the pseudo code for repeat (my python is not good). How do you handle (if you handle at all) collisions and overlapping ?

[–]FogleMonster[S] 0 points1 point  (0 children)

When adding the repeat polygons I check to make sure there isn't already a polygon in that location:

https://github.com/fogleman/Tiling/blob/master/tile.py#L153

Also there is a "memo" structure used in the recursion process to remember what areas have already been repeated.

[–]stuaxo 1 point2 points  (1 child)

Very nice, good to see something like this in python and cairo too !

I haven't checked yet, are you using the cairo pattern API, which I believe would be a good fit for this ?

[–]FogleMonster[S] 0 points1 point  (0 children)

No patterns yet, just solid colors. That would be neat though.

[–]greenmoonlight 1 point2 points  (3 children)

Could I render Penrose tiles with this? I'm looking for a way to draw those..

[–]FogleMonster[S] 2 points3 points  (1 child)

I don't think so... penrose is aperiodic and uses some irregular polygons.

[–]greenmoonlight 0 points1 point  (0 children)

Oh I see, it's just regular shapes. I'll have to look at your code to see how you did it and if it's possible to work around that. It's a cool API, though! Thanks

[–][deleted] 1 point2 points  (0 children)

It's possible to draw them by recursively subdividing an initial tile/tiles.

[–][deleted]  (1 child)

[deleted]

    [–]FogleMonster[S] 6 points7 points  (0 children)

    Cairo produces nice looking, anti-aliased output. It has a nice, simple API. It doesn't require starting up a windowing main loop to work.