Skip to content

Repository files navigation

OpticsLab

CI

A web-based geometric optics simulation built with SceneryStack. Build scenes with light sources, mirrors, lenses, beam splitters, and refracting interfaces.

Features

Four screens (see src/main.ts):

  • Intro — guided entry to the optical bench and component carousel
  • Lab — open-ended scene building with the full standard component set
  • Presets — load curated preset scenes from a combo box, then explore and edit
  • Diffraction — transmission and reflection gratings plus a focused subset of supporting optics

Optical elements and tools (Intro / Lab / Presets unless noted):

  • Ray, parallel-beam, divergent-beam, and point light sources

  • Reflection at linear and curved mirrors; refraction at curved interfaces

  • Ideal lenses and mirrors, spherical lenses, and beam splitters

  • Detectors with live and acquired intensity charts and an Acquire control

  • Gratings (transmission and reflection) on the Diffraction screen

  • Tools panel: grid, ray density, measuring tape, protractor, extended rays, and related view options

  • Undo / redo for add and remove element actions (keyboard shortcuts; see a11y strings)

  • English and French UI, projector color profile, and PWA support

  • Vitest unit tests for core optics model logic

Quick Start

npm install
npm run icons # generate PNG icons from public/icons/icon.svg
npm start # dev server → http://localhost:5173

Scripts

CommandDescription
npm start / npm run devStart Vite dev server
npm run buildType-check + production build → dist/
npm run previewPreview the production build locally
npm run checkTypeScript type check
npm run lintBiome lint check
npm run formatAuto-format all files
npm run fixLint + auto-fix
npm testRun Vitest unit tests
npm run generate-svg-iconGenerate public/icons/icon.svg from optics script
npm run iconsRegenerate PNG icons from public/icons/icon.svg
npm run cleanRemove dist/

Tech Stack

ToolVersionPurpose
SceneryStack^3.0.0Simulation framework
Vite^8Build tool + dev server
TypeScript^7Type-safe JavaScript
Biome^2.5Linting + formatting
vite-plugin-pwa^1PWA + service worker

License

GNU Affero General Public License v3.0 — see OpenPhysics org license.

Contributing

See OpenPhysics contributing guidelines. Report bugs via GitHub Issues; use org issue templates.

About

Web-based geometric optics simulation. Supports ray sources, parallel and divergent beams, mirrors, lenses, beam splitters, and refraction interfaces.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages