Skip to content

Commit

Permalink
#43 Updating the documentation in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
tomarnepedersen committed Jan 17, 2025
1 parent 69d451b commit 2e74372
Show file tree
Hide file tree
Showing 8 changed files with 554 additions and 316 deletions.
25 changes: 16 additions & 9 deletions src/trafficgen/check_land_crossing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,38 @@
def path_crosses_land(
position_1: GeoPosition,
speed: float,
course: float,
cog: float,
lat_lon0: GeoPosition,
time_interval: float = 300.0,
) -> bool:
"""
Find if path is crossing land.
Params:
position_1: Ship position in lat/lon [rad].
speed: Ship speed [m/s].
course: Ship course [rad].
lat_lon0: Reference point, latitudinal [rad] and longitudinal [rad].
time_interval: The time interval the vessel should travel without crossing land [sec]
Parameters
----------
position_1 : GeoPosition
Ship position, latitudinal [rad] and longitudinal [rad].
speed : float
Ship speed [m/s].
cog : float
Ship course over ground [rad].
lat_lon0 : GeoPosition
Reference point, latitudinal [rad] and longitudinal [rad].
time_interval : float
The time interval the vessel should travel without crossing land [sec]. Default is 300.0.
Returns
-------
is_on_land: True if parts of the path crosses land.
is_on_land : bool
True if parts of the path crosses land.
"""
num_checks = 10
for i in range(int(time_interval / num_checks)):
position_2 = calculate_position_at_certain_time(
GeoPosition(lat=position_1.lat, lon=position_1.lon),
lat_lon0,
speed,
course,
cog,
i * time_interval / num_checks,
)

Expand Down
Loading

0 comments on commit 2e74372

Please sign in to comment.