NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
November 20, 2017, 01:02:06 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Wisdom is to teach our students how to teach themselves. ...Wisdom
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Ray tracing (polygon: range from 3-32 faces)  (Read 14216 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
on: February 19, 2010, 10:06:26 am » posted from:Taipei,T\'ai-pei,Taiwan

Quote
I am enjoying a lot your nice prism simulation. It is really amazing! I wonder if it would be possible to create a simulation with a polygonal prism, for example with 4, 5 or even 6 faces. This would be nice, even if there would be some form restrictions.

The following simulation was created due to above request (Re: Prism: Reflection and refraction)

You can drag the slider to change the number of faces. (N:from 3 to 32, it is similar to a circle when N=32, you will study physics of rainbow)

The intensity was calculated for s-wave.
The subroutine for p-wave is also available in the xml source.
Click show all chekbox to show all the rays with equal intensity. (Maximum number of trace can be changed with right slider 3-20)
If the drag mode is checked, you can drag the whole polygin.
otherwise, you can drag each corner to change the shape of the polygon (with restrictions).

You can dray the arrow to change it's location or direction (depends on where you drag).
It can be drag inside the polygon,too!

un-check the checkbox labeled "check" if you want to created inward type polygon shape.

The following simulation assume the ray will not enter the polygon more than once.

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
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
  • 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!


The range of the X-Y coordinate system is between -100 and 100.
number of points =Please enter correct number of points
The data points should be enter in clockwise direction!
X= enter , separated x coordinate
Y= enter , separated x coordinate
Laser Pointer x=,y=

You are welcomed to check out the following similar/related applets,too!
Dispersion of light with prism ,
Prsim optics (slow motion of light entering a prism) ,
It is fun to play with prism. (light trace and intensity due to refraction)
or Lens (thick lens) and Mirror



* polygonray.gif (2.59 KB, 453x400 - viewed 358 times.)
Logged
liesenbergk
Newbie
*
Offline Offline

Posts: 16


«
Embed this message
Reply #1 on: February 24, 2010, 03:37:13 am » posted from:Itapecerica Da Serra,Sao Paulo,Brazil

Dear Professor,

Thanks again for you gentle efforts. The feature of entering the polygon corners is very convenient and practical.

I guess that I met a bug in the simulation.

I made an internal "triangle cut" into the polygon and the ray is not reflecting at this point as it should. Please see the comparison between a triangle and the concave hexagon as attached.

Could this be solved?

With kind regards!


* hexagon.jpg (10.6 KB, 522x515 - viewed 378 times.)

* triangle.jpg (8.56 KB, 522x515 - viewed 361 times.)
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #2 on: February 24, 2010, 08:37:04 am » posted from:Taipei,T'ai-pei,Taiwan

It will be difficult to solve the problem if we do not have enough information.
Would you please give me the coordinates for those polygons that you have tried?
It will be much easier for me to test it if you can provide me more information.
Logged
liesenbergk
Newbie
*
Offline Offline

Posts: 16


«
Embed this message
Reply #3 on: February 24, 2010, 05:31:09 pm » posted from:Itapecerica Da Serra,Sao Paulo,Brazil

Dear Professor,

One possible data set, among many others, could be:

Refraction index: 1,49
Faces: 6
x: -10,-10,0,10,10,0
y: 0,20,30,20,0,10

I hope this will help.

Thanks a lot again! Regards.
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #4 on: February 24, 2010, 09:54:17 pm » posted from:Taipei,T\'ai-pei,Taiwan

I assumed when the ray enter the polygon, there is only one intersection point.
However, there are three points in your case.
You only told me that you want to extend prism to more faces polygon.
The design of the simulation will be different if you have told me the shap of the polygon earlier.
I need to find time to re-write the code again.
 
Logged
liesenbergk
Newbie
*
Offline Offline

Posts: 16


«
Embed this message
Reply #5 on: February 24, 2010, 10:49:44 pm » posted from:Itapecerica Da Serra,Sao Paulo,Brazil

I'm am sorry for the misunderstanding, Professor.

I hope that you will find time to work on this issue.

Best regards!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #6 on: February 26, 2010, 10:38:01 pm » posted from:Taipei,T\'ai-pei,Taiwan

For the prism simulation,
there are two more rays produced each time the main ray touch the prism boundary.
 One is the reflected ray and another one is the refracted ray.
So I use two array to record and polt the trace for those rays.
The intensity for all the rays are also calculated.
Up to 20 reflection/refraction rays are traced.
The intensity of the reflected ray is less than 5% so it become very weak.
That is why a show all check box is added to show all the traces.

For the case of
The ray enter the prism will create a series of rays.
However, the ray enter the polygon more than once so more sets of rays are needed to trace all possible traces.

Because the simulation also allow user to change number of face for the polygon.
So it is not easy to know how many rays are needed.
It can be done with dynamical allocated memory to solve the problem. However, it is not the way EJS(The tool used to create the simulation) was designed.

I can modify to solved the problem for the above case. However, there might be another bug for another type of problem. It is not easy to design a simulation to fit with too many degree of freedom. I did all this with my spare time.
It will be much easier if we do not need to trace many reflected rays.
Please let me know what you really want to do. What is the purpose of your work so that I can create a simulation better fit with what you need.

Does the following shape is the only case you want to study?

Please let me know what kind of information you are really intereated in.
What is the purpose for the study?

Do you need to calculate up to 20 reflected rays? Do you need to know information for the intensity for each ray? Do you need reflected ray and refracted ray?
Please describe all the possible cases you want to do.

You only ask one more feature at a time. Please let me know all the information and I will try to help.

Logged
liesenbergk
Newbie
*
Offline Offline

Posts: 16


«
Embed this message
Reply #7 on: February 27, 2010, 06:42:17 pm » posted from:Itapecerica Da Serra,Sao Paulo,Brazil

Dear Professor,

Thanks again for your extensive answer.

Unfortunately I cannot tell you in detail at the present time what I have been analyzing and the purpose behind it. I promise you that I will tell you everything and show you further details in the near future at the right time. I am really sorry for this, but I will make it up shortly. I hope that you understand this.

I know that the simulation I have been asking for is tricky and that the resources of the programming tool might not extend to cover these requests.

In this moment the coverage of the hexagon as attached is sufficient for my needs. The reflected and refracted rays are important up to the intensity sum of 80%. Usually these rays do not surpass the amount of 3 or 4 rays. Having their individual intensity would be nice. If the effort to calculate them is very hi, I will understand that you suppress this feature. Beyond 20% of the remaining energy, further rays are not relevant. So, if you could help to debug the attached case I would be more than happy.

Once again, sorry for not answering fully your question in this moment! Embarrassed Embarrassed

Best regards, Professor!


* hexagon.jpg (10.6 KB, 522x515 - viewed 359 times.)
« Last Edit: February 27, 2010, 06:45:07 pm by liesenbergk » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #8 on: February 27, 2010, 11:49:00 pm » posted from:Taipei,T\'ai-pei,Taiwan

The coding of a simulation often depends on the purpose for the simulation.

For glass (index of refraction =1.5), the intensity of reflected ray is roughly 4% of the incoming ray for normal incident.
The reflected ray become important when total reflection occurs (or at angle near that).
The intensity of the reflected/refracted ray also depends on it's polarization.
Are you working with polarized light?
Does the incoming ray is always horizontally or it need to be adjustable?
Do you need slope value for different rays?
.....

For different problem, the best way to solve might be different.
I can understand if you do not want to tell me the purpose of the project.
However, you can at least tell me what kind of information you need to find out from the simulation (The specification for the simulation)!
 It is become difficuit if you keep asking me one more thing at a time (because I might need to change the design of the simulation because of different requirement).
I will try to create another simulation for you. But I can not be sure that it will be what you really need unless I can get more detail information from you! I am waiting for your information/specification for the simulation!-*-
Logged
liesenbergk
Newbie
*
Offline Offline

Posts: 16


«
Embed this message
Reply #9 on: March 01, 2010, 06:08:18 pm » posted from:Itapecerica Da Serra,Sao Paulo,Brazil

Dear Professor,

I will try to be more specific in the data, although I might not have all answers in hands.

The material is acrylic (refraction index ~1.49). The light is mainly polarized and comes from a plane which is located under the optical device. I guess that only s type rays will cover the case properly. In my simulations the rays come from bottom to top and from left to right in an angle which is in the range of roughly 27 degrees in the upper limitation line and 45 degrees in the lower ray limitation line (please see attached graphic). Having slope values for the different rays would be fine, but not essential. The way you indicate it with different colors in the existing model is fine.

What is essential for me is the consideration and calculation the rays in concave faces (see attached graphic, where a simple concave polygon appears with a ray crossing two concave cuts; the ray angles are only as example!  Smiley ).

The maximum incidence of concave areas are two subsequent ones.

So, if you consider the specified light (s), the material used, the origin of the rays from one specific plane and the maximum incidence of concave cuts in the polygon it might be easier for you creating the necessary changes in the simulation.

Please let me know if you need further information or data.

Once again, I am more than grateful for your support and interest! The existing simulation is helping me a lot in my investigations.

Kind regards!


* origin and orientation of input rays.jpg (40.12 KB, 833x466 - viewed 387 times.)

* concave cuts.jpg (17.12 KB, 506x346 - viewed 356 times.)
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #10 on: March 01, 2010, 10:40:23 pm » posted from:Taipei,T'ai-pei,Taiwan

OK! It is much better now. I will try to find time to create a new simulation.
However, I can only do it in my spare time. But I will try to manage it as soon as I can. :-)
Logged
liesenbergk
Newbie
*
Offline Offline

Posts: 16


«
Embed this message
Reply #11 on: March 02, 2010, 05:10:46 pm » posted from:Itapecerica Da Serra,Sao Paulo,Brazil

Thanks, again, dear Professor!
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #12 on: March 08, 2010, 12:19:45 pm » posted from:Taipei,T\'ai-pei,Taiwan

I am sorry that I was very busy last week. However, I managed to finish the coding today.
The default configuration for the following simulation is the same as what you want.
The design of the coding is totally different from the above one.
However, it can be used to simulated many faces polygon,too!
The slider at the top can be used to adjust minimum intensity ray to be drawn/calculated in the simulation.

Please check out Ray tracing for laser light
Logged
jpurrazz
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #13 on: January 12, 2012, 09:22:49 pm » posted from:Tempe,Arizona,United States

I like this simpulation, but I see the exiting refraction angle changes for a horizontal beam going into a right angle prism when the prism is translated horizontally without changing the angles. Physically this doesn't happen. There also some unusual beam reflections and refractions for this condition when the prism is translated vertically and horizontally which don't exist.
It is a very handy illustration when it does work though.
Regards,
Joseph
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #14 on: January 13, 2012, 12:02:05 am » posted from:LONDON,ENGLAND,UNITED KINGDOM

Thank you for the bug report.
However, I could nor figure the problem.
Could you download the jar file and double click the file to run it locally.
Right click and select capture the screen to save a snapshot file when the problem occurs.
Then, upload the image file as attachment.

I will try to fix the problem if I know what might went wrong. Grin
 
Logged
Pages: [1]   Go Up
  Print  
Wisdom is to teach our students how to teach themselves. ...Wisdom
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Ray tracing for laser light
Optics
Fu-Kwun Hwang 20 18750 Last post April 01, 2010, 06:05:15 am
by Fu-Kwun Hwang
Ray tracing (polygon: range from 3-32 faces)
optics
ahmedelshfie 1 4148 Last post April 26, 2010, 06:31:13 pm
by ahmedelshfie
how to create a polygon angle in 3D view?
Questions related to EJS
lookang 2 4287 Last post February 14, 2011, 08:37:06 pm
by lookang
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.062 seconds with 22 queries.since 2011/06/15