Base the boundary on tweakable values
This commit is contained in:
@@ -1,11 +1,15 @@
|
|||||||
"""Represent the lines of the arena"""
|
"""Represent the lines of the arena"""
|
||||||
|
|
||||||
|
width = 1500
|
||||||
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
boundary_lines = [
|
boundary_lines = [
|
||||||
[(0,0), (0, 1500)],
|
[(0,0), (0, height)],
|
||||||
[(0, 1500), (1500, 1500)],
|
[(0, height), (width, height)],
|
||||||
[(1500, 1500), (1500, 500)],
|
[(width, height), (width, cutout_height)],
|
||||||
[(1500, 500), (1000, 500)],
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
[(1000, 500), (1000, 0)],
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
[(1000, 0), (0, 0)],
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
"""Represent the lines of the arena"""
|
||||||
|
try:
|
||||||
|
from ulab import numpy as np
|
||||||
|
except ImportError:
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
width = 1500
|
||||||
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
"""Represent the lines of the arena"""
|
|
||||||
try:
|
|
||||||
from ulab import numpy as np
|
|
||||||
except ImportError:
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
|
||||||
height = 1500
|
|
||||||
|
|
||||||
@@ -4,14 +4,17 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|||||||
@@ -4,17 +4,19 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|
||||||
def contains(x, y):
|
def contains(x, y):
|
||||||
"""Return True if the point is inside the arena.
|
"""Return True if the point is inside the arena.
|
||||||
@@ -25,6 +27,6 @@ def contains(x, y):
|
|||||||
or y < 0 or y > height:
|
or y < 0 or y > height:
|
||||||
return False
|
return False
|
||||||
# is it inside the cutout?
|
# is it inside the cutout?
|
||||||
if x > 1000 and y < 500:
|
if x > (width - cutout_width) and y < cutout_height:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -4,17 +4,19 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|
||||||
def contains(x, y):
|
def contains(x, y):
|
||||||
"""Return True if the point is inside the arena.
|
"""Return True if the point is inside the arena.
|
||||||
@@ -25,7 +27,7 @@ def contains(x, y):
|
|||||||
or y < 0 or y > height:
|
or y < 0 or y > height:
|
||||||
return False
|
return False
|
||||||
# is it inside the cutout?
|
# is it inside the cutout?
|
||||||
if x > 1000 and y < 500:
|
if x > (width - cutout_width) and y < cutout_height:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -74,7 +76,7 @@ def make_distance_grid():
|
|||||||
grid = np.zeros((
|
grid = np.zeros((
|
||||||
width // grid_cell_size + 2 * overscan,
|
width // grid_cell_size + 2 * overscan,
|
||||||
height // grid_cell_size + 2 * overscan
|
height // grid_cell_size + 2 * overscan
|
||||||
), dtype=float)
|
), dtype=np.float)
|
||||||
for x in range(grid.shape[0]):
|
for x in range(grid.shape[0]):
|
||||||
column_x = x * grid_cell_size - (overscan * grid_cell_size)
|
column_x = x * grid_cell_size - (overscan * grid_cell_size)
|
||||||
for y in range(grid.shape[1]):
|
for y in range(grid.shape[1]):
|
||||||
|
|||||||
@@ -4,17 +4,19 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
boundary_lines = [
|
|
||||||
[(0,0), (0, 1500)],
|
|
||||||
[(0, 1500), (1500, 1500)],
|
|
||||||
[(1500, 1500), (1500, 500)],
|
|
||||||
[(1500, 500), (1000, 500)],
|
|
||||||
[(1000, 500), (1000, 0)],
|
|
||||||
[(1000, 0), (0, 0)],
|
|
||||||
]
|
|
||||||
|
|
||||||
width = 1500
|
width = 1500
|
||||||
height = 1500
|
height = 1500
|
||||||
|
cutout_width = 500
|
||||||
|
cutout_height = 500
|
||||||
|
|
||||||
|
boundary_lines = [
|
||||||
|
[(0,0), (0, height)],
|
||||||
|
[(0, height), (width, height)],
|
||||||
|
[(width, height), (width, cutout_height)],
|
||||||
|
[(width, cutout_height), (width - cutout_width, cutout_height)],
|
||||||
|
[(width - cutout_width, cutout_height), (width - cutout_width, 0)],
|
||||||
|
[(width - cutout_width, 0), (0, 0)],
|
||||||
|
]
|
||||||
|
|
||||||
def contains(x, y):
|
def contains(x, y):
|
||||||
"""Return True if the point is inside the arena.
|
"""Return True if the point is inside the arena.
|
||||||
@@ -25,7 +27,7 @@ def contains(x, y):
|
|||||||
or y < 0 or y > height:
|
or y < 0 or y > height:
|
||||||
return False
|
return False
|
||||||
# is it inside the cutout?
|
# is it inside the cutout?
|
||||||
if x > 1000 and y < 500:
|
if x > (width - cutout_width) and y < cutout_height:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user