A Python application that simulates the behavior of light in a void, interacting with various optical objects such as mirrors and lenses.
- Simulates ray tracing and light interactions with optical objects
- Interactive scene manipulation: move, rotate, and zoom objects.
- Easily extendable for new optical components.
| Action | Key / Mouse | Description |
|---|---|---|
| Move item | M |
Press to enable moving mode; press again to disable. |
| Rotate item | R |
Press to enable rotation mode; press again to disable. |
| Zoom in/out | Mouse Scroll | Scroll to zoom the view in or out. |
To add optical objects, modify the main() function in main.py as follows:
Mirror(0, 0, 20, 200, view)- Parameters:
x: X-coordinatey: Y-coordinatewidth: Width of the mirrorheight: Height of the mirrorview: The scene's view object
Len(0, 10, 200, view, -30, 30)- Parameters:
x: X-coordinatey: Y-coordinateheight: Height of the lensview: The scene's view objectleft_radius: Radius of curvature for the left sideright_radius: Radius of curvature for the right sidewidth(optional): Width of the lens (must be equal or greater than sum of absolute values ofleft_radiusandright_radius)
- Install dependencies:
pip install pyqt6 sympy
- Run the application:
python main.py
This code is provided for personal or internal use only. Modification, redistribution, or commercial use is strictly prohibited.