# spiral_trough.py z=spiral(x,y) function included below # usage from spiral_trough import spiral import math def spiral(x, y): # spiral trough halfpi = 1.57079 r = math.sqrt(x*x+y*y) if r < 0.001: theta = 0.0 else: theta = math.atan2(y,x) tz = theta/halfpi if tz < 0.0: tz = tz + 4.0 return 0.75*r + math.sin((r+tz)*halfpi) # end spiral