0 Members and 1 Guest are viewing this topic.
from math import *N=2000 c1=0 #number of points of the torus1 inside the container1 or the surface if divised by N²c2=0 #number of points of the torus2 inside the container2 or the surface if divised by N²c3=0 #number of points of the hatching area or the surface if divised by N²couple1=0.0 #clockwise torque on the torus1 (from springs) IF all part is attracted by the green linecouple2=0.0 #clockwise torque on the torus2 (from springs) IF all part is attracted by the red linecouple3=0.0 #counterclockwise torque on the torus1 or the torus2 due to the presence of the hatching areaRa=7.0 #inner radius of the toreRb=8.72 #outer radius of the toredx=Ra+Rb #the center of the torus1 is (0,0), the center of the torus2 is (dx,dy)dy=4.92for i in range (0,N) : for j in range (0,N): x=i*(Ra+Rb)/N y=j*dy/N if x**2+y**2>Ra**2 and x**2+y**2<Rb**2 and x>Ra and x<Rb and y>0 and y<dy: c1+=1 couple1+=y*x if (x-dx)**2+(y-dy)**2>Ra**2 and (x-dx)**2+(y-dy)**2<Rb**2 and (x-dx)<-Ra and (x-dx)>-Rb and (y-dy)<0 and (y-dy)>-dy: c2+=1 couple2+=abs(y-dy)*abs(x-dx) if x**2+y**2>Ra**2 and x**2+y**2<Rb**2 and x>Ra and x<Rb and y>0 and y<dy and (x-dx)**2+(y-dy)**2>Ra**2 and (x-dx)**2+(y-dy)**2<Rb**2 and (x-dx)<-Ra and (x-dx)>-Rb and (y-dy)<0 and (y-dy)>-dy: c3+=1 couple3+=y*xprint c1print c2print c3print couple1/N**2print couple2/N**2print couple3/N**2