Cleanup helper scripts. Closes #7
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import math
|
||||
|
||||
d2 = 12.9
|
||||
l1 = 85.0
|
||||
l2 = 110.0
|
||||
|
||||
for t1 in range(360):
|
||||
for t2 in range(360):
|
||||
th1 = math.radians(t1)
|
||||
th2 = math.radians(t2)
|
||||
|
||||
e1x = -d2 + l1 * math.cos(th1)
|
||||
e1y = l1 * math.sin(th1)
|
||||
|
||||
e2x = d2 + l1 * math.cos(th2)
|
||||
e2y = l1 * math.sin(th2)
|
||||
|
||||
dx = e2x - e1x
|
||||
dy = e2y - e1y
|
||||
dist = math.sqrt(dx*dx + dy*dy)
|
||||
|
||||
if dist < 1e-6 or dist > 2*l2:
|
||||
continue
|
||||
|
||||
a = dist / 2
|
||||
h2 = l2*l2 - a*a
|
||||
if h2 < 0:
|
||||
h2 = 0
|
||||
h = math.sqrt(h2)
|
||||
|
||||
mx = (e1x + e2x) / 2
|
||||
my = (e1y + e2y) / 2
|
||||
|
||||
px1 = mx + h * (dy / dist)
|
||||
py1 = my + h * (-dx / dist)
|
||||
|
||||
px2 = mx - h * (dy / dist)
|
||||
py2 = my - h * (-dx / dist)
|
||||
|
||||
if py1 >= py2:
|
||||
ex = px1
|
||||
ey = py1
|
||||
else:
|
||||
ex = px2
|
||||
ey = py2
|
||||
|
||||
if abs(ex - 114.4) < 1.0 and abs(ey - 112.7) < 1.0:
|
||||
print(f"Match: t1={t1} t2={t2} -> {ex:.1f}, {ey:.1f}")
|
||||
Reference in New Issue
Block a user