[ Mælström ]

Matrix Visualisation

2000-06

Defining a Point by Distances Along Each Axis

A point is defined in 3D via three components; these usually represent the distances along each axis. Often, the handedness or labels are different; standard handedness is often abandoned to have z decreasing away from the screen, as it is here. OpenGL has z the other way preserving right-handedness, a system I prefer. Here, x, y, and z distances are marked in red. These denote a vector, in green, which points to the blue point.

A 3D engine converts points in a 3D world to points on the screen. The point (x, y, z) in World Space is transformed into (x', y', z') in View Space (Camera Space, Eye Space, et cetera.) It is then projected to the 2D screen, usually by perspective projection in 3D engines. The transformation to View Space can be seen as a matrix.

Below, the big thing is the matrix; it's the coördinates of the camera. It's not an esoteric, abstract thing; it can be seen as a collection of simple dot products grouped together for convenience. It's all very neat and good. The computer just adds and multiplies, a matrix is a human construction to organise the information. We are free to let any isomorphism represent the transformation. Let's deconstruct the matrix as a (relatively) simple set of three plane equations.

(x', y', z') = f(x, y, z)

Defining a Point's x Value by the Distance from the yz Plane

Instead of a distance along the x axis, the vector's (green) x component (red) can be though of as the distance from the point (blue) to the plane encompassing the y and z axes.

Defining a Point's y Value by the Distance from the xz Plane

Instead of a distance along the y axis, the vector's (green) y component (red) can be though of as the distance from the point (blue) to the plane encompassing the x and z axes.

Defining a Point's z Value by the Distance from the xy Plane

Instead of a distance along the z axis, the vector's (green) z component (red) can be though of as the distance from the point (blue) to the plane encompassing the x and y axes.

Actually, this is easy; you just separate the rows, eg (x') = (xA xB xC xD) · (y y z 1) becomes, x' = xA x + xB y + xC z + xD. If x' = 0, this is the plane equation for the camera's x; it's locus of all points whose distance is equal to zero. The coefficients expressed as a vector, (xA, xB, xC), will be the normal to the plane.

Plane with x-axis normal: x' = xA x + xB y + xC z + xD,

plane with y-axis normal: y' = yA x + yB y + yC z + yD,

plane with z-axis normal: z' = zA x + zB y + zC z + zD.

Having calculated three planes, it becomes a simple matter of plugging in the coördinates of a point to determine its distance to the plane. Substituting a point at (x, y, z) into the above equations will give three answers, one for each plane. These form a vector, (x', y', z'), that is the coordinates of the point with respect to the axes defined by these planes. This is an isomorphism to the matrix transform.

This might be useful to calculate z values and skip calculating the x and y if z doesn't fall between clipping distances, or maybe just never finding z in a parallel projection. Graphics accelerators do this for you.

[ Dir ]
Articles I've written (from a long time ago.)
[ File ]
eq1.jpg (4 KB)
[ File ]
[ File ]
[ File ]
xy.jpg (2 KB)
[ File ]
xyz.jpg (3 KB)
[ File ]
xz.jpg (3 KB)
[ File ]
yz.jpg (3 KB)
-- π

From http://neil.chaosnet.org/documents/articles/3dtrans/.