Vector expressions as matrices, using outer products

Reading through Peter Shirley’s graphics blog I found an old post asking about what the outer product means operationally and what value it may have in graphics. This is actually a pretty interesting topic, and I thought I’d try to explain what the outer product means to me and the value I see it having.

So, first we have the inner product (which everyone knows in term of the dot product):

Then there is the perhaps less familiar outer product (not to be confused with the cross product) which looks like so:

Just by playing around a little with pen and paper, experimenting with the simplest possible inner and outer product expressions, you might notice that

Because it is always better to work coordinate-free, we drop the coordinates and express this just in terms of the column vectors a, b, and c giving (aTb)cT = aT(bcT) or, using dot products, (ab)c = aT(bcT). What this means is that whenever we scale a vector (c) with the result of a dot product (ab), we could as well be expressing this as a vector (a) multiplied by the outer product of the other two vectors (bcT).

To see how this can be useful, let’s consider the problem of reflecting a point Q about a plane defined by a unit normal n and a point P on the plane. Some straightforward vector math has it that the new point is given by Q’ = Q - 2((Q - P)⋅n)n. To make things really simple, let’s start with the plane going through the origin, so P = (0, 0, 0), for which the expression becomes Q’ = Q - 2(Q⋅n)n.

Rewriting this expression using the outer product identity above results in Q’ = Q - 2(Q⋅n)n = Q - 2Q(nnT). This can be further simplified by noting that Q = IQ, where I is the identity matrix, giving: Q’ = IQ - 2Q(nnT) = (I - 2(nnT))Q. We can set M = (I - 2(nnT)) and note that Q’ = MQ is now a matrix transform to perform the reflection of Q and that there are no vectors anywhere. That is, outer products (along with the skew-symmetric matrix form of the cross product) allow us to turn vector expressions into matrix expressions!

If P is not the origin, the matrix expression instead becomes:

Q’ =
= Q - 2((Q - P)⋅n)n
= Q - 2(Q - P)(nnT)
= IQ - 2Q(nnT) + 2P(nnT)
= (I - 2(nnT))Q + 2P(nnT)
= MQ + t

The matrix M and the translation t can be put into a single 4×4 matrix N as N = [M t; 0 1]. We can now use N to reflect points in their homogeneous form, [Qx Qy Qz 1]T, about the plane that was given by n and P.

Finally, it may be worth noting that if we drop the constant factor 2 from the expressions above, we have a transformation that projects all points into the plane given by n and P. (Some might recall that such transforms, along with a skew, was once used to create cheesy drop shadows from objects.)

Similar Posts:

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • LinkedIn

Leave a Comment

You must be logged in to post a comment.