Orthogonal Circles

Geodesics in the hyperbolic plane.

eben.kadile24@gmail.com


Home Art Software Blog Research

The Poincaré Disk Model

The Poincaré disk model is probably my favorite model of hyperbolic geometry. In this model, the entire space is regarded as an open disk in the plane and geodesics (lines) are defined as arcs which are orthogonal to the boundary circle. I made the following interactive doodle of the situation (drag the endpoints of the arcs):

Orthogonal Circles

For this doodle it was necessary to determine the equation of a circle orthogonal to a given circle with two given intersection points. If we have circles given by the equations $$x^2 + y^2 + 2fx + 2gx + c = 0$$ $$x^2 + y^2 + 2f'x + 2g'x + c' = 0$$ Then it is a well-known formula that these circles are orthogonal iff: $$2gg'+2ff'=c+c'$$ In this situation we know $f$, $g$, and $c$, and we desire to find $f'$, $g'$, and $c'$ given two points on the second circle. This basically comes down to a bit of linear algebra and a quadratic equation. The full derivation is rather tedious and fairly uninteresting, so I will not write it here. Instead, in case you ever find yourself in need of doing this exact computation, I will provide you with the necessary GLSL code:

        

            struct Circle {
                vec2 c;
                float r;
            };

            Circle computeOrthoCircle(Circle circle, vec2 p1, vec2 p2) {

                float g = circle.c.x;
                float f = circle.c.y;
                float c = g*g + f*f - circle.r*circle.r;

                mat2 A = -2.0*mat2(p1.x - g, p2.x - g, p1.y - f, p2.y - f);
                vec2 v = vec2(c - p1.x*p1.x - p1.y*p1.y, c - p2.x*p2.x - p2.y*p2.y);
                vec2 center = inverse(A)*v;

                float r = sqrt(-2.0*g*center.x - 2.0*f*center.y + c + center.x*center.x + center.    y*center.y);

                return Circle(center, r);
            }