Published
Edited
Aug 5, 2019
1 fork
2 stars
Theo Jansen's linkage
Animating 4-Bar Linkage
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Length of each link
len = ({
a: 10,
b: 15,
c: 20,
d: 20
})
Insert cell
Insert cell
A = ({x: 0, y: 0})
Insert cell
D = ({x: len.d, y: 0})
Insert cell
Insert cell
Insert cell
B = ({
x: len.a * Math.cos(theta),
y: len.a * Math.sin(theta)
})
Insert cell
Insert cell
Insert cell
Insert cell
C = {
const BD = Math.sqrt(len.a**2 + len.d**2 - 2 * len.a * len.d * Math.cos(theta));
const phi = Math.asin(len.a * Math.sin(theta) / BD);
const psi = Math.acos((len.b**2 + BD**2 - len.c**2) / (2 * len.b * BD));
return {
x: B.x + len.b * Math.cos(psi - phi),
y: B.y + len.b * Math.sin(psi - phi)
}
}
Insert cell
Insert cell
points = [A, B, C, D]
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more