Cross products as partially evaluated determinants



The vector cross product in 3D is a very curious construct.

Gibbs found quaternions to be too limiting for his applications, and so he
split their product into two pieces -- the dot product & the cross product:

If p,q are 'vector' quaternions (whose scalar component is zero), then

pq = pxq - p.q

Cross products are a kind of 'incomplete' determinant:

| i  j  k|
|ux uy uz| = uxv
|vx vy vz|

where i, j, k are formal variables to be substituted later to form the
complete 'triple product' via the dot product:

|wx wy wz|
|ux uy uz| = w.(uxv)
|vx vy vz|

But suppose we didn't know (or care) what the _interpretation_ of uxv was;
suppose we only wanted to compute a bunch of 3x3 determinants whose 2nd &
3rd rows were always the constants [ux,uy,uz] and [vx,vy,vz].

Then the computation of these determinants is speeded up by the concept of
cross products, because we've already done most of the work by pre-computing
the determinant minors.  So, in effect, the cross product has acted like a
'cache' for these partially evaluated results.

Since 3x3 determinants compute _signed_ areas, they are extremely useful
in computer graphics to compute whether some point falls 'above' or 'below'
some line segment.

The cross product effectively pre-computes the information from the line
segment so that we can test many other points against this line segment.

This also works for higher dimensions.  We can test whether a point p is
'above' or 'below' the plane determined by the triangle u,v,w with the
following determinant:

|px py pz 1|
|ux uy uz 1|
|vx vy vz 1| = D
|wx wy wz 1|

But we often have to perform this test with a large number of different p's.

This means that if we could _precompute_ the appropriate minors and gather
this information up into a 4D 'vector', we could do each test with a simple
4D dot product.

D =

|uy uz 1|
|vy vz 1| * px -
|wy wz 1|

|ux uz 1|
|vx vz 1| * py +
|wx wz 1|

|ux uy 1|
|vx vy 1| * pz -
|wx wy 1|

|ux uy uz|
|vx vy vz| =
|wx wy wz|

[px,py,pz,1].Dxyz1

where Dxyz1 is the appropriate 4D vector of pre-computed minors.

Note that we don't need to know or care about any interpretation
of this vector, other than that it is an 'incomplete' or 'partially
evaluated' determinant.

Once we have the notion of an 'incomplete' determinant, we can come
up with macro code for incomplete determinants of more general kinds, by
including formal variables for various arbitrary entries in a determinant.

We leave it as an exercise for some CS major to automatically 'compile'
such an incomplete determinant by expanding-by-minors so as to minimize
the number of operations left to be performed once the formal variables
become bound.