Monday, December 20, 2010

Shapematron!

Right, exciting new knitty programming plan!
One of the harder things to do with a knitting pattern is find out what shape from first principles.
In my first Geometric Knitting colloquium I discussed the relationship between Riemannian metrics and the shape of knitting fabrics, and an algorithm which would take a metric and generate a knitting pattern to yield a surface with that metric. The plan this time is to work in the opposite direction -- to take a pattern and figure out the shape this makes.

The way I want to do this is to model the fabric as a network, each stitch representing a vertex, with connections between it and its neighbours. By modelling the forces acting between stitches it should be fairly easy to make an program which will iterate towards an equilibrium position, which would be the shape the knitting will naturally take. (This position won't be unique,
I think there are two main forces to take into account -- there's a spring-like force between neighbouring stitches, acting along the line between them. Then there's a twisting force acting perpendicular to the surface, which depends on the type of stitch, which makes stocking stitch fabric curl up, and allows ribbed fabric to scrunch together.

So that's the aim, to write a program which will take a knitting pattern, interpret this as a network of points, will work out the shape of the fabric, and display this shape. The last step may well be the hardest one, since I currently have no idea how to do 3D graphics, but I'm hoping this is a standard enough problem that I'll be able to find a good standard way to do that.

Exciting!
Hugh.

No comments: