Calculating the union of 2 longitudal intervals (that may wrap around 180 degrees)
- by timpatt
The story:
I have a LatLongBounds class that represents an area on the surface of the earth by a latitudinal interval (bounded by north & south - not important to this question) and a longitudinal interval (bounded by east and west; both normalized to a range [-180, 180] - negative being a westerly direction).
In order to be able to represent an area that straddles the 180 degree meridian the value of west may be set to be greater than east (eg. the range west = 170, east = -170 will straddle said meridian). In effect the longitudinal interval may wrap around at 180 degrees (or equivalently -180 degrees).
My Question:
Does anyone have any suggestions as to how I can calculate the union of two longitudinal intervals that may wrap around at 180 degrees.
Thanks.