Snells law

Started by
1 comment, last by apatriarca 12 years, 8 months ago
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
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).

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.

This topic is closed to new replies.

Advertisement