elif socket==l.from_socket:
return (l.to_node, l.to_socket)
return (None, None)
+
+def compute_bounding_sphere(points):
+ p1 = max(((p, p.length) for p in points), key=lambda x:x[1])[0]
+ p2 = max(((p, (p-p1).length) for p in points), key=lambda x:x[1])[0]
+ center = (p1+p2)/2
+ radius = (p1-p2).length/2
+ for p in points:
+ d = p-center
+ if d.length>radius:
+ center += d*(1-radius/d.length)/2
+ radius = (radius+d.length)/2
+
+ return center, radius