I'm using Asymptote to create some figures illustrating constructions in the disc model of the hyperbolic plane, and I need to be able to transform paths by fractional linear transformations (FLTs), but haven't found any built-in functionality that does what I need.
There are two things I need to be able to do:
- Given two pairs of points (a,b) and (c,d) on the unit circle, find the FLT that maps a to b, c to d, and preserves the unit circle.
- Given an FLT and a path (in particular, an arc representing a geodesic), find the path that is the image of the original path under the FLT.
If there is a pre-existing package that does some or all of this, that would be ideal. If not, the following are the stumbling blocks to my writing an implementation of all of this myself.
- An FLT is determined by a 4-tuple, with scalar multiples of each other determining the same FLT; in particular, Item (1) above can be reduced to finding the kernel of a 4x4 matrix with rank 3. Asymptote includes a routine ("solve") to find the solution of Ax=b when A is non-singular, but I don't know how to use it to solve Ax=0 when A is singular. (This is the main difficulty I'm facing.)
- Once the coefficients determining the FLT are known, transforming points is just a matter of complex multiplication, division, and addition, so I can write a function F that takes as input the FLT's coefficients and the initial points, and gives as output the images of those points. What I really want in Item (2) is a similar function G that operates not on points but on paths. I can probably hack together a way of making the function operate on paths once the points version is available, but it'll take me some digging in the documentation, so if there's a natural (pre-defined?) way to define a function G that acts on paths by transforming all the control points and tangent vectors according to F (and DF), it would of course be better to use that.