MCPcopy Create free account
hub / github.com/comaps/comaps / LonIn180180

Function LonIn180180

libs/ge0/url_generator.cpp:165–173  ·  view source on GitHub ↗

Make lon in [-180, 180)

Source from the content-addressed store, hash-verified

163
164// Make lon in [-180, 180)
165double LonIn180180(double lon)
166{
167 if (lon >= 0)
168 return fmod(lon + 180.0, 360.0) - 180.0;
169
170 // Handle the case of l = -180
171 double const l = fmod(lon - 180.0, 360.0) + 180.0;
172 return l < 180.0 ? l : l - 360.0;
173}
174
175// Map longitude: [-180, 180) -> [0, maxValue]
176int LonToInt(double lon, int maxValue)

Callers 2

LonToIntFunction · 0.85
UNIT_TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

UNIT_TESTFunction · 0.68