clampToLatitudeRange

Convenience function that clamps a latitude value, in radians, to the range [-Math.PI/2, Math.PI/2). Useful for sanitizing data before use in objects requiring correct range.

// Clamp 108 degrees latitude to 90 degrees latitude
const latitude = Math.clampToLatitudeRange(Math.toRadians(108.0));

Return

The latitude value clamped to the range [-Math.PI/2, Math.PI/2).

Parameters

angle

The latitude value, in radians, to clamp to the range [-Math.PI/2, Math.PI/2).

See also