def arcball_map_to_sphere(point, center, radius):
 v0 = ((point[0] - center[0]) / radius)
 v1 = ((center[1] - point[1]) / radius)
 n = ((v0 * v0) + (v1 * v1))
 if (n > 1.0):
  n = math.sqrt(n)
  return numpy.array([(v0 / n), (v1 / n), 0.0])
 else:
  return numpy.array([v0, v1, math.sqrt((1.0 - n))])

def arcball_map_to_sphere ( point , center , radius ) : v0 = ( ( point [ 0 ] - center [ 0 ] ) / radius ) v1 = ( ( center [ 1 ] - point [ 1 ] ) / radius ) n = ( ( v0 * v0 ) + ( v1 * v1 ) ) if ( n > 1.0 ) : n = math . sqrt ( n ) return numpy . array ( [ ( v0 / n ) , ( v1 / n ) , 0.0 ] ) else : return numpy . array ( [ v0 , v1 , math . sqrt ( ( 1.0 - n ) ) ] )
return unit sphere coordinates from window coordinates .