[sci.math] Can You Transform Quadric Surfaces With 4x4 Matrices?

ph@pixar.UUCP (01/31/87)

Represent the point (x,y,z) by the homogeneous row vector P = [x, y, z, 1]
and plane (or normal vector) ax+by+cz+d=0 by column vector N = [a, b, c, d]^t,
where M^t means transpose of matrix M.  The equation P*N=0 (where '*' denotes
matrix multiplication) determines all the planes N passing through point P, or
all the points P which lie on plane N.  Note the duality of points and planes.

Represent the quadric surface axx+bxy+cxz+dx+eyy+fyz+gy+hzz+iz+j=0 by the matrix

	[  a  b/2 c/2 d/2 ]
   Q =	[ b/2  e  f/2 g/2 ]
	[ c/2 f/2  h  i/2 ]
	[ d/2 g/2 i/2  j  ]

Points on the quadric surface satisfy P*Q*P^t=0 (substitute P and Q above
to check) and planes tangent to the surface satisfy N^t*Q^-1*N=0,
where M^-1 means matrix inverse or adjoint.  Note the duality once again.

If T is a 4x4 transformation matrix (perspective, rotation, scaling,
translation, etc) then to transform point P by T:  P' = P*T and
to transform plane N by T:  N' = T*N, where M*N is matrix multiplication.
To transform a quadric:  Q' = T^-1*Q*T^-1^t.  You can substitute the
expressions above into P'*Q'*P'^t=0 to check that it works.
A non-intuitive consequence of this is that any perspective transformation
of a quadric is a quadric!  A perspective transformation of a sphere,
for example, can be a hyperboloid of two sheets.

The normal vector or tangent plane can be found by taking the gradient of
the quadratic form: N = grad(P*Q*P^t)/2 = Q*P^t for a point P on the surface.
If P is not on the surface, this plane N is still geometrically meaningful;
it is called the "polar plane" of P, and dually, the "pole" of the plane N
is P = N^t*Q^-1.

References:
    E. A. Maxwell, General Homogeneous Coordinates in Space of Three Dimensions,
	Cambridge U. Press, London, 1951.
    Paul Heckbert, The Mathematics of Quadric Surface Rendering and SOID,
	New York Inst. of Tech. Computer Graphics Lab TM4, July 1984.
    Jim Blinn, The Algebraic Properties of Homogeneous Second Order Surfaces,
	The Mathematics of Computer Graphics seminar notes, ACM SIGGRAPH '84,
	July 1984.

Paul Heckbert
Pixar				415-499-3600
P.O. Box 13719			UUCP: {sun,ucbvax}!pixar!ph
San Rafael, CA 94913		ARPA: ph%pixar.uucp@ucbvax.berkeley.edu

ph@pixar.UUCP (01/31/87)

Correction to a typo in my previous posting:  to transform a plane N
by matrix T: N' = T^-1*N, not N' = T*N.
It makes perfect sense if you remember the correspondence between
plane equations in the two coordinate systems:  P'*N'=0 <==> P*N=0 :

	P'*N' = (P*T)*(T^-1*N) = P*(T*T^-1)*N = P*N

Interesting note: some computer graphicists mistakenly transform normals
(planes) using N' = T^t*N, but this is correct only for rotations.