static private double lock(double value) {
        if (value <= -1.633123935319537E16d) return Double.NEGATIVE_INFINITY;  // lock onto -infinity
        if (value >=  1.633123935319537E16d) return Double.POSITIVE_INFINITY;  // lock onto  infinity
        if (value > -Math.PI - EPSILON && value < -Math.PI + EPSILON) return -Math.PI;  // lock onto -pi
        if (value >  Math.PI - EPSILON && value <  Math.PI + EPSILON) return  Math.PI;  // lock onto  pi
        if (value > -Math.E - EPSILON && value < -Math.E + EPSILON) return -Math.E;  // lock onto -e
        if (value >  Math.E - EPSILON && value <  Math.E + EPSILON) return  Math.E;  // lock onto  e
        if (value > -1.0d - EPSILON && value < -1.0d + EPSILON) return -1.0d;  // lock onto -1
        if (value >  1.0d - EPSILON && value <  1.0d + EPSILON) return  1.0d;  // lock onto  1
        if (value <= 1.2246467991473532E-16d && value >= -1.2246467991473532E-16d) return 0.0d;  // lock onto zero
        return value;
    }
static private double lock ( double value ) { if ( value <= - 1.633123935319537E16d ) return Double . NEGATIVE_INFINITY ; if ( value >= 1.633123935319537E16d ) return Double . POSITIVE_INFINITY ; if ( value > - Math . PI - EPSILON && value < - Math . PI + EPSILON ) return - Math . PI ; if ( value > Math . PI - EPSILON && value < Math . PI + EPSILON ) return Math . PI ; if ( value > - Math . E - EPSILON && value < - Math . E + EPSILON ) return - Math . E ; if ( value > Math . E - EPSILON && value < Math . E + EPSILON ) return Math . E ; if ( value > - 1.0d - EPSILON && value < - 1.0d + EPSILON ) return - 1.0d ; if ( value > 1.0d - EPSILON && value < 1.0d + EPSILON ) return 1.0d ; if ( value <= 1.2246467991473532E-16d && value >= - 1.2246467991473532E-16d ) return 0.0d ; return value ; }
/*
This function locks the value of an angle to specific well known angles.