astrix.utils module

Utility functions for Astrix.

Should not be imported to core type modules to avoid circular dependencies.

defeature_path(path, tol=50.0)[source]

Defeature a path by removing points that are within tol meters of a straight line between their neighbors. The first and last points are always kept. Useful for plotting.

Parameters:
  • path (Path) – Path The path to defeature.

  • tol (float) – float The tolerance in meters. Points that are within this distance of a straight line between their neighbors will be removed. Default is 50 meters.

Return type:

Path

Returns:

Path

A new path with fewer points.

dist(a, b, backend=None)[source]

Calculate the Euclidean distance between two points.

Return type:

Any

Parameters:
ground_path(path, alt=0.0)[source]

Return a new path with all points at the specified altitude (default 0 m).

Parameters:
  • path (Path) – Path The path to ground.

  • alt (float) – float The altitude in meters. Default is 0 m.

Return type:

Path

Returns:

Path

A new path with all points at the specified altitude.

point_from_heading(start, head, dist, time_new=TimeInvariant object, method='haversine')[source]

Calculate a new point given a start point, heading (degrees) and distance (meters). If point has len > 1, uses the last point.

Note: Applicable for NumPy backend only.

Return type:

Point

Parameters:
  • start (Point)

  • head (float)

  • dist (float)

  • time_new (TimeLike)

  • method (str)