NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 12, 2019, 06:54:32 am

Peaceful solution is always the best solution. ...Wisdom

 Pages: [1]   Go Down
 Author Topic: Light reflected from arbitrary number of mirrors  (Read 17707 times) 0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3084

 « Embed this message on: June 30, 2008, 08:50:50 pm »

-*-

Embed a running copy of this simulation

Embed a running copy link(show simulation in a popuped window)
Full screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
• Please feel free to post your ideas about how to use the simulation for better teaching and learning.
• Post questions to be asked to help students to think, to explore.
• Upload worksheets as attached files to share with more users.
Let's work together. We can help more users understand physics conceptually and enjoy the fun of learning physics!

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?
 mirrorsets_2_20090116182550.gif (10.82 KB, 580x533 - viewed 515 times.) Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3084

 « Embed this message Reply #1 on: February 09, 2009, 02:23:54 pm »

Some one sent me email asked me how to calculate reflected ray?

Please refer to the attached image.
Assume we know the reflect point O, and the incoming vector a (AO) and the vector b (OB).
If only normal vector of b is known, i.e. know the direction but did not know the length.
Length |b| can be calculated with inner product between a and unit vector of b'.
For example: a=(ax,ay), b'=(bx',by'). Then, the length of OB = (ax*bx'+ay*by')/sqrt(bx'*bx'+by'*by');
So you can calculate vector b=(bx,by)=(bx'*OB, by'*OB);
Vector AB=AO+OB=a+b
The out going ray OC=OA+AC =-AO+2*AB=2*(a+b)-a=a+2*b

Bold face represents vector.

 lightreflect.jpg (9.23 KB, 406x332 - viewed 509 times.) Logged
curlygrl200
Newbie

Offline

Posts: 5

 « Embed this message Reply #2 on: October 13, 2010, 11:02:50 am » posted from:Great Neck,New York,United States

Hi Mr. Hwang,

I'm Arabelle, I posted a message for a code on another simulation. I would like the code for this simulation too. I want to experiment how arranging mirrors in specific shapes can create infinite images. I guess the type of Applet I would like to make is a combination of the two I am asking you for the code.
 Logged
Fu-Kwun Hwang
Hero Member

Offline

Posts: 3084

 « Embed this message Reply #3 on: October 13, 2010, 12:29:15 pm » posted from:Taipei,T'ai-pei,Taiwan