Adjusts 90 degree latitude to be lower so that a legal OLC code can be generated.
| 93 | // Adjusts 90 degree latitude to be lower so that a legal OLC code can be |
| 94 | // generated. |
| 95 | double adjust_latitude(double latitude_degrees, size_t code_length) { |
| 96 | latitude_degrees = std::min(90.0, std::max(-90.0, latitude_degrees)); |
| 97 | |
| 98 | if (latitude_degrees < internal::kLatitudeMaxDegrees) { |
| 99 | return latitude_degrees; |
| 100 | } |
| 101 | // Subtract half the code precision to get the latitude into the code |
| 102 | // area. |
| 103 | double precision = compute_precision_for_length(code_length); |
| 104 | return latitude_degrees - precision / 2; |
| 105 | } |
| 106 | |
| 107 | // Remove the separator and padding characters from the code. |
| 108 | std::string clean_code_chars(const std::string &code) { |
no test coverage detected