Refactoring
This commit is contained in:
@ -1,21 +0,0 @@
|
|||||||
from PIL import ImageDraw
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
|
|
||||||
def are_homotopic(map_array, trajectory, other_trajectory):
|
|
||||||
|
|
||||||
polyline = trajectory.vertices.copy()
|
|
||||||
polyline.extend(reversed(other_trajectory.vertices))
|
|
||||||
|
|
||||||
height, width = map_array.shape
|
|
||||||
|
|
||||||
img = Image.new('L', (height, width), 0)
|
|
||||||
ImageDraw.Draw(img).polygon(polyline, outline=1, fill=1)
|
|
||||||
|
|
||||||
a = (np.array(img) * map_array).sum()
|
|
||||||
if a >= 1:
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
0
objects/__init__.py
Normal file
0
objects/__init__.py
Normal file
Reference in New Issue
Block a user