Java Double Number Clamp clamp_latitude(double lat)

Here you can find the source of clamp_latitude(double lat)

Description

Ensure value is in the valid range for latitude ([-pi, pi])

License

Open Source License

Parameter

Parameter Description
lat the latitude

Return

normalized latitude

Declaration

public static double clamp_latitude(double lat) 

Method Source Code

//package com.java2s;

public class Main {
    /** //from  w w w . j a  v  a2s .c om
     * Ensure value is in the valid range for latitude ([-pi, pi])
     * @param lat the latitude
     * @return normalized latitude
     */
    public static double clamp_latitude(double lat) {
        if (lat > StrictMath.PI) {
            return StrictMath.PI;
        } else if (lat < -StrictMath.PI) {
            return -StrictMath.PI;
        } else {
            return lat;
        }
    }
}

Related

  1. clamp01(double value)
  2. clamp255d(double d)
  3. clamp_double(double num, double min, double max)
  4. clamp_double(double p_151237_0_, double p_151237_2_, double p_151237_4_)
  5. clamp_doubleback(double a, double x, double y)
  6. clampAngle(double angle)
  7. clampedLerp(double lowerBnd, double upperBnd, double slide)
  8. clampFloat(double in)
  9. clampMax(double val, double max)