Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
xc, yc = shape.coord_list[:2]
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
r_list = shape.coord_list[2:]
r1 = max(r_list)
r2 = min(r_list)
f = region_filter.Circle(xc, yc, r1) & ~region_filter.Circle(xc, yc, r2)
elif shape.name == "circle":
xc, yc, r = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f = region_filter.Circle(xc, yc, r)
elif shape.name == "panda":
xc, yc, a1, a2, an, r1, r2, rn = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f1 = region_filter.Circle(xc, yc, r2) & ~region_filter.Circle(xc, yc, r1)
f = f1 & region_filter.AngleRange(xc, yc, a1, a2)
elif shape.name == "pie":
xc, yc, r1, r2, a1, a2 = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f1 = region_filter.Circle(xc, yc, r2) & ~region_filter.Circle(xc, yc, r1)
f = f1 & region_filter.AngleRange(xc, yc, a1, a2)
f = region_filter.Circle(xc, yc, r1) & ~region_filter.Circle(xc, yc, r2)
elif shape.name == "circle":
xc, yc, r = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f = region_filter.Circle(xc, yc, r)
elif shape.name == "panda":
xc, yc, a1, a2, an, r1, r2, rn = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f1 = region_filter.Circle(xc, yc, r2) & ~region_filter.Circle(xc, yc, r1)
f = f1 & region_filter.AngleRange(xc, yc, a1, a2)
elif shape.name == "pie":
xc, yc, r1, r2, a1, a2 = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f1 = region_filter.Circle(xc, yc, r2) & ~region_filter.Circle(xc, yc, r1)
f = f1 & region_filter.AngleRange(xc, yc, a1, a2)
elif shape.name == "epanda":
xc, yc, a1, a2, an, r11, r12, r21, r22, rn, angle = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f1 = region_filter.Ellipse(xc, yc, r21, r22) & ~region_filter.Ellipse(xc, yc, r11, r12)
f = region_filter.Rotated(f1, angle, xc, yc)
else:
w, h = maj_list[0], min_list[0]
f = region_filter.Rotated(region_filter.Ellipse(xc, yc, w, h),
angle, xc, yc)
elif shape.name == "annulus":
xc, yc = shape.coord_list[:2]
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
r_list = shape.coord_list[2:]
r1 = max(r_list)
r2 = min(r_list)
f = region_filter.Circle(xc, yc, r1) & ~region_filter.Circle(xc, yc, r2)
elif shape.name == "circle":
xc, yc, r = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f = region_filter.Circle(xc, yc, r)
elif shape.name == "panda":
xc, yc, a1, a2, an, r1, r2, rn = shape.coord_list
# -1 for change origin to 0,0
xc, yc = xc - origin, yc - origin
f1 = region_filter.Circle(xc, yc, r2) & ~region_filter.Circle(xc, yc, r1)
f = f1 & region_filter.AngleRange(xc, yc, a1, a2)