use-optics 0.1.0

Optics primitives for spectra, wavelengths, and visible-light boundaries.
Documentation
  • Coverage
  • 73.68%
    14 out of 19 items documented1 out of 10 items with examples
  • Size
  • Source code size: 7.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 419.03 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-optics
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-optics

Small wavelength and spectral helpers for RustUse.

use-optics provides visible-spectrum boundaries, wavelength classification helpers, and a compact SpectralSample value type for lightweight optical calculations.

What this crate provides

Item Purpose
SpectralBand Ultraviolet, visible, and infrared classification
VISIBLE_MIN_NM / MAX_NM Visible-light range constants
classify_wavelength_nm() Wavelength band classification
wavelength_to_frequency_hz() Frequency helper for a wavelength in nanometers
SpectralSample Small wavelength-plus-intensity value type

Installation

[dependencies]
use-optics = "0.1.0"

Example

use use_optics::{is_visible_wavelength_nm, SpectralSample, SpectralBand};

let sample = SpectralSample::new(450.0, 0.8);

assert_eq!(sample.band(), Some(SpectralBand::Visible));
assert!(is_visible_wavelength_nm(sample.wavelength_nm));

Scope

  • Wavelength-first helpers.
  • Small immutable values.
  • No polarization, interference, or rendering pipeline yet.