PositionUtils

Geographic utility functions for mesh node positions.

Functions

Link copied to clipboard
fun bearing(from: LatLng, to: LatLng): Double

Overload accepting LatLng instances.

fun bearing(lat1: Double, lon1: Double, lat2: Double, lon2: Double): Double

Computes the initial bearing from point 1 to point 2.

Link copied to clipboard

Overload accepting LatLng instances.

fun distance(lat1: Double, lon1: Double, lat2: Double, lon2: Double): Double

Computes the great-circle distance between two points using the Haversine formula.

Link copied to clipboard
fun intToDegrees(positionInt: Int): Double

Converts a protobuf position integer (1e-7 degrees) to a double.

Link copied to clipboard
fun isValidPosition(latitude: Double, longitude: Double): Boolean

Returns true if lat/lng are within valid bounds and not both zero.