Computing a reflection

The following figure shows the reflection of a vector about a unit vector normal to a surface.

A ray can be reflected from a surface as follows. Let N_hat be the unit normal to the surface at the reflection point. Let A be a vector toward the source of the incoming ray, and B be the resulting reflected ray.

First resolve A into components parallel and perpendicular to the surface normal:
A = A_par + A_perp where
A_par = (A dot N_hat) N_hat, and
A_perp = A - A_par.

Then B = A_par - A_perp = 2 A_par - A =
2 (A dot N_hat) N_hat - A.

The angle of reflection equals the angle of incidence since
|A_perp| = |-A_perp| and the incident ray, reflected ray, and surface normal are in the same plane since A_perp and -A_perp are on the same line.

In IDL:
B = 2*total(A*N)*N - A
where N is the unit surface normal vector.


Terms

  • Vector Addition
  • Vector Subtraction
  • Product of a Scalar and a Vector
  • Dot Product
  • Length of a Vector
  • Unit Vector
  • Component of a Vector along a Direction
  • Resolving vectors into orthogonal components
  • Surface Normal