isohedral / tactile

A C++ library for representing, manipulating, and drawing periodic tilings of the plane.
BSD 3-Clause "New" or "Revised" License
73 stars 9 forks source link

Python bindings? #4

Closed DBraun closed 2 years ago

DBraun commented 2 years ago

I watched your Com 2021 video and read your Escherization paper. The images and animations are amazing! Thank you for sharing tactile, which is such a big part of those works. I think that a nice progression of this library would be to create Python bindings, such as with pybind11. Then all of the wonderful modern optimization or deep learning libraries in Python could try to do Escherization and parquet tilings in different ways. For example, an algorithm could find Escherizations to maximize how much the OpenAI CLIP model thinks an image is penguin-like. It would be like https://es-clip.github.io/ but with tactile instead of rendering transparent triangles. What do you think about python bindings? Thank you!

edit: this is assuming that creating Python bindings would be easier than just recreating in Python. Neither task is trivial of course.

isohedral commented 2 years ago

Thanks, @DBraun, I like the idea of folding something like CLIP into the Escherization process. I'm not convinced it would yield highly Escher-like results, but I expect the results would at least be interesting, as with so much of AI-generated art.

Mind you, I'm not likely to create Python bindings or a Python version of the library myself. I went with the combination of C++ and JS precisely so that there's a reasonable default for running live on the web, and a reference implementation for anyone else who wants to bind to their language of choice. For what it's worth, I think it would be pretty easy to rewrite the JS implementation of the library in Python, and the result would be easier to install and maintain. There's a small set of core classes that would convert over readily, and just about everything else consists of immutable tables of data.

DBraun commented 2 years ago

Hi @isohedral! I implemented a Python port: https://github.com/DBraun/tactile-python

I also made bindings for a Turning Function distance: https://github.com/DBraun/turning-function

Feedback is welcome and thanks again for your libraries and papers!

isohedral commented 2 years ago

Excellent! Thanks for putting all that together. I've linked to your Python bindings from the readmes for Tactile and Tactile-js. If you end up producing some interesting new results based on your Python bindings, I'd be excited to see them.

DBraun commented 2 years ago

Thanks! Yes I'll try my best 😄