Is This Method for Calculating the Direction Vector of a Refracted Ray Accurate?

AI Thread Summary
The discussion centers on the calculation of the direction vector for a refracted ray of light at the interface of two media. The original poster outlines their method, which involves defining unit vectors and applying Snell's law, but expresses uncertainty about ensuring the normal vector consistently aligns with the incident ray in dynamic situations. Respondents suggest that the orientation of the normal vector is arbitrary and does not need to point in the same direction as the incident ray for the calculations to be valid. They recommend simplifying the problem by focusing on unit vectors and refractive indices rather than unknowns. The conversation concludes with a code snippet illustrating a potential implementation for calculating the refracted direction vector.
chyo
Messages
4
Reaction score
0
refraction.gif

Hi all, I would like to know whether my approach of solving for the direction vector of a refracted ray is correct.

1. Problem statement
A ray of light is incident on an interface of two mediums. The incident ray has a unit direction vector v. i and r are the incident and refracted angles, and u is the refracted ray in question. The problem is a dynamic one.

2. Attempted Solution
I first set up a normal unit vector n and another unit vector m which is at right angle to the former as shown in the figure drawn.
Since all the vectors are of unit length, the projection of v on n is (cos i)n. With that I put m = [v - (cos i)n] / |v - (cos i)n| (since m is a unit vector).

So then u = (cos r)n + (sin r)m.

To solve the coefficients, i use cos i = v.n => sin i (by trigo equation using cos i) => sin r (by snell's law) => cos r (again by trigo using sin r)

if this approach is correct, then it works for different cases of refraction too i.e the incident ray could instead be coming from the fourth quadrant and refracted into the second quadrant.

However, the catch is that the normal n must always be defined in the same direction as the incident ray. This is where I stumble; how do i ascertain if my normal is always in the same direction as the incident ray in a dynamic situation? What condition should i check for?

Thanks for reading!
 
Physics news on Phys.org
chyo said:
Hi all, I would like to know whether my approach of solving for the direction vector of a refracted ray is correct.

1. Problem statement
A ray of light is incident on an interface of two mediums. The incident ray has a unit direction vector v. i and r are the incident and refracted angles, and u is the refracted ray in question. The problem is a dynamic one.

I think there has been no response to your post in over 24 hours because it isn't very clear what you are supposed to solve for here. Your problem statement seems to be made up entirely of definitions of symbols. Are you trying to establish a relation between the angles or between the vectors? It doesn't appear that either of these is the case, since you apply Snell's law in your derivation. What is your result supposed to be? What do you mean by a "dynamic situation"?

In a typical development of this relationship, the orientation of the normal vector is arbitrary: it doesn't really matter toward which medium it points or whether it has the same or opposite sense of the incident ray. Usually, the normal vector is just part of the coordinate system you choose.

Could you clarify what the basis of your problem is and what it is you are wishing to derive from that, please?
 
Last edited:
Ahhh ok thank you for your analysis, i'll try to clarify the issue as much as i can.

I think there has been no response to your post in over 24 hours because it isn't very clear what you are supposed to solve for here. Your problem statement seems to be made up entirely of definitions of symbols. Are you trying to establish a relation between the angles or between the vectors? It doesn't appear that either of these is the case, since you apply Snell's law in your derivation. What is your result supposed to be? What do you mean by a "dynamic situation"?
My problem statement is entirely made up of definitions precisely because there are no values given, as yet. What I meant when i said the situation is dynamic is that the values given are changeable with time. I am trying to write a program, where the program will be the one doing the final calculations once the input values are given to the program. So at this point of time I do not know the input values; i am therefore kinda forced to work with arbitrary symbols, of which i had defined rigorously in the first post.

I am trying to find a relationship between the direction vector of a ray of light with the direction vector of its refraction. The only thing I will know is the direction vector of the incident ray, which i will be defining it as v in my program. The program is supposed to spit out the direction vector of the refracted ray, which i had defined as u i nthis case. Basically what I've been doing in my first post was outlining the steps i would incorporate in my program to make it spit out u. So i would actually like to find out if these steps are indeed the correct way to finally get u..

In a typical development of this relationship, the orientation of the normal vector is arbitrary: it doesn't really matter toward which medium it points or whether it has the same or opposite sense of the incident ray. Usually, the normal vector is just part of the coordinate system you choose.

For me to specifically use the equation I've come up with u = (cos r)n + (sin r)m, I would need the normal vector to explicitly point towards the same direction as the incident ray. Otherwise it could instead be u = (cos r)n - (sin r)m, or (sin r)m - (cos r)n. The program will have no idea. I need the normal to point in v so that the program can correctly use the first equation for all different input values.

I hope i am making much more sense here? Thanks for reading.
 
Refraction vector

Although an old post:
1. Avoid talking of unknowns (r is not known). Just write "all vectors assumed unit vectors". Use something like
The incident ray has a unit direction vector v and the relation between the refractive indicies is eta. The refracted direction u is to be found, given v, eta and the normal n.

2. Omitted but note that using length (2-norm) is a horrible idea: It can be omitted (see 3). I didn't find any proofs for my own solution - sorry - but it is correct.

3. Solution will be like following C++-code
n is normal as described in image
v is incident vector
eta = eta1/eta2
eta1 is the refractive index of the medium of v
eta2 is the refractive index of the medium of u

the function returns false if total reflection occurs.

bool refract(const CGLA::Vec3f & n, const CGLA::Vec3f & v,
float eta, CGLA::Vec3f & u)
{
float c1 = dot(v,n);
float c2 = 1.f - eta*eta * (1.f - c1*c1);

if (c2 < 0.f)
return false;

float c3 = std::sqrt(c2);
u = eta*v + (c3 - eta*c1) * n;

return true;
}
 
I picked up this problem from the Schaum's series book titled "College Mathematics" by Ayres/Schmidt. It is a solved problem in the book. But what surprised me was that the solution to this problem was given in one line without any explanation. I could, therefore, not understand how the given one-line solution was reached. The one-line solution in the book says: The equation is ##x \cos{\omega} +y \sin{\omega} - 5 = 0##, ##\omega## being the parameter. From my side, the only thing I could...
Back
Top