无论数组采用哪种形式,每个位置的值都只是对功能值的测试:
import math
def array_val(x, y):
# Compute the function value for the proper angle;
# Compare to the actual radius; return 0 or 1
theta = math.atan(y/x) # Adjust for proper quadrant
r = math.sqrt(x*x + y*y)
return int(r <= (R + a * math.sin(5 * theta)))