# 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.

## 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 on other sites
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 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.

1. 1
2. 2
Rutin
22
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002278
×