[hide][/hide]translate strings in simulation to different language format before download
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
Download EJS jar file(1442kB):double click downloaded file to run it. (15 times by 11 users) , Download EJS source View EJS source
You can use mouse drag and drop to create mirrors (maximum number=36).
The first mouse click will be the starting point for the mirror, drag your mouse and drop it at the place you want.
You can place mirror at any different locations.
(You can drag both end points to change the mirrors later.)
And you can change number of rays (uniform distribution in 360 degree).
I also add an option for light to be bounded at the boundary.
I will leave the rest of work to you! Enjoy it.
Question you might asked: How do I know the light hit the mirror and need to be reflected in the simulation.
The mirror is a segment which is part of a line. Because I know both end points. So the equation for the line is known. for example: equation for mirror from (x1,y1) to (x2,y2) is y-y1= (y2-y1)/(x2-x1) * (x-x1)
Define function f(x,y)= y-y1 - (y2-y1)/(x2-x1) * (x-x1)
if the light is located at (xl,yl), then f(xl,yl) is not equal to zero when light is not reach mirror.
And the value will be either positive or negative, which depend on light is on which side of the mirror.
We can check f(xl,yl) in the simulation, light pass through mirror if the value change sign.
So we can find out the contact point and find out the reflected path.
More calculations are required to calculated the contact point and reflected path. Is there any one want to know how to do the calculation?