This is going to be a very straight forward post. Just a list of JavaScript libraries I use in creating my generative art. And I really mean I use (and abuse) them. All of them are used in multiple of my drawings. I'll include couple of photos under the respective libraries.
I finally settled with these libraries after trying several other alternatives for each. Performance was one of the key factors (especially as generative work can get brute-forcy sometimes).
Huge thank you to all people who created and shared these wonderful tools! (Also, as a rule of thumb, when you find a good library, you might want to check author's GitHub profile. In the most cases you are going to find more useful stuff there. That is exactly how I found some of these.)
Categories:
Randomness and noise
seedrandom
In generative programming it is super important to be able to repeat the same output. As randomness is heavily involved, we need a way to repeat random values. That's where seedrandom steps in as an excellent seeded random number generator.
random-words
For random number generator seeds, I like to use real words instead of randomly generated strings. This library is a simple dictionary of couple of thousands english words.
simplex-noise
Fast implementation of Open Simplex noise.
poisson-disk-sampling
When you need a random collections of points in space, Poisson sampling is a great tool. It gives us much more natural distribution than just using random values.
Geometry
js-angusj-clipper
This library is a lifesaver. For all your polygon clipping and offseting needs. And it is super fast as it is implemented in WebAssembly.
voronoi
Sometimes I think I use Voronoi diagrams too much in my work. Anyway, this library efficiently computes Voronoi diagrams.
robust-point-in-polygon
For figuring out if the point is inside of the polygon. I tried a couple of other libraries and all of them would return wrong results in certain edge cases. So far, robust-point-in-polygon
didn't let me down.
simplify-js
Simplifies polyline. Very useful for pen plotting. Sometimes my programs would generate lines with way too many points. This library will reduce the number significantly and human eye often can't see the difference.
isect
Finds all intersections of a given set of line segments.
Vector fields
streamlines
Calculates stream lines for a given vector field.
When I was making Neon I stumbled on this paper. Before even trying to implement it myself, I searched for a good soul who already did it. Luckily I found Andrei's repo.
3D vector line engines
linea
This is my port of Michael Fogleman's ln from Go to TypeScript. It was never fully finished, so you might want to check another port - ln.js. It is complete and has better documentation than my port. Personally, I still use mine as it is easier for me to hack around.
Spatial data structures
When working with spatial data, something that is a trivial problem to a human to see, can be super hard to code. These two libraries make things like searching for nearby elements in space so much easier.
kd-tree-javascript
K-dimensional tree implementation. It is space-partitioning data structure for organizing points in a k-dimensional space.
rbush
2D spatial indexing which uses R-tree.
AxiDraw
saxi
All of my work is plotted using AxiDraw. Saxi is a great little program that lets you control AxiDraw. It comes with a great set of default values for options. Depending on the scenario, it can make plotting a much more pleasant experience than official Inkscape plugin.
Other
mem
Memoization of functions. It means that consecutive function calls with identical input are cached instead of calculated again.
cool-ascii-faces
cause why not? Just kidding. To make navigation through the history easier, for each unique combination of parameters I generate a random color and ASCII face. Then my browser history looks like this: