src/mntGrid.cpp
inline
double fixLongitude(double periodX, double lonBase, double lon) {
    
    double diffLon = lon - lonBase;

    std::vector<double> diffLonMinusZeroPlus{std::abs(diffLon - periodX),
                                             std::abs(diffLon), 
                                             std::abs(diffLon + periodX)};

    std::vector<double>::iterator it = std::min_element(diffLonMinusZeroPlus.begin(), diffLonMinusZeroPlus.end());
    int indexMin = (int) std::distance(diffLonMinusZeroPlus.begin(), it);

    // fix the longitude
    return lon + (indexMin - 1)*periodX;
}
/**
 * Fix the longitude by adding/subtracting a period to reduce the edge distances
 * @param periodX periodicity length in x
 * @param lonBase base/reference longitude
 * @param lon longitude
 * @return corrected longitude
 */
Fix the longitude by adding/subtracting a period to reduce the edge distances
@param periodX periodicity length in x
@param lonBase base/reference longitude
@param lon longitude
@return corrected longitude
Fix the longitude by adding / subtracting a period to reduce the edge distances @param periodX periodicity length in x @param lonBase base / reference longitude @param lon longitude @return corrected longitude
inline
double fixLongitude(double periodX, double lonBase, double lon) {
    double diffLon = lon - lonBase;
    std::vector<double> diffLonMinusZeroPlus{std::abs(diffLon - periodX),
                                             std::abs(diffLon), 
                                             std::abs(diffLon + periodX)};
    std::vector<double>::iterator it = std::min_element(diffLonMinusZeroPlus.begin(), diffLonMinusZeroPlus.end());
    int indexMin = (int) std::distance(diffLonMinusZeroPlus.begin(), it);
    return lon + (indexMin - 1)*periodX;
}
inline double fixLongitude ( double periodX , double lonBase , double lon ) { double diffLon = lon - lonBase ; std :: vector < double > diffLonMinusZeroPlus { std :: abs ( diffLon - periodX ) , std :: abs ( diffLon ) , std :: abs ( diffLon + periodX ) } ; std :: vector < double > :: iterator it = std :: min_element ( diffLonMinusZeroPlus . begin ( ) , diffLonMinusZeroPlus . end ( ) ) ; int indexMin = ( int ) std :: distance ( diffLonMinusZeroPlus . begin ( ) , it ) ; return lon + ( indexMin - 1 ) * periodX ; }
Fix the longitude by adding/subtracting a period to reduce the edge distances
 @param periodX periodicity length in x
 @param lonBase base/reference longitude
 @param lon longitude
 @return corrected longitude
Fix the longitude by adding / subtracting a period to reduce the edge distances @param periodX periodicity length in x @param lonBase base / reference longitude @param lon longitude @return corrected longitude
// fix the longitude