Hover over the menu bar to pick a physics animation.

Light Ray in a Series of Wedges of Various Index of Refraction

Explanation of the Animation

The animation, started by pushing the Start button, shows the positions and speed of a photon's progress as black dots along the computed black ray vectors. The viewer should note that the dots become more widely separated when the index of refraction, `n_i`, is small and closer together when the index of refraction is larger. Why is that?

Parameters of the Index of Refraction Wedges

Supose we have a group of `N` interfaces between media of various index of refraction. The indices of refraction can be saved as an `N+1` length array

`bb M=[n_0,n_1... n_N]`

The angles with respect to the x axis of the interface normals can be stored as a length `N` array

`phi=[phi_0,phi_1,..phi_(N-1)]`

where `phi_i` is the normal between the two index wedges `n_(i-1)` and `n_i`. The unit vectors perpendicular to the interfaces can be expressed as:

`bbp_i={cosphi_ibb x+sinphi_ibby}`

Calculation of Ray Angles and Positions in the Index Wedges

Now, if we want to follow a ray through an array of index wedges, we need to compute both its direction in each wedge as well as the `x,y` location where it enters the wedge. Then a ray is a special type of vector which is defined by its direction, length, and entry point into the wedge. We will name the entry point its root. Now let our initial ray vector be:

`r={v_x:lcospsibbhatx,v_y:lsinpsibbhaty,x_r:x_r,y_r:y_r}`

where `psi` is the ray angle relative to the `x` axis, and `x_r,y_r` are the coordinates of the root of the vector. To obtain the exit angle of the ray from the first interface we can first take the dot product of the ray direction with the normal, `p_0` of the first interface to get the incidence angle, `theta_i`:

`costheta_i=cospsicosphi_1+sinpsisinphi_1`
`theta_i=cos^-1(cospsicosphi_1+sinpsisinphi_1)`
then using an identity for the trig sum we have
`theta_i=psi-phi_1`

so that using Snell's law of refraction to get the exit angle `theta_e`:

`theta_e=sin^-1(n_0/n_1sintheta_i)`
`theta_e=sin^-1(n_0/n_1sin(psi-phi_1))`
The new value of `psi` is the same as the old value but is incremented by the deflection angle, the change in `theta` due to the interface:
`psi'=psi+(theta_e-theta_i)=psi+sin^-1(n_0/n_1sin(psi-phi_1))-(psi-phi_1)`

What is the vector description of the exiting wave's `bbv`? Its description in `xy` coordinates is simply

`bbr_e={v_x:lcospsi'bbhatx,v_y:lsinpsi'bbhaty}`

To obtain the vector length `l` we need to compute the `(x,y)` intersection point of a ray with the next interface. For this we need the slope and root of the ray and the slope and root of the interface line. The slope of the ray `bbr` is simply `m_r=sinpsi/cospsi`. For the interface lines we already have the slope, `m_i`, since we have defined their normal vectors:

`m_i=-cosphi_i/sinphi_i`

Without loss of generality, we can define the roots of the interface vector lines to be

`bbX_i=(x_i,0)`

Then the intersection of the ray `bbr` with the interface `bbX_i` will be given by the expression Then we can apply the matrix results in Appendix 1 to get the `(x,y)` intersection.

`[[y],[x]]=1/(m_r-m_i){[-m_i(y_r-m_rx_r)+m_r(y_i-m_ix_i)],[-(y_r-m_rx_r)+(y_i-m_ix_i)]}`

Appendix 1:Intersections between lines each defined by a point and a slope, m

Written in terms of the intersection point, (x,y) we have:

`y=y_1+m_1(x-x_1)`
`y=y_2+m_2(x-x_2)`

Rewriting this as a matrix times a vector `(x,y)` we have:

`[[1,-m_1],[1,-m_2]][[y],[x]]=[[y_1-m_1x_1],[y_2-m_2x_2]]`

The inverse of the matrix on the left is:

`M^(-1)*M=1/(m_1-m_2)[[-m_2,m_1],[-1,1]][[1,-m_1],[1,-m_2]]= 1/(m_1-m_2)[[m_1-m_2,0],[0,m_1-m_2]]=bb1`

`[[y],[x]]=1/(m_1-m_2)[[-m_2,m_1],[-1,1]][[y_1-m_1x_1],[y_2-m_2x_2]]`

`[[y],[x]]=1/(m_1-m_2){[-m_2(y_1-m_1x_1)+m_1(y_2-m_2x_2)],[-(y_1-m_1x_1)+(y_2-m_2x_2)]}`