• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

shalivitalya Apr 7th, 2020 184 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import requests
2. import numpy as np
3. import math
4. URL = 'https://api.arstand-lab.ru'
5. token = 'Token 581314b5dc6db4dd928dc249bf390affbec4df75'
7.
8.
9. def get_faces_npz():
12.     if res.ok:
13.         with open('file.npz', 'wb') as f:
14.             f.write(res.content)
15.         return True
16.     else:
17.         print(res)
18.         return False
19.
20.
21. def post_faces_projections_npz(file_path):
22.     files = {'answer': open(file_path, 'rb')}
25.     if res.ok:
26.         return True
27.     else:
28.         print(res)
29.         return False
30.
31.
32. def getPoint(x,y,z,x1,y1,z1):
33.     t = math.sqrt((x-x1)**2 + (y-y1)**2 + (z-z1)**2)
34.     l = (x1 - x)/t
35.     m = (y1 - y)/t
36.     n = (z1 - z)/t
37.     return -1*z*l/n, -1*z*m/n, 0
38.
39. Points = list()
40. MetaPoints = list()
41. v1 = 0
42. if __name__ == '__main__':
43.     print('GET successful: ', get_faces_npz())
45.     x,y,z = a['projector']
46.     for i in range(len(a['xyz_faces'])):
47.         Points = list()
48.         for y in range(4):
49.             kekes = list()
50.             np.save('example_1', a['xyz_faces'][i][y])
52.             for v in range(len(b)):
53.                 if b[v][2]>0:
54.                     print(b[v][0], b[v][1], b[v][2])
55.                     x1,y1,z1 = getPoint(x,y,z,b[v][0],b[v][1],b[v][2])
56.                     b[v] = x1,y1,z1
57.                 kekes.append(b[v])
58.             Points.append(kekes)
59.         MetaPoints.append(Points)
61.     print('POST successful: ', post_faces_projections_npz('file.npz'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top