co-opt is a web-based application designed to visualize and prototype optical systems. It provides an intuitive interface to manage lens parameters and evaluate optical configurations in the browser.
The goal of co-opt is to make optical design more accessible and collaborative. Unlike traditional proprietary software, co-opt runs entirely in the browser and uses an open data format, making it easy to share and iterate on designs.
One of the core philosophies of co-opt is its "Hackability." All optical systems are handled as simple JSON files. This design choice provides several advantages for engineers:
- Version Control: Since designs are plain text, you can easily track changes and manage your lens configurations using Git.
- Script Integration: You can programmatically generate, modify, or analyze lens data using your favorite languages like Python or JavaScript.
- Portability: Effortlessly share configurations by simply copying the JSON string or sharing a URL.
- Open https://yassan8.github.io/co-opt/ in a web browser.
- Note: If you don't see any data on startup, click the "Clear Cache" button to load the default sample lens data.
- Use the table interface to add, delete, and modify lens parameters (radius, thickness, material, etc.) and visualize the resulting light paths.
This repo publishes the web app via GitHub Pages from the Vite build output (dist/).
- CI build + deploy is defined in
.github/workflows/pages.yml. - Local build:
npm run buildnpm run preview
If you want to run branch creation → commit all files → PR creation → merge in one command:
npm run pr:all
Optional environment variables:
BASE_BRANCH(default:main)BRANCH_NAME(default:chore/all-files-pr-<timestamp>)COMMIT_MESSAGE(default:chore: update all pending files)PR_TITLE/PR_BODYMERGE_METHOD(merge/squash/rebase, default:merge)ALLOW_ADMIN_MERGE(1or0, default:1)
Example:
BASE_BRANCH=main MERGE_METHOD=squash npm run pr:all
- Dynamic Lens Management: Add and delete lens blocks as needed.
- Parameter Control: Modify curvature, thickness, and glass materials via a table interface.
- Ray Tracing Visualization: Visual representation of light paths based on the current lens data.
- Optimization: Includes a basic solver to refine lens parameters.
Contributions are welcome! Whether it's adding more glass data, improving the ray tracing engine, or enhancing the UI, please feel free to:
- Submit a Pull Request.
- Open an Issue for bug reports or feature requests.
- Join the discussion in the GitHub Discussions tab.
This website uses Google Analytics to analyze traffic and improve user experience. Google Analytics uses cookies to collect data anonymously. This data does not identify individual users.
This project is licensed under the MIT License.