I am one of the strange few who find out really neat things, hat people use to make money, and make them public knowledge for free. All through my own research. such as my shadow textures.
Now I will give away one of the secrets of aligning textures Mathematically!
First, you must remember that prims in second life have sizes and locations.
First let talk about getting the right repeats per face, first you must already have a texture that you want to align this texture to, preferably on the same plane, though non-planar alignments are possible and follow similar rules.
Since I know you can't wait! Here is the formula:
r2 = r1*(p1/p2)
this will require some explaining... the r's are the repeats per face for a certain texture, r2 is the one you are trying to fine, r1 is the repeats for the one you are aligning it to. The p's are the prim length along the axis of scaling. p1 is the length along the axis of scaling for the original prim, and p2 is the length along the axis of scaling for the second prim you are aligning to match with the first.
If you understood that, then great! Here is where it gets more tricky, it is all well and good to have repeats per face, but that does you nothing if you cannot align the offset right?
I admit I do not yet have that completely figured out, but remember that the location of the offset is based on the size of the repeat in question, but it always places it at the same point within the normal range, so .5 will always center the edge of the center repeat and its neightbor to the right.
o2 = f(?)+o1
I know peopel have this in scripts but sometimes using a script is just not viable and destroys things you have already aligned, especially in really complex builds. So if anyone wants to fill in the f(?) part of the offset please do, I know it has something to do with the distance of the prims from one another along that axis and the size of the texture, but doing anything with just those values produces nothing useful.