opticalc
Rust utilities for common clinical optics calculations used in optometry and ophthalmic settings.
Features
- Index conversion: Convert measured lens powers between assumed and actual refractive indices.
- Rx conversion: Scale full sphero‑cyl prescriptions between indices while preserving axis.
- Lensmeter simulation: Predict what a lensmeter would read for a true Rx at a different index.
- Induced prism: Compute horizontal/vertical prism from decentration using the full power matrix.
- Crossed cylinders and oblique meridian helpers.
Examples
use *;
// Convert a measured power from 1.523 to 1.586
let true_power = convert_power;
// Convert a full sphero‑cyl Rx between indices
let measured = SpheroCyl ;
let true_rx = convert_rx;
// Simulate what a lensmeter @1.523 would read for a true Rx @1.586
let reading = simulate_lensmeter_reading;
Induced prism from decentration (Prentice’s rule, full toric matrix):
use *;
let lens = SpheroCyl ;
let dec = Decentration ;
let p = induced_prism;
// Access signed or magnitude/base components
let h_signed = p.horizontal.signed;
let v_signed = p.vertical.signed;
let mag = p.magnitude;