Closed tsteven4 closed 1 month ago
How did we do?
usages of RAD: 0 usages of kRadiansPerDegree: 3 all in defs.h references to DEG: 1 in garmin.cc references to kDegreesPerRadian: 4 all in defs.h
I think you've made it much harder (impossible?) to just call these with a couple of doubles where we don't know if they're degrees or radians and that's a great thing.
Its possible, but you have to work at it a bit: https://github.com/GPSBabel/gpsbabel/blob/b099cb4eb1060fbe6fd65fbed0d3ad56f55e2770/waypt.cc#L203-L208
@robertlipe I'm still noodling on this, but feel free to have a look. In addition to automatically converting positions in radians and degrees this also prevents passing lat,lon pairs in the wrong order. There may be lurking TODOs at this point, squawk if you find some.
One potential pitfall related to returning a PositionDeg/PositionRad is that if the caller uses auto then the return type is out of the callers control, and if they dig inside they will get degrees or radians depending on the function definition. OTOH if they assign the returned value to PositionDeg/PositionRad, then they will get that.