Snell Refraction API
Snell's-law refraction optics as an API, computed locally and deterministically. The refraction endpoint applies Snell's law, n1·sin(θ1) = n2·sin(θ2): from the refractive indices of two media (given directly or by material — vacuum, air, water, glass, diamond and more) and the angle of incidence it returns the angle of refraction, or solves for the incidence angle from a refraction angle; when light passes into a less dense medium beyond the critical angle it reports total internal reflection instead of a refracted ray. The critical-angle endpoint gives the threshold for total internal reflection, θc = asin(n2/n1) for n1 > n2 — the principle behind optical fibres — defaulting the exit medium to air. The speed endpoint gives the speed of light in a medium, v = c/n, as a fraction of c, and — with a vacuum wavelength — the shorter wavelength inside the medium (the frequency is unchanged). Angles are in degrees, wavelengths in nanometres. Everything is computed locally and deterministically, so it is instant and private. Ideal for optics and photonics tools, fibre-optic and lens-design apps, photography and physics education, and AR/VR and rendering software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is Snell's-law refraction; for camera depth of field and field of view use a photography API.
api.oanor.com/snell-api