I've used http://www.numericjs.com/ to handle basic vector/matrix arithmetic and for numerically solving minimization problems to create constraint-based UIs.
Can you give an overview of how your library is different? Is it just a different set of math tools or is the architecture somehow different? Thanks!
Yeah, numeric.js is awesome and very fast compared to other libraries. Would be interesting to see a comparison in terms of performance between these two.
When you drag and drop the shapes, the drawing changes in non-trivial ways. For example, try dragging a shape deep down in the recursion hierarchy.
In a normal drag-and-drop application, it's fairly easy to compute how to, say, adjust the left/top of a div in response to the mouse movement events. However, with Recursive Drawing, I knew that there were certain properties I'd have to adjust during a drag operation, but because of all the nested transformations, it was tricky to figure out the math of how exactly to adjust them.
So instead, I set up a constraint problem. I know that the exact spot I've mousedown'ed on needs to stay under my mouse no matter what. That's the fundamental constraint of the drag-and-drop gesture. Then I set the properties that I knew I could change (e.g. positions or scaling/rotation of a specific shape) and set them as free variables in an energy minimization function. I solved the problem numerically using numeric.js's uncmin (unconstrained minimization, an algorithm originally written in FORTRAN, I believe).
I probably could have figured out how to do this without numerical methods, but this approach was a god-send when rapid prototyping the interactions.
Another good use of constraint systems for UIs is Ivan Sutherland's Sketchpad. His paper on it is long but really worth at least skimming through if you're interested in developing next-generation UIs!
http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-574.pdf
I also really like Rebecca Fiebrink's Wekinator, which is a framework for making musical instruments from arbitrary inputs. The approach is similar in that she uses numerical methods to solve for the constraints (the training data).
http://wekinator.cs.princeton.edu/
I think there's a lot of potential in constraint-based UIs and for me it's the most compelling reason to have good numerical libraries in javascript.
To hazard a guess, I would say it's setting up min/max/preferred width/height or margins on UI components and then dynamically computing the best way to lay them out at display time or when the window size changes. Java has a GridBagConstraints layout manager class that does something like this, and similar layout management shows up elsewhere. Apple's new AutoLayout is a collection of constraints too.
Can you give an overview of how your library is different? Is it just a different set of math tools or is the architecture somehow different? Thanks!