def ring(inner_radius, outer_radius): def contains(x, y, _): r = np.sqrt(x**2 + y**2) return np.logical_and(inner_radius < r, r < outer_radius) return pb.FreeformShape(contains, width=[2 * outer_radius, 2 * outer_radius])
def sphere(radius): def contains(x, y, z): r = np.sqrt(x**2 + y**2 + z**2) return r < radius return pb.FreeformShape(contains, width=[2 * radius] * 3)
def circle(radius): def contains(x, y, z): return np.sqrt(x**2 + y**2) < radius return pb.FreeformShape(contains, width=[2 * radius, 2 * radius])