First dedicated project for a 2d emulation of laser light physics using mirrors and laser pointers
This project offers multiple realistic features like laser light reflection and color mixing. It can be used to simulate real-life scenarios with accuracy up to an angle of 0.1 degrees.
Due to the nature of this project, being coded heavily using OOP it allows for very easy extensibility and the addition of new features like refraction and lamps can easily be done (future plans)
On running main.py you will be greeted with this screen

The buttons on the bottom left are the available objects you can place on the screen. Pressing these buttons will create an object of that type on the screen. The buttons from left to right are:
In this case, I created a pointer and a mirror on the screen.

To select an object, hold down the select_object key default: S and left-click on an object, This will select the object and create a white outline around it. This means that you can now change the position and behavior of this object.
Clicking again while pressing the select_object key will deselect the currently selected object.
While an object is selected, 3 textboxes with info about the objects will be shown on the top left of the screen.
To precisely set the position or rotation of the selected objects, type in a value in these textboxes and hit Enter, this will change the object's state.
To transform an object, select an object and then hold down the transform_object key default: T and do the following:
- Moving an object
Left-click anywhere on the screen and the selected object will be moved to the current position of the mouse pointer. Holding down the left-click will make the selected object follow the mouse pointer as it moves. - Rotating an object
Use the right and left arrow keys to rotate the selected object. - Enlarging or shrinking an object
Use the up and down arrow keys to rotate the selected objects.
To view the custom options for an object, select the object, hold down the custom_object key default: C, and do the following:
-
Pointers
A slider will appear on the right side of the screen. Clicking on the slider will select the corresponding color. Clicking and dragging on the slider will allow for a precise selection of colors.The color determines the color of the selected laser pointer.
-
Poly Mirror
Blue buttons will be visible, which you can click and drag to move the respective vertices around. Right-clicking on the screen will create a new vertice on the nearest edge to the mouse pointer on the selected polygon.The red dot represents the anchor of the shape, around which the shape will be rotated and moved.
Pressing the green play button at the bottom right will simulate the build, and you can view how the setup works.
The light button on the top right determines whether the 'shaders' are toggled on or off, pressing this button will toggle the 'shader' feature (Bloom).
The pause button on the bottom right will open the build screen.
Pressing the escape key will open the options menu with the following options.
The button next to the "SAVES" button saves the current build.
Pressing the "BACK" option will return you to the build.
Pressing the "SAVES" option will open the saves screen where each available save will be listed.
Clicking on the name of the save will open the corresponding save, and clicking on the dustbin button will delete the corresponding save.
To create a new save, enter the name of the desired save into the textbox (only alphanumerics and _ ) and press the '+' button
This project can be used for solving physics problems based on reflection of light or just to mess around with. This was just a fun project I decided to work on. Any bug reports or suggestions are welcome.








