-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphysics.py
50 lines (39 loc) · 1.2 KB
/
physics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# for define the parameter we use ths pattern:
# par1[mass,x,y,r,v,a,f]
# par2[mass,x,v,r,v,a,f]
# w1[mass,x,y,r,v,a,f]
# w2[mass,x,y,r,v,a,f]
#and for par1,2 the r is zero
################## start by free fall ############
import numpy as np
import math
par1=[1,2,55,4,0,6,7]
par2=[1,18,56,2,5,6,7]
W1=[5,6,7,1,2,3,4]
W2=[3,4,2,6,7,1,2]
a=min(par1[2],par2[2],W1[2],W2[2])
print min(par1[2],par2[2],W1[2],W2[2])
if a==par1[2] or a==par2[2]:
d=0
#print par1
else :
a=min(par1[2],par2[2],W1[2],W2[2])
print a
print ''
print par1[2]-a
par1[2]=par1[2]-a
par2[2]=par2[2]-a
W1[2]=W1[2]-a+W1[3]
W2[2]=W2[2]-a+W2[3]
#yes...now one of the wheel must be on the ground
print par1
print par2
print W1
print W2
########################### secend compute the evolotion ##############
#while (par1[2]!=0 or par2[2]!=0):
# i=0
fdpar1=(0,math.sqrt(((par1[1]-par2[1])**2)+((par1[2]-par2[2])**2)),math.sqrt(((par1[1]-W1[1])**2)+((par1[2]-W1[2])**2)),math.sqrt(((par1[1]-W2[1])**2)+((par1[2]-W2[2])**2)))
fdpar2=(math.sqrt(((par1[1]-par2[1])**2)+((par1[2]-par2[2])**2)),0,math.sqrt(((par2[1]-W1[1])**2)+((par2[2]-W1[2])**2)),math.sqrt((par2[1]-W2[1])**2+(par2[2]-W2[2])**2))
print fdpar1
print fdpar2