Jump to content
  • Advertisement
Sign in to follow this  
vicer1234

Snells law

This topic is 2539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,
I am trying to implement Snells law as a simulation.
Snells law: Sin A/ Sin B =V1/V2 = n2/n1
Couple of things I am thinking as possible implementation method are:

1) Showing ray of light using LINE.
2) After calculation I am thinking of showing the refraction or reflection by another line. Taking the angle into calculation.

let me know whether the above assumptions are right of doing

Also one major doubt is:
How to calculate the angle when line( Ray of light ) hits at any random surface of the object.

I am using C++ and Opengl for implementation

All suggestions are welcome

Share this post


Link to post
Share on other sites
Advertisement
It is often best to ask how to calculate the sine of the angle, because there may be a direct way to calculate it without calling the sine function on an angle. In particular, if you have the normal of the surface, you can use the cross product (or the perpendicular dot product in 2D) between the normal and the direction of the line (maybe negated - draw a picture to find what vector you need).

Share this post


Link to post
Share on other sites
But you don't really need to calculate the sine of the angle and use that equation. You should probable rewrite the entire equation in "vector form". You can find it on wikipedia.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!