Computational Thread Art
<p>This is a post describing how I created artwork inspired by Petros Vrellis’ pieces (for more detail, see his <a href="https://www.saatchiart.com/vrellis" rel="noopener ugc nofollow" target="_blank">website</a>). I will be focusing largely on the algorithms that I used to generate the threads, rather than the physical implementation (which is done using a bike wheel, clothes hangers, and about 3km of thread!). If you would like to see the original code (and a much fuller description of how it works + how you can generate your own images), please go to my <a href="https://github.com/callummcdougall/computational-thread-art" rel="noopener ugc nofollow" target="_blank">GitHub page</a>.</p>
<p>The original algorithm for rendering the actual image went as follows: first, an image is converted into a square array of greyscale pixel values from 0 to 255, where 0 represents white, and 255 black. The coordinates for the hook positions are calculated. A starting hooks is chosen, and a subset of the lines connecting that hook to other hooks are randomly chosen. Each line is tested by calculating how much it reduces the penalty (which is defined as the average of all the absolute pixel values in the image). A line will change the penalty by reducing the value of all the pixels it goes through by some fixed amount. For instance, a line through a mostly black area might change pixel values from 255 to 155 (reducing penalty a lot), whereas a line through a mostly white area — or an area which already has a lot of lines — might change pixel values from 20 to -80 (actually making the penalty worse). Once all these penalty changes have been calculated, the line which reduces the penalty the most will be chosen, the pixel values will be edited accordingly, and this process will repeat from the new hook. Once a certain number of lines have been drawn, the algorithm terminates.</p>
<p><a href="https://medium.com/@cal.s.mcdougall/computational-thread-art-a9e46ecf34de"><strong>Learn More</strong></a></p>