Last active
August 26, 2018 03:11
-
-
Save yabberyabber/03951e0aa00f070b452247ad966a9cc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import axes3d | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
import numpy as npfig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d')anchors | |
a = [0,57.735,30] | |
b = [50,-28.868,30] | |
c = [-50,-28.868,30]O = [0,0,0]X = np.arange(c[0],b[0],1) | |
Y = np.arange(b[1],a[1],1)def calc_T(a,b,c,o): | |
A = np.array([[(a[0]-o[0])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[0]-o[0])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[0]-o[0])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)], [(a[1]-o[1])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[1]-o[1])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[1]-o[1])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)], [(a[2]-o[2])/m.sqrt((a[0]-o[0])**2+(a[1]-o[1])**2+(a[2]-o[2])**2),(b[2]-o[2])/m.sqrt((b[0]-o[0])**2+(b[1]-o[1])**2+(b[2]-o[2])**2),(c[2]-o[2])/m.sqrt((c[0]-o[0])**2+(c[1]-o[1])**2+(c[2]-o[2])**2)]]) | |
Ainv = np.linalg.inv(A) | |
T = np.matmul(Ainv,G) | |
return TT = 0 | |
for x in X: | |
o[0] = X[x] | |
for y in Y: | |
o[1] = Y[y] | |
while T < Target_tension: | |
T = calc_A(a,b,c,o) | |
ZX, Y = np.meshgrid(X, Y) | |
Z = X*Yax.plot_surface(X,Y,Z,cmap=cm.coolwarm,rstride=1,cstride=1) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment