This works by using a complex Fourier Series as an approximation of the drawing.
If you want to find out more about this type of Fourier Series and how this works, here are some good resources:
- Wikipedia; Fourier Series: https://en.wikipedia.org/wiki/Fourier_series
- 3Blue1Brown; "But what is a Fourier series?": https://www.youtube.com/watch?v=r6sGWTCMz2k&ab_channel=3Blue1Brown
- SmarterEveryDay; "What is a Fourier Series?": https://www.youtube.com/watch?v=ds0cmAV-Yek&ab_channel=SmarterEveryDay