Published
Edited
May 30, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Link length
len = ({
a: 38,
b: 41.5,
c: 39.3,
d: 40.1,
e: 55.8,
f: 39.4,
g: 36.7,
h: 65.7,
i: 49,
j: 50,
k: 61.9,
l: 7.8,
m: 15
})
Insert cell
Insert cell
Insert cell
points = [O, A, B, C, D, E, F, G]
Insert cell
Insert cell
Insert cell
O = ({
x: 0,
y: 0,
name: "O"
})
Insert cell
// Just rotating around O
A = ({
x: len.m * Math.cos(theta),
y: len.m * Math.sin(theta),
name: "A"
})
Insert cell
// Fixed point
B = ({
x: -len.a,
y: -len.l,
name: "B"
})
Insert cell
Insert cell
Insert cell
AB = Math.sqrt((len.a + A.x)**2 + (len.l + A.y)**2)
Insert cell
thetaAB = Math.atan2(A.y - B.y, A.x - B.x)
Insert cell
C = {
const xc = (AB**2 + len.b**2 - len.j**2) / (2 * AB)
const yc = Math.sqrt(len.b**2 - xc**2)
return {
x: B.x + xc * Math.cos(thetaAB) + yc * Math.cos(thetaAB + Math.PI / 2),
y: B.y + xc * Math.sin(thetaAB) + yc * Math.sin(thetaAB + Math.PI / 2),
name: "C"
}
}
Insert cell
Insert cell
Insert cell
E = {
const xc = (len.b ** 2 + len.d**2 - len.e**2) / (2 * len.b)
const yc = Math.sqrt(len.d**2 - xc**2)
const thetaBC = Math.atan2(C.y - B.y, C.x - B.x)
return {
x: B.x + xc * Math.cos(thetaBC) + yc * Math.cos(thetaBC + Math.PI / 2),
y: B.y + xc * Math.sin(thetaBC) + yc * Math.sin(thetaBC + Math.PI / 2),
name: "E"
}
}
Insert cell
Insert cell
Insert cell
D = {
const xc = (AB**2 + len.c**2 - len.k**2) / (2 * AB)
const yc = Math.sqrt(len.c**2 - xc**2)
return {
x: B.x + xc * Math.cos(thetaAB) + yc * Math.cos(thetaAB - Math.PI / 2),
y: B.y + xc * Math.sin(thetaAB) + yc * Math.sin(thetaAB - Math.PI / 2),
name: "D"
}
}
Insert cell
Insert cell
Insert cell
F = {
const DE = Math.sqrt((D.x - E.x)**2 + (D.y - E.y)**2)
const xc = (DE**2 + len.g**2 - len.f**2) / (2 * DE)
const yc = Math.sqrt(len.g**2 - xc**2)
const thetaDE = Math.atan2(E.y - D.y, E.x - D.x)
return {
x: D.x + xc * Math.cos(thetaDE) + yc * Math.cos(thetaDE + Math.PI / 2),
y: D.y + xc * Math.sin(thetaDE) + yc * Math.sin(thetaDE + Math.PI / 2),
name: "F"
}
}
Insert cell
Insert cell
Insert cell
G = {
const xc = (len.g**2 + len.i**2 - len.h**2) / (2 * len.g)
const yc = Math.sqrt(len.i**2 - xc**2)
const thetaDF = Math.atan2(F.y - D.y, F.x - D.x)
return {
x: D.x + xc * Math.cos(thetaDF) + yc * Math.cos(thetaDF + Math.PI / 2),
y: D.y + xc * Math.sin(thetaDF) + yc * Math.sin(thetaDF + Math.PI / 2),
name: "G"
}
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more