- Shubhanshu Agrawal IMT2020078
- Vyom Sharma IMT2020026
Basic idea of the project is to show ray diagrams of refraction through glass slab and prism and give the emergence angle.
We used snell's law to calculate angles and coordinates of rays passing.
In glass slab we traced out the ray diagram and calculate the angle of emergence by taking refractive index as user input.
In prism we traced out ray diagram and calculated angle of emergence and angle of deviation by taking refractive index,incident angle and refractive angle as user input.
- Clone the github repository.
- Run index.html
- Select your desired project
- Prism Refratore:
Insert refractive index,incidence angle and prism angle.
-Glass Slab:
Insert Refractive index and move incident ray by clicking on red circle.
- Front Page
We found a template online and did some change in it.
- Rectangular Slab
We first made a rectangle using drawRect(in canvas.js) and then we fixed one point of incidence ray on it. The other point of the incidence ray can be moved which changes the incident angle. User need to input refractive index in the given box. Then we calulated the general coordinate on the refracted ray (in the slab) which touches the slab. Then we calculted emergent angle and draw a ray of emergence.
We made a default case which have incident angle=60 degrees which will result reflection from first surface and its emergence angle will be 60 degree.
We also tried to cover the reflection or refraction from the right side of rectangular slab.
Also the incidence angle can only vary from 0 to 90 degrees.
Default Page is the set of two lines
User first need to input refractive index,angle of prism and incidence angle. We made a triangle using drawLine(in canvas.js). Then we made a incident line and a normal to the side of a triangle. We used snell's law to calculate angle of refraction and draw the line of refraction. In the end by using coordinate geometry we calculated point of emergence and emergent ray.

Making the incident ray in Glass Slab Refractor to be moved dynamically by the user with the help of mouse.
- There are lot of cases in total internal refraction of Prism and Glass Slab. So we tried to cover as many cases as possible in the given time limit.
- We also have to deal with the co-ordinate system in JS. As we have to calculate the point of intersections of incident rays which is new for us.
Doing this project was great fun. We got to learn some things of a new language. We learnt various aspects of javascript,html and css and how to implement them. We also learnt the concepts of refraction.
