Public Sub DistanceInMeters(Lat1 As Double,Long1 As Double,Alt1 As Int,Lat2 As Double,Long2 As Double,Alt2 As Int) As Double
Dim XYZ1(3) As Double=LocationToPoint(Lat1,Long1,Alt1)
Dim XYZ2(3) As Double=LocationToPoint(Lat2,Long2,Alt2)
Dim dx As Double=XYZ1(0)-XYZ2(0)
Dim dy As Double=XYZ1(1)-XYZ2(1)
Dim dz As Double=XYZ1(2)-XYZ2(2)
Return Sqrt(dx*dx+dy*dy+dz*dz)/1000
End Sub
But with blank is much more readable.
B4X:
Public Sub DistanceInMeters(Lat1 As Double, Long1 As Double, Alt1 As Int, Lat2 As Double, Long2 As Double, Alt2 As Int) As Double
Dim XYZ1(3) As Double = LocationToPoint(Lat1, Long1, Alt1)
Dim XYZ2(3) As Double = LocationToPoint(Lat2, Long2, Alt2)
Dim dx As Double = XYZ1(0) - XYZ2(0)
Dim dy As Double = XYZ1(1) - XYZ2(1)
Dim dz As Double = XYZ1(2) - XYZ2(2)
Return Sqrt (dx*dx + dy*dy + dz*dz) / 1000
End Sub