Well, the graphics primitives are coming along. The big one is line segment.
I have defined a line segment as a circle “
segment” cut by another circle “
cutter” at right angles. I have two primitives – one to get an “elliptical” segment, one to get a “hyperbolic” segment. Both should work when the two points are inside the unit circle.
These depend on three methods – get a circle in elliptical space, get a circle in hyperbolic space, get a circle that cuts another at right angles.
The first two rely on finding a circle through three points. For the elliptical ones, the points are A, B, and -conj(1/a) and -conj(1/b). If A is on the boundary of the unit circle, I use the image of B as the third point. If both are on the boundary, then you can’t actually construct a unique elliptical circle, so I ignore that case.
The hyperbolic case uses conj(1/a) or conj(1/b) as the third point.
Computation of the cutting circle is as per the previous discussion. Project a,b,and the centre of the circle to 0,1,inf. transform the circle (-5,0) radius .5 by the inverse.
transforming the segment is simply a matter of transforming the circles, which we already know how to do.
To draw the shape, there are several cases.
Circle cut by circle. We find points A and B where they cross. The question is – do we draw the clockwise arc, or the counterclockwise arc? to do this, we look at the handedness of the circles. I think it will depend purely on the handedness of
segment – just imagine the situation where the cutter flips: it makes no difference. This being the case, it also takes care of the circle being cut by a line.
Line cut by a circle. There are two cases, which depend on the sign of the cutter. If the cutter is positive, we draw the segment. If
cutter is negative, we draw two segments from A and B to the edge of the clipping rectangle in opposite directions.
Line cut by a line. Either A or B will be non-infnite. We need to draw a segment from there to the clipping rectangle.
Hmm. So only 4 cases, really. Cool bananas. Have to find out how to get the two intersection points. Hans has a cookbook solution.