Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
xy_los = np.vstack((x_los,y_los)).T
# Scale darttip
VO = pyclipper.scale_to_clipper(tuple(map(tuple,xy_los)))
# Add scaled VO to clipper
pc.AddPath(VO, pyclipper.PT_CLIP, True)
# For RotA it is possible to ignore
if priocode == "RS6":
if brg_own[j] >= -20. and brg_own[j] <= 110.:
# Head-on or converging from right
pc_rota.AddPath(VO, pyclipper.PT_CLIP, True)
elif brg_other[j] <= -110. or brg_other[j] >= 110.:
# In overtaking position
pc_rota.AddPath(VO, pyclipper.PT_CLIP, True)
# Detect conflicts for smaller layer in RS7 and RS8
if priocode == "RS7" or priocode == "RS8":
if pyclipper.PointInPolygon(pyclipper.scale_to_clipper((gseast[i],gsnorth[i])),VO):
asas.inconf2[i] = True
if priocode == "RS5":
if pyclipper.PointInPolygon(pyclipper.scale_to_clipper((apeast[i],apnorth[i])),VO):
asas.ap_free[i] = False
# Execute clipper command
FRV = pyclipper.scale_from_clipper(pc.Execute(pyclipper.CT_INTERSECTION, pyclipper.PFT_NONZERO, pyclipper.PFT_NONZERO))
ARV = pc.Execute(pyclipper.CT_DIFFERENCE, pyclipper.PFT_NONZERO, pyclipper.PFT_NONZERO)
if not priocode == "RS1" and not priocode == "RS5" and not priocode == "RS7" and not priocode == "RS8":
# Make another clipper object for extra intersections
pc2 = pyclipper.Pyclipper()
# When using RotA clip with pc_rota
if priocode == "RS6":
# Calculate ARV for RotA
def paths_contain(pt, paths):
cnt = 0
pt = pyclipper.scale_to_clipper([pt], SCALING_FACTOR)[0]
for path in paths:
path = pyclipper.scale_to_clipper(path, SCALING_FACTOR)
if pyclipper.PointInPolygon(pt, path):
cnt = 1 - cnt
return cnt % 2 != 0
# Add scaled VO to clipper
pc.AddPath(VO, pyclipper.PT_CLIP, True)
# For RotA it is possible to ignore
if priocode == "RS6":
if brg_own[j] >= -20. and brg_own[j] <= 110.:
# Head-on or converging from right
pc_rota.AddPath(VO, pyclipper.PT_CLIP, True)
elif brg_other[j] <= -110. or brg_other[j] >= 110.:
# In overtaking position
pc_rota.AddPath(VO, pyclipper.PT_CLIP, True)
# Detect conflicts for smaller layer in RS7 and RS8
if priocode == "RS7" or priocode == "RS8":
if pyclipper.PointInPolygon(pyclipper.scale_to_clipper((gseast[i],gsnorth[i])),VO):
asas.inconf2[i] = True
if priocode == "RS5":
if pyclipper.PointInPolygon(pyclipper.scale_to_clipper((apeast[i],apnorth[i])),VO):
asas.ap_free[i] = False
# Execute clipper command
FRV = pyclipper.scale_from_clipper(pc.Execute(pyclipper.CT_INTERSECTION, pyclipper.PFT_NONZERO, pyclipper.PFT_NONZERO))
ARV = pc.Execute(pyclipper.CT_DIFFERENCE, pyclipper.PFT_NONZERO, pyclipper.PFT_NONZERO)
if not priocode == "RS1" and not priocode == "RS5" and not priocode == "RS7" and not priocode == "RS8":
# Make another clipper object for extra intersections
pc2 = pyclipper.Pyclipper()
# When using RotA clip with pc_rota
if priocode == "RS6":
# Calculate ARV for RotA
ARV_rota = pc_rota.Execute(pyclipper.CT_DIFFERENCE, pyclipper.PFT_NONZERO, pyclipper.PFT_NONZERO)
if len(ARV_rota) > 0:
pc2.AddPaths(ARV_rota, pyclipper.PT_CLIP, True)