The magazine of the Melbourne PC User Group

Ramifications of the Supercube
Ken Holmes

x^n + y^n + z^n = radius^n

In the May PC Update (http://www.melbpc.org.au/pcupdate/9605/9605article8.htm), we saw what the Supercube looks like and I talked myself into exploring further shapes that the equation could produce. The first decision was to forsake ray-tracing, which can be very slow, or get into endless loops, with unusual objects involving concavities, saddle shapes, points of inflexion or thin sections.

With convex objects, planes and spheres, you can make mathematical forays forward along the ray from the eye to quickly find the intersection with the closest surface and, by looking no further, hidden surfaces are conveniently ignored. The concave fractional supercubes are difficult, particularly when approaching a surface at a low angle or when near the razor edges where it is possible to pass right through between consecutive points and miss the object - the Swiss cheese effect. The nested supercubes were dumbly probed in forward steps of one pixel distance and rays passing right through would have been checked 480 times to see whether a surface was within that distance - potentially over 100 million points within the cube, fortunately halved since the average penetration would be about that. The published picture took about 15 minutes to calculate, on a 66 MHz 486.

By calculating points on the surface and plotting directly, the figures opposite take a second or two. Surfaces heading off to infinity are no problem and the fundamental trisymmetry, if that's the word, helps. This means you only need to calculate points on a third of the surface and then circulate the three values around x/y/z to plot it all. Sometimes there is a further bisymmetry which only necessitates calculating for a sixth of the surface; then you also swap two of the values before again circulating around x/y/z. With even, positive or negative exponents the hex-symmetry occurs in all eight octants and one calculation serves for 48 points, although, of course, every point has to be processed for the double stereo plot. One disadvantage is that we can only plot surfaces as a mesh of points, in one colour to nullify the effect of hidden points appearing in front.

The investigation resulted in an .EXE file, SUPERCUB.EXE [75 KB], it will display, on SVGA 800 x 600, all possible surfaces. A selection of the possibilities is shown here.

To recapitulate: Provided an even, positive exponent is used, "exponentiated" coordinates x, y or z will always be positive even with negative coordinates and the equation will define a symmetrical surface which, as the exponent increases from 2 to infinity, swells from a sphere to become a cube. This has been called the supercube. I don't know whether the originator(s) of the notion included the further contrivances below in the definition; I would be interested to hear any evidence that my efforts are not original.

The simple equation does invite further investigation; what if we use other than even integers? What about odd positive integers, and fractions, and negatives of all these? Raising negative coordinates to an odd integer power gives a negative result and we will not get a spherically symmetrical surface; and using a fractional exponent on a negative number isn't on - for example, raising -1 to the power of 0.5 (i.e. the square root of -1) gives the imaginary number, i, which is very useful in many branches of maths but isn't real.


Figure 1

One approach is to use only the absolute values of x, y and z so that we get, in the seven "negative" octants, mirror images of the surface in the all-positive octant and thus some nice symmetrical shapes. As the exponent is reduced from 2.0 down to +0, the sphere contracts, through an octahedron (at 1.0) and some sucked-in figures until it closely encloses the three axes between minus the "radius" and plus the "radius." Some of these shapes might inspire the sculptors among you; the spiky ones (Figure 1) might be a suitable station ID if you are starting your own TV empire - a bit sharper than the ABC Lissajous!

The odd integer exponents give interesting figures; in the all-positive octant we see similar shapes to those with the even integers but in the six adjacent octants, we have a surface extending to infinity with a triple symmetry, i.e. three ridges and three valleys (Figure 1), meeting near the origin. There is no real surface in the all-negative octant since (-x)^3 + (-y)^3 + (-z)^3 cannot equal (the always positive) r^3.

We can strain the bonds of friendship by treating fractional exponents as "odd"; that is, with negative coordinates, raise the absolute value to the fractional power and negate the result. This will extend the range of surfaces "back through" the flat plane for exponent +1. Illicit but interesting nevertheless (you need SUPERCUB.EXE to see this).

Now consider negative exponents. As x^(-n) is the inverse of x^n, the supercubes will enjoy an inversion transformation, outwards. For even, negative infinity, the cube transforms into corners in each octant, touching the corners of the cube (1.7321 times the radius from the origin) and extending to infinity as the planes x=ñr, y=ñr and z=ñr (Figure 2, green). The sphere (typical of others) becomes eight triangular-hyperboloid-like surfaces, asymptotic to each corner's planes, with their innermost points 3 times the radius from the origin. Larger, even, negative integer surfaces move steadily into the corner, while surfaces from negative fractions below 2, treated as "even," move further out.


Figure 2

The odd negative integer exponents, in the all-positive octant only, give intermediate shapes (Figure 2, blue) similar to those from the bracketing even integers. But, in the three octants where one coordinate is negative, we see a startling shape (black); three corner pieces, asymptotic to the x/y/z = +radius planes, faired together, and coming to a point at the origin. In the three octants where two coordinates are negative, we have a third surface which is a rounded, infinite "corner" (red hatching), passing also through the origin and also asymptotic to the x/y/z = +radius planes (but in the other direction). The fillets contract for larger odd integers becoming sharp corners for minus odd infinity. The three surfaces are difficult to depict in a single picture and are more legible on screen, particularly when the whole range can be watched during plotting.

To complete the picture, we can treat negative fractional exponents as "odd" to get similar surfaces but more gradually faired together near the centre, the "corner" more rounded and the piece in the all-positive octant also rounder and further out from the origin.

The equation provides a very suitable source of shapes for stereo graphing as most of the interesting action occurs near the origin, even when the surfaces sweep off to infinity. SUPERCUB.EXE draws about 100 separate configurations in rapid succession which pretty well exhausts the possibilities, short of going into the fourth dimension.

Reprinted from the June 1996 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[About Melbourne PC User Group]