Peaucellier's linkage
Author: Chris Sangwin
Date: 23 Dec 2006

This is the first, and best known, linkage which generates an exact straight line.  Move the point C to generate the straight line.  Also, by moving Q, you can generate arcs of very large circle.

O = Intersect(xAxis, yAxis)
l1 = 5
c = Circle(O, l1)
Q = Point(xAxis)
l4 = 2 (slider from -5 to 5, step 0.1)
c2 = Circle(Q, l4)
C = Point(c2)
l2 = 2
c3 = Circle(C, l2)
A = Intersect(c, c3, 2)
B = Intersect(c, c3, 1)
g = 2
c4 = Circle(A, g)
i = 2
c1 = Circle(B, i)
P = Intersect(c4, c1, 1)
j = Segment(O, A)
l = Segment(O, B)
m = Segment(B, C)
n = Segment(C, A)
p = Segment(A, P)
q = Segment(P, B)
r = Segment(C, Q)
loc1 = Locus(P, C)
l3: x(Q) - x(O)
k: sqrt(l1² - l2²)
a: k² l3 / (l3² - l4²)
b: k² l3 / (l3² - l4²)
d: k² l3 / (l3² - l4²)
l5: k² l3 / (l3² - l4²)
l6: k² l4 / (l3² - l4²)
R: (l5, 0)
c5 = Circle(R, abs(l6))