Biq: A Procedural Texture Generator

Biq (pronounced "bike") is a procedural texture generator based on modular bivariate quadratic functions. Modular means that we live in the ring of integers modulo q (for some positive integer q) under the operations of modular multiplication and addition. Bivariate means that we use two variables x and y, which is pretty obvious since we're constructing a 2D texture. Quadratic means that we square things. Of course, if you're math phobic, then you'll just want to mash on the buttons and look at the pretty pictures. There's no shame in that. See http:///larc.unt.edu/ian/research/texturegen/designtool to see it in action, and http:///larc.unt.edu/ian/research/texturegen/ for more information about what it does.
<rant> Who was the bright spark who decided that JavaScript would have only floating point numbers? That's just wrong on so many levels. Here I am, trying to perform computations in the ring of integers modulo q under multiplication and addition, and the JavaScript intepreter gets a harebrained idea that these should be floating point operations. Of course, the logical way to force x to be an integer is by the judicious use of Math.round(x), but it turns out that it's faster to compute x0 instead. The JavaScript interpreter says "Rightho, if you're using a logicalor operation, then x must be an integer" without stopping to optimize out the operation (as we all know, x0 == x). Speed is actually an issue with JavaScript, so you'll have to put up with seeing "something0" here and there in the code. It's asinine, I know, but there is a madness to my method. I also had to optimize the modular bivariate quadratic function pi() for cases that occur most frequently. It makes the code a little more tedious to read, but it's a difference of waiting half a second for a new texture and waiting a tenth of a second. It really is that bad. Programming in JavaScript reminds me of programming 25 years ago before compilers got the hang of code optimization. It's been fun visiting, but I wouldn't like to live there. </rant>
Copyright Ian Parberry, June 2015. This file is made available under the GNU AllPermissive License. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered asis, without any warranty.
Created by Ian Parberry, June 2015. Last updated August 5, 2015.