Skip to content

Commit

Permalink
Merge pull request #254 from antarctica/bug_waypoint_boundarymesh
Browse files Browse the repository at this point in the history
Bug Fixing - Waypoints on boundary of mesh edge
  • Loading branch information
Ulvetanna authored Feb 22, 2024
2 parents 4d63328 + dd3d00e commit f8d4790
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions polar_route/route_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,14 @@ def _mesh_boundary_polygon(mesh):
'''
Creates a polygon from the mesh boundary
'''
lat_min = mesh['config']['mesh_info']['region']['lat_min']
lat_max = mesh['config']['mesh_info']['region']['lat_max']
long_min = mesh['config']['mesh_info']['region']['long_min']
long_max = mesh['config']['mesh_info']['region']['long_max']

# Defining a tiny value
tiny_value = 1e-10

lat_min = mesh['config']['mesh_info']['region']['lat_min']-tiny_value
lat_max = mesh['config']['mesh_info']['region']['lat_max']+tiny_value
long_min = mesh['config']['mesh_info']['region']['long_min']-tiny_value
long_max = mesh['config']['mesh_info']['region']['long_max']+tiny_value
p1 = Point([long_min, lat_min])
p2 = Point([long_min, lat_max])
p3 = Point([long_max, lat_max])
Expand Down Expand Up @@ -302,6 +306,9 @@ def __init__(self, mesh, config, waypoints, cost_func=NewtonianDistance):
# Only allow waypoints within an existing mesh
assert(point.within(mesh_boundary)), \
f"Waypoint {row['Name']} outside of mesh boundary! {point}"



adjusted_point = _adjust_waypoints(point, self.mesh['cellboxes'])

waypoints_df['Long'][idx] = adjusted_point.x
Expand Down

0 comments on commit f8d4790

Please sign in to comment.