1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Dynamic refraction vector

  1. Sep 25, 2007 #1
    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!
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Sep 27, 2007 #2


    User Avatar
    Homework Helper

    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: Sep 27, 2007
  4. Sep 27, 2007 #3
    Ahhh ok thank you for your analysis, i'll try to clarify the issue as much as i can.

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

    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.
  5. Mar 17, 2008 #4
    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;
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook