When building visualizations of higher-dimensional objects, one must make a choice of how to represent the excess of data in our more limited physical space. One choice is to show slices of higher-dimensional objects. Another is to apply a projection that condenses the data by one dimension, and a perspective projection from a selected viewpoint is commonly employed.

Given that a perspective projection will be used, the next question is how much of the original data needs to be actively transformed and what details of the projection can be inferred. As part of this question, one needs to know how straight lines between higher-dimensional points will transform under the projection. The answer is second nature to artists such as painters, but not necessarily immediately manifest from an algebraic point of view.

Begin with the simple case of projecting a line in three dimensions onto a two-dimensional plane with respect to a point in the third dimension. For simplicity of calculation, let the perspective point lie on the *z*-axis at a distance *d* from the origin. A line from the perspective point to any three-dimensional point can be parametrized as

$[0,0,d]+t\phantom{\rule{.2em}{0ex}}[x,y,z-d]$

where the parameter *t* runs from zero at the perspective point to one at the arbitrary point. Let the two-dimensional plane lie parallel to the *x*- and *y*-axes, crossing the *z*-axis at a distance *p* from the origin. The line from the perspective point will intersect this plane when its *z*-coordinate equals *p*:

$d+t(z-d)=p\phantom{\rule{2em}{0ex}}\to \phantom{\rule{2em}{0ex}}t=\frac{d-p}{d-z}$

For this value of the parameter, the first two coordinates of the arbitrary point are

$[\phantom{\rule{.2em}{0ex}}\frac{d-p}{d-z}x\phantom{\rule{.3em}{0ex}},\phantom{\rule{.2em}{0ex}}\frac{d-p}{d-z}y\phantom{\rule{.3em}{0ex}}]$

and this is a general formula for a perspective projection from three to two dimensions. If the perspective point is located at unity on the *z*-axis and the *xy*-plane passes through the origin, the general projection becomes

$[\phantom{\rule{.2em}{0ex}}\frac{x}{1-z}\phantom{\rule{.3em}{0ex}},\phantom{\rule{.2em}{0ex}}\frac{y}{1-z}\phantom{\rule{.3em}{0ex}}]\phantom{\rule{2em}{0ex}},\phantom{\rule{2em}{0ex}}d=1\phantom{\rule{.2em}{0ex}},\phantom{\rule{.2em}{0ex}}p=0$

which is a commonly encountered form for stereographic projection. If the perspective point is allowed to approach infinity, the general projection becomes

$[x,y]\phantom{\rule{2em}{0ex}},\phantom{\rule{2em}{0ex}}d\to \infty $

which is an orthographic projection in which the *z*-coordinate is simply ignored.

Now apply the general projection to a line between two arbitrary points. A parametrization of the line in three dimensions is

$[{x}_{0},{y}_{0},{z}_{0}]+t\phantom{\rule{.2em}{0ex}}[{x}_{1}-{x}_{0},{y}_{1}-{y}_{0},{z}_{1}-{z}_{0}]$

Projection of the endpoints gives the two-dimensional points

$[\frac{d-p}{d-{z}_{0}}{x}_{0},\frac{d-p}{d-{z}_{0}}{y}_{0}]\phantom{\rule{4em}{0ex}}[\frac{d-p}{d-{z}_{1}}{x}_{1},\frac{d-p}{d-{z}_{1}}{y}_{1}]$

so that a parametrization of the projected line in two dimensions can be written

$(d-p)[\frac{{x}_{0}}{d-{z}_{0}},\frac{{y}_{0}}{d-{z}_{0}}]+(d-p)t\phantom{\rule{.2em}{0ex}}[\frac{{x}_{1}}{d-{z}_{1}}-\frac{{x}_{0}}{d-{z}_{0}},\frac{{y}_{0}}{d-{z}_{0}}-\frac{{y}_{1}}{d-{z}_{1}}]$

which matches the projected endpoints for *t* = 0 and *t* = 1 by construction. Instead of projecting the endpoints and joining them, consider a projection of the parametrization of the entire three-dimensional line:

$(d-p)[\frac{{x}_{0}+t({x}_{1}-{x}_{0})}{d-{z}_{0}-t({z}_{1}-{z}_{0})},\frac{{y}_{0}+t({y}_{1}-{y}_{0})}{d-{z}_{0}-t({z}_{1}-{z}_{0})}]$

Here is the crux of the matter: this equation does not look like a line in two dimensions because the parametrization variable appears in the common denominator of both fractions, unlike the form directly above it. A quick plot of the parametrization, however, indicates that it is indeed a straight line. This fact would be immediately clear to a perspective painter, but does not automatically fall out of the algebra.

One way to test this expression for possible curvature is to calculate a unit tangent vector for this vector function. This is done by differentiating with respect to the variable of parametrization and normalizing the result. The derivative of the vector function is

$\begin{array}{l}\frac{d-p}{[d-{z}_{0}-t({z}_{1}-{z}_{0}){]}^{2}}\phantom{\rule{.3em}{0ex}}[({x}_{1}-{x}_{0})(d-{z}_{0})+{x}_{0}({z}_{1}-{z}_{0}),\\ \hfill ({y}_{1}-{y}_{0})(d-{z}_{0})+{y}_{0}({z}_{1}-{z}_{0})]\end{array}$

This expression can be simplified a bit, but that is not necessary for the main point of the argument. The dependence of this expression on the variable of parametrization is now separate from the individual vector components and will disappear when the vector is normalized. That means the unit tangent vector is constant: the expression has no curvature and thus represents a straight line.

Since the projection of the entire three-dimensional line is known to be a straight line, there must be a reparametrization of the projected expression that converts it to the standard linear form. The projection is essentially a linear fractional transformation that can be equated to a linear form and solved for the inverse transformation. For the first component set

$\frac{{x}_{0}+T({x}_{1}-{x}_{0})}{d-{z}_{0}-T({z}_{1}-{z}_{0})}=\frac{{x}_{0}}{d-{z}_{0}}+t\phantom{\rule{.2em}{0ex}}(\frac{{x}_{1}}{d-{z}_{1}}-\frac{{x}_{0}}{d-{z}_{0}})$

where the right-hand side comes from the parametrization connecting transformed endpoints. Keeping intact the bracketed quantity in the second term of the right-hand side, one easily finds

$T=\frac{t(d-{z}_{0})}{d-{z}_{1}+t({z}_{1}-{z}_{0})}$

The reparametrization depends only on higher-dimensional variables and so holds for both components of the projected line in two dimensions. This provides a direct connection between the apparently different forms of the projected line. The new parameter runs from zero to one as expected, just at a different rate along the line.

The entire development generalizes immediately to higher dimensions. For projecting a line in four dimensions onto a three-dimensional hyperplane, let the perspective point lie on the *w*-axis at a distance *d* from the origin. A line from the perspective point to any four-dimensional point can be parametrized as

$[0,0,0,d]+t\phantom{\rule{.2em}{0ex}}[x,y,z,w-d]$

where the parameter *t* again runs from zero at the perspective point to one at the arbitrary point. If a three-dimensional *xyz*-hyperplane crosses the *w*-axis at a distance *p* from the origin, the line from the perspective point will intersect it when its *w*-coordinate equals *p*:

$d+t(w-d)=p\phantom{\rule{2em}{0ex}}\to \phantom{\rule{2em}{0ex}}t=\frac{d-p}{d-w}$

For this value of the parameter, the first two coordinates of the arbitrary point are

$[\phantom{\rule{.2em}{0ex}}\frac{d-p}{d-w}x\phantom{\rule{.3em}{0ex}},\phantom{\rule{.2em}{0ex}}\frac{d-p}{d-w}y\phantom{\rule{.3em}{0ex}},\phantom{\rule{.2em}{0ex}}\frac{d-p}{d-w}y\phantom{\rule{.3em}{0ex}}]$

and this is the general formula for a perspective projection from four to three dimensions. The stereographic and orthogonal forms are found by the same choices of parameters as for the lower-dimensional cases.

Applying the general projection to a line between two arbitrary points, a parametrization of the line in four dimensions is

$[{x}_{0},{y}_{0},{z}_{0},{w}_{0}]+t\phantom{\rule{.2em}{0ex}}[{x}_{1}-{x}_{0},{y}_{1}-{y}_{0},{z}_{1}-{z}_{0},{w}_{1}-{w}_{0}]$

Projection of the parametrization of the entire line now gives

$(d-p)[\frac{{x}_{0}+t({x}_{1}-{x}_{0})}{d-{w}_{0}-t({w}_{1}-{w}_{0})},\frac{{y}_{0}+t({y}_{1}-{y}_{0})}{d-{w}_{0}-t({w}_{1}-{w}_{0})},\frac{{z}_{0}+t({z}_{1}-{z}_{0})}{d-{w}_{0}-t({w}_{1}-{w}_{0})}]$

Just as before, this expression is tested for possible curvature by calculating a unit tangent vector for this vector function. The derivative of the vector function is

$\begin{array}{l}\frac{d-p}{[d-{w}_{0}-t({w}_{1}-{w}_{0}){]}^{2}}\phantom{\rule{.3em}{0ex}}[({x}_{1}-{x}_{0})(d-{w}_{0})+{x}_{0}({w}_{1}-{w}_{0}),\\ \hfill ({y}_{1}-{y}_{0})(d-{w}_{0})+{y}_{0}({w}_{1}-{w}_{0}),\\ \hfill ({z}_{1}-{z}_{0})(d-{w}_{0})+{z}_{0}({w}_{1}-{w}_{0})]\end{array}$

The dependence of this expression on the variable of parametrization is again separate from the individual vector components and will disappear when the vector is normalized. The unit tangent vector is again constant, the expression has no curvature and again represents a straight line.

The reparametrization variable is determined in the same way as for two dimensions:

$T=\frac{t(d-{w}_{0})}{d-{w}_{1}+t({w}_{1}-{w}_{0})}$

The reparametrization again depends only on higher-dimensional variables and holds for all components of the projected line in three dimensions.

The process of moving from three to four dimensions is essentially a renaming of variables. Clearly this extends to any number of higher dimensions. The general conclusion is that a straight line remains a straight line under perspective projection onto a hyperplane of one less dimension than the original space.

The import of this conclusion for visualizations is that one need only transform the vertices of higher-dimensional meshes and connect the resulting points with straight lines. There is no need to explicitly transform the mesh edges. This is what one does implicitly in working directly with transformed parametrizations of the higher-dimensional surface, but it is good to have a justification for the process.

Another reason to lay out the justification explicitly is that one encounters statements online to the effect that straight lines are not preserved by various perspective transformations, particularly stereographic projections. The confusion arises because many applications of projection involve a spherical surface, such as projections of the earth’s surface in map making. The development here concerns points in the ambient higher-dimensional space that are not restricted to any spherical surface and thus differs essentially from such applications.

In summary: perspective projection of a higher-dimensional object preserves straight lines.

*Uploaded 2018.01.05*
analyticphysics.com