Skip to content

feat(optics): add animated ray optics diagrams - #7

Merged
MemerGamer merged 3 commits into
mainfrom
feat/optics
Nov 23, 2026
Merged

MemerGamer merged 3 commits into
mainfrom
feat/optics

Conversation

@MemerGamer

@MemerGamer MemerGamer commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Adds Ray Optics (io.github.animathio.optics), a deterministic ABI 1.1 clip source for animated optics lessons. It includes converging and diverging thin lenses, concave and convex paraxial mirrors, Snell refraction through a slab, a total internal reflection sweep, and wavelength-dependent prism dispersion.

Keyframe progress to reveal rays in propagation order. Solid rays and dashed back-projections distinguish real and virtual images. The README documents the optics conventions and inspector parameters. The bundle includes attribution to Ray Optics Simulation and its Apache-2.0 license.

Rebased on main (Molecule Studio): registry, README table and CI keep both entries, and the Ray Optics smoke now also runs in CI against the released 2.3.0 CLI.

Polish before the 0.1.0 tag

  • tir media labels follow the same convention as refraction (n₁ = incident medium): the slab the ray starts in is n₁ (below the interface) and air is n₂, and the marked critical direction is annotated sin θc = n₂/n₁ → θc = 41.8°.
  • Prism dispersion is now BK7-like: the Cauchy coefficient scales with n − 1 (B = 0.008 µm² · (n − 1), i.e. ≈ 0.004 µm² at n = 1.5), giving a realistic crown-glass spread instead of the previous flint-strength fan, and exactly no dispersion at an index of 1.
  • Magnified conjugates (concave mirror or converging lens with the object between F and 2F, or inside F) shrink the whole construction — focal length, distances and heights together, so magnification and angles are unchanged — until the image arrow and all three principal rays fit the diagram, instead of dropping the image as "beyond frame".

Screenshots

Converging lens Convex mirror Snell refraction
Converging lens with an inverted real image Convex mirror with an upright virtual image Snell refraction through a parallel slab
Above the critical angle Prism dispersion Mirror, object between C and F
Only the reflected ray, with sin θc = n₂/n₁ annotated BK7-like spectrum leaving an equilateral prism Magnified inverted real image fitted to the diagram

Verification

  • 21 Rust unit tests and one doctest passed (new: finite near-F coordinates, signed mirror focal floor, θ₂ / critical-angle label text, dispersion-free index 1). Formatting, native and WebAssembly Clippy -D warnings, and the wasm32-wasip2 package build passed.
  • The released AniMathIO 2.3.0 CLI rendered all five setups at five progress values plus magnified mirror/lens cases. Repeat PNGs matched byte for byte. Smoke coverage includes the keyframed midpoint, 64 spectral rays, and a portrait canvas.
  • Regenerated and reviewed the committed screenshots for ray direction, image placement, media labels, total internal reflection and spectral ordering.
  • scripts/registry.py validate --offline and scripts/dry-run-release.sh community/optics (package + SHA-256 + released-host render + index generation) passed.

🤖 Generated with Claude Code

MemerGamer and others added 2 commits November 23, 2026 09:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed-image fit

Polish before the 0.1.0 tag:

- tir labels n\u2081 as the incident slab medium (the same n\u2081 = incident-medium
  convention as the refraction setup) and states sin \u03b8c = n\u2082/n\u2081 next to
  the marked critical direction
- the prism's Cauchy coefficient scales with n \u2212 1 (B \u2248 0.004 \u00b5m\u00b2 at
  n = 1.5, BK7-like): realistic crown-glass spread and no dispersion at
  an index of 1
- magnified conjugates (object between F and 2F, or inside F) shrink the
  construction so the image arrow and the third ray stay on the diagram
- new unit tests cover finite near-F coordinates, the signed mirror
  focal floor and the \u03b8\u2082 / critical-angle label text; smoke renders the
  magnified mirror and lens cases, and CI runs the optics smoke against
  the released 2.3.0 CLI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MemerGamer
MemerGamer merged commit a83577b into main Nov 23, 2026
2 checks passed
@MemerGamer
MemerGamer deleted the feat/optics branch November 23, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants