mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:22 -04:00
fix bugs in check a position inside the polygon (#701)
* fix bugs in check a position inside the polygon It is possible that the position `(iox, ioy)` to be checked with `iox == min_x`. This will cause a incorrect inside check. * add a boundary condition for gridmap
This commit is contained in:
@@ -194,7 +194,7 @@ class GridMap:
|
||||
min_x, max_x = x[i2], x[i1]
|
||||
else:
|
||||
min_x, max_x = x[i1], x[i2]
|
||||
if not min_x < iox < max_x:
|
||||
if not min_x <= iox < max_x:
|
||||
continue
|
||||
|
||||
tmp1 = (y[i2] - y[i1]) / (x[i2] - x[i1])
|
||||
@@ -226,8 +226,8 @@ class GridMap:
|
||||
|
||||
|
||||
def test_polygon_set():
|
||||
ox = [0.0, 20.0, 50.0, 100.0, 130.0, 40.0]
|
||||
oy = [0.0, -20.0, 0.0, 30.0, 60.0, 80.0]
|
||||
ox = [0.0, 4.35, 20.0, 50.0, 100.0, 130.0, 40.0]
|
||||
oy = [0.0, -4.15, -20.0, 0.0, 30.0, 60.0, 80.0]
|
||||
|
||||
grid_map = GridMap(600, 290, 0.7, 60.0, 30.5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user