Android Code Snippet [B4X] GPS Antipode

This is a simple snippet of code...

B4X:
' Antipodes -Wikipedia: "The Antipode of any spot on Earth is the point on Earth's surface diametrically opposite to it."
'   In other words:  Given a spot on Earth, the Antipode is the spot on the exact opposite side of the world through the center.
'   Given the decimal degrees for Latitude and Longitude of a spot, these two subs will return the Antipode of that spot
'   Use like:     Log(AntipodeLat(-27.683528))   -and-   Log(AntipodeLng(130.078125))

Sub AntipodeLat (Lat As Double) As Double
    Return Lat * -1
End Sub

Sub AntipodeLng (Lng As Double) As Double
    If Lng <= 0 Then
        Return Lng + 180
    Else
        Return Lng - 180
    End If
End Sub
 

Beja

Expert
Licensed User
Longtime User
This is a simple snippet of code...

B4X:
' Antipodes -Wikipedia: "The Antipode of any spot on Earth is the point on Earth's surface diametrically opposite to it."
'   In other words:  Given a spot on Earth, the Antipode is the spot on the exact opposite side of the world through the center.
'   Given the decimal degrees for Latitude and Longitude of a spot, these two subs will return the Antipode of that spot
'   Use like:     Log(AntipodeLat(-27.683528))   -and-   Log(AntipodeLng(130.078125))

Sub AntipodeLat (Lat As Double) As Double
    Return Lat * -1
End Sub

Sub AntipodeLng (Lng As Double) As Double
    If Lng <= 0 Then
        Return Lng + 180
    Else
        Return Lng - 180
    End If
End Sub

The Antopode theoretically must have to coordinates.. You are passing only one. Is the right?
 
Top