opticalc 0.1.0

Utility functions and types for common clinical optics calculations used in optometry and ophthalmic settings.
Documentation
  • Coverage
  • 100%
    42 out of 42 items documented12 out of 23 items with examples
  • Size
  • Source code size: 42.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.84 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ocudigital/opticalc
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • phayes

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 opticalc::*;

// Convert a measured power from 1.523 to 1.586
let true_power = convert_power(-4.463, 1.523, 1.586);

// Convert a full sphero‑cyl Rx between indices
let measured = SpheroCyl { sphere: -2.00, cylinder: -1.00, axis_deg: 180.0 };
let true_rx = convert_rx(measured, 1.523, 1.586);

// Simulate what a lensmeter @1.523 would read for a true Rx @1.586
let reading = simulate_lensmeter_reading(true_rx, 1.523, 1.586);

Induced prism from decentration (Prentice’s rule, full toric matrix):

use opticalc::*;

let lens = SpheroCyl { sphere: 2.0, cylinder: -1.0, axis_deg: 25.0 };
let dec = Decentration { horizontal_mm: 2.0, vertical_mm: -1.0 };
let p = induced_prism(Eye::OD, lens, dec);

// Access signed or magnitude/base components
let h_signed = p.horizontal.signed();
let v_signed = p.vertical.signed();
let mag = p.magnitude();