ABSTRACT (original article): Designing mechanical devices, called linkages, that draw a given plane curve has been a topic that interested engineers and mathematicians for hundreds of years, and recently also computer scientists. Already in 1876, Kempe proposed a procedure for solving the problem in full generality, but his constructions tend to be extremely complicated. We provide a novel algorithm that produces much simpler linkages, but works only for parametric curves. Our approach is to transform the problem into a factorization task over some noncommutative algebra. We show how to compute such a factorization, and how to use it to construct a linkage tracing a given curve. CITATION (original article): Matteo Gallet, Christoph Koutschan, Zijia Li, Georg Regensburger, Josef Schicho and Nelly Villamizar, Planar linkages following a prescribed motion, Math. Comp. 86 (2017), 473-506. http://dx.doi.org/10.1090/mcom/3120.
PREPRINT: https://arxiv.org/abs/1502.05623​
PACKAGE HOMEPAGE: http://www.koutschan.de/data/link/

Demo

In[]:=
SetDirectory[NotebookDirectory[]];​​Get["PlanarLinkages.m"];
PlanarLinkages — Copyright © 2015 Christoph Koutschan
​This program comes with absolutely no warranty; it is free software,
and you are welcome to redistribute it and/or modify it under the
terms of the GNU General Public License (http://www.gnu.org/licenses/).

Arithmetic of motion polynomials

Motion polynomials are input using the symbol “eta”.
t+I+eta*(2-I)
(+t)+η·(2-)
When Times is used, eta is always interpreted to be on the left.
{I*eta,eta*I}
{0+η·,0+η·}
To specify the order of factors, use NonCommutativeMultiply.
{I**eta,eta**I}
{0-η·,0+η·}
In the same fashion, motion polynomials can be multiplied.
(t+1-eta)**(t^2+1+2I+eta*I*t)
((1+2)+(1+2)t+
2
t
+
3
t
)+η·((-1-2)+t-(1-)
2
t
)
See how motion polynomials are represented internally.
z+eta*w​​FullForm[%]
z+η·w
MP[z,w]
Check the multiplication of motion polynomials (a+eta*b)*(c+eta*d).
MP[
z
1
,
w
1
]**MP[
z
2
,
w
2
]
z
1
z
2
+η·(Conjugate[
z
1
]
w
2
+
w
1
z
2
)
Invert an element in SE2. Note that real numbers in K correspond to 1 in SE2.
FullSimplify[(z+eta*w)**(Conjugate[z]-eta*w)]
2
Abs[z]
+η·0

Action of
SE
2

?ActR2
ActR2[p, {x, y}] computes the result of applying the direct isometry given by p to the point {x, y}, where p is a (possibly constant) motion polynomial.
Action of SE2.
In[]:=
vec=ActR2[MP[
x
1
+I*
x
2
,
y
1
+I*
y
2
],{x,y}];​​Together[Simplify[vec,Element[{
x
1
,
x
2
,
y
1
,
y
2
},Reals]]]
Out[]=

x
2
x
1
-2y
x
1
x
2
-x
2
x
2
+
x
1
y
1
-
x
2
y
2
2
x
1
+
2
x
2
,
y
2
x
1
+2x
x
1
x
2
-y
2
x
2
+
x
2
y
1
+
x
1
y
2
2
x
1
+
2
x
2

Product in SE2 is bilinear.
In[]:=
prod=ComplexExpand/@(MP[
x
1
+I*
x
2
,
y
1
+I*
y
2
]**MP[
x
1
'+I*
x
2
',
y
1
'+I*
y
2
'])
Out[]=
(
x
1
′
x
1
-
x
2
′
x
2
+(
x
2
′
x
1
+
x
1
′
x
2
))+η·(
y
1
′
x
1
-
y
2
′
x
2
+
x
1
′
y
1
+
x
2
′
y
2
+(
y
2
′
x
1
+
y
1
′
x
2
-
x
2
′
y
1
+
x
1
′
y
2
))
TableForm[Flatten[CoefficientList[List@@prod/.Ii,i]]]
x
1
′
x
1
-
x
2
′
x
2
x
2
′
x
1
+
x
1
′
x
2
y
1
′
x
1
-
y
2
′
x
2
+
x
1
′
y
1
+
x
2
′
y
2
y
2
′
x
1
+
y
1
′
x
2
-
x
2
′
y
1
+
x
1
′
y
2

Fixpoint of a motion

?FixPoint
FixPoint[p] computes the fixpoint of a simple revolution given by the linear normed motion polynomial p, i.e., p is of the form t - z + η*w where z and w are complex numbers with z being non-real.
Compute the fixpoint of a motion.
FixPoint[t+I-eta*0]
{0,0}
FixPoint[t+eta]
Throw::nocatch:Uncaught Throw[FixPoint: Input is not a normed bounded motion polynomial of degree 1.] returned to top level.

Hold[Throw[FixPoint: Input is not a normed bounded motion polynomial of degree 1.]]
Test fixpoint formula.
FixPoint[t-α-eta*β]​​FullSimplify[(First[%]+I*Last[%])-β/(Conjugate[α]-α)]
-
Im[β]
2Im[α]
,
Re[β]
2Im[α]

0

Factorization of motion polynomials

Factor a motion polynomial into linear factors.
FactorMP[(t+I)^6+eta*t]
(+t)+η·
1
32
·(+t)-η·
3
32
·(+t)+η·
1
16
·(+t)+η·
1
16
·(+t)-η·
3
32
·(+t)+η·
1
32
Expand again.
Expand[%]
(-1+6t+15
2
t
-20
3
t
-15
4
t
+6
5
t
+
6
t
)+η·t
Now with factored coefficients.
Factor/@%
6
(+t)
+η·t
Data structure used for representing factored motion polynomials.
FactoredMP[eta,eta,eta]​​Expand[%]
(0+η)·(0+η)·(0+η)
0+η·0
This polynomial admits several factorizations (actually 5! = 120).
In[]:=
FactorMP[poly=Product[t-kI,{k,5}]+eta*(t+I)]
Out[]=
((-+t)+η·0)·(-2+t)-η·

210
·(-3+t)+η·
3
280
·(-4+t)-η·

126
·(-5+t)+η·

504
This is an other factorization using a different order of the roots.
In[]:=
FactorMP[poly,OrderTable[kI,{k,5,1,-1}]]
Throw
:Uncaught Throw[The given zeros must contain all zeros of Z (with multiplicity!).] returned to top level.
Out[]=
Hold[Throw[The given zeros must contain all zeros of Z (with multiplicity!).]]
Here not any permutation of the roots yields a factorization.
In[]:=
poly=(t^2+1)^2*(t+2I)+eta*(t+I)^2;​​FactorMP[poly]​​FactorMP[poly,Order{-I,-I,I,I,-2I}]
Out[]=
(-+t)+η·
5
18
+

1
·(-+t)+η·-
1
6
+

2
·((+t)-η·

2
)·((+t)-η·

1
)·(2+t)-η·
1
9
Throw
:Uncaught Throw[No solution found.] returned to top level.
Out[]=
Hold[Throw[No solution found.]]
Elliptic translational motion.
The polynomial cannot be factored, unless we multiply it by t^2+1.
In[]:=
poly=t^2+1+eta*(a*t-b*I)​​fact=FactorMP[poly]
Out[]=
(1+
2
t
)+η·(-b+at)
FactorMP
::R
:Multiply the input with R = 1+
2
t
​
Out[]=
(+t)+η·
a
2
+
b
2
+

2
·((-+t)-η·

2
)·(-+t)+η·
a
2
-
b
2
+

1
·((+t)-η·

1
)
In[]:=
(*Dothisfactorization"by hand".*)​​ansatz=FactoredMP@@Table[t+(-1)^Ceiling[(k-1)/2]*I+eta*w[k],{k,4}]​​(*Deriveasystemofequations.*)​​Union[CoefficientList[Last[Expand[ansatz]-(t^2+1)*poly],t]]​​(*Testwhetherthecoefficientsoffact[[2]]satisfythesystem.*)​​Expand[%/.w[k_]fact[[k,2]]]
Out[]=
((+t)+η·w[1])·((-+t)+η·w[2])·((-+t)+η·w[3])·((+t)+η·w[4])
Out[]=
{b-w[1]-w[2]+w[3]+w[4],-a+w[1]+w[2]+w[3]+w[4]}
All 6 factorizations of a “random” degree 3 motion polynomial.
Show their linkages.

Animation of a motion

Animation of a simple revolution.
A horizontal translational motion.
A vertical translational motion.

Construction of linkages

Circular translation.
Show different decompositions of this motion depending on the choice of C[1].
Define a linkage by constructing its link graph.
A degree 6 motion polynomial that allows only a single factorization.
A different polynomial that produces basically the same curve.

Example 4.4 from the paper

Check cycle condition (with quick-and-dirty way of inverting P1 and P3).

Example: a simple quadratic motion polynomial

A quadratic motion.
Now factor this quadratic polynomial into linear factors.
Test whether the factorization is correct.
Animation of the factored motion.
Different style of animation.
Compute the second factorization.
Show the corresponding linkage.
Create movie ToyExample.mp4

Example: elliptic translation

We consider the ellipse given by the equation (x+1)^2 + 4*y^2  1.
We use the following parametrization.
This translates into the following motion polynomial, realizing a translational motion along the ellipse.
To factor this motion polynomial, it is multiplied by t^2+1. We obtain a 2-parameter family of factorizations.
This is a factorization with different order of the roots.
Using the first factorization, we can construct a linkage which strongly realizes the translational motion along the ellipse.
Multiplying with t-I from the left also enables us to find a factorization. By doing so we change the motion (it is not any more a translational one). However, the orbit of the origin under this new motion is still the ellipse.
Choose some value for the parameter of this one-dimensional family of factorizations.
Use this factorization to construct a linkage. The second argument is a linear motion polynomial that can be chosen almost randomly. With some experiments, we found this one which gives a nice-looking linkage.
Rename the labels such that they agree with those in the paper.
Define some coloring of the links.
Now the motion produced by the end effector is not any more translational.
Define an order of the links. This produces 5 collisions at t=∞. This is the ordering produced by our code in ConstructLinkage. Also the pen collides only at t=∞.
Here is a different ordering, figured out by hand. It produces only 2 collisions, both at t=∞. Also the pen collides only at t=∞.
In order to build the linkage, compute integral lengths of the links. For each link the positions of the joints connected to it are given, namely their x-coordinates in the initial configuration of the linkage.
Create movie Ellipse.mp4
Create movie Ellipse3D.mp4
Create the picture shown in the paper.
Construct a collision-free linkage using some links of special shape.
Display the collision-free linkage.

Example: John Hancock’s “J”

Our parametrization {x/d, y/d} of Hancock’s J.
Choose values for the free parameters.
Construct the linkage and show the link graph.
Some options for drawing this linkage
2D animation
3D animation using a different style for the links
3D animation with a different ordering of the links
Produce the picture shown in the paper. Use “/200” for the steps in TraceMP.
The speed of the pen is not very uniform.
Use non-constant time steps.
Generate pictures for movie HancockJ.mp4.
If we stack the links according to their labels, we get lots of collisions.
Observe the 2nd and 3rd collision in the animation.
This ordering of the links has only 6 collisions, but the pen is not on top.

CITE THIS NOTEBOOK

Planar linkages following a prescribed motion​
by Christoph Koutschan​
Wolfram Community, STAFF PICKS, April 17 2023
​https://community.wolfram.com/groups/-/m/t/2900251