Appendix A. Linear Interpolation of 1/z

We will now discuss why, with central projection, we can use linear interpolation of 1/z, called zi in Chapter 7, and not simply z. For example, with two points P1(x1, y1, zi1 and P2(x2, y2, zi2), where x1, y1, x2 and y2 are logical screen coordinates, while zi1 = 1/z1 and zi2 = 1/z2, we can compute similar coordinates of the midpoint M(xM, yM, ziM) by using

xM = 0.5 (x1 + x2)
yM = 0.5 (y1 + y2)
ziM = 0.5(zi1 + zi2)

In general we have

Linear Interpolation of 1/z

Figure A.1 shows the eye-coordinate axes x and z and the screen z = −d. For simplicity, we ignore the y-axis. Recall that the position E of the eye is the origin of this coordinate system and that the negative z-axis points towards the center of the object. Point P lies on line l, which has the following equation:

Equation A.1. 

Linear Interpolation of 1/z

The ray of light PE intersects the screen in P′(x′, −d). Then all points (x, z) of this ray of light satisfy the equation

Linear Interpolation of 1/z

or

Linear Interpolation of 1/z

To compute the point of intersection of this ray of light and line l, we substitute this result in (A.1), finding

Linear Interpolation of 1/z

Dividing the left- and right-hand sides of this equation by z and swapping them, we obtain

Equation A.2. 

Linear Interpolation of 1/z

which shows that 1/z is a linear function of x′.

Central projection of point P on screen

Figure A.1. Central projection of point P on screen

This is useful because it enables us to perform linear interpolation. This term is used to indicate that, with a linear function

f(x) = mx + c

and three values xA, xB and xI satisfying

xI = xA + λ(xBxA)

we can express f(xI) in f(xA) and f(xB) in the same way as xI is expressed in xA and xB, that is,

f(xI) = f(xA) + λ{f(xB) − f(xA)}

Although this sounds very plausible, here is a proof for the sake of completeness:

Central projection of point P on screen

As we have seen in Equation (A.2) that 1/z is a linear function of x′, it follows that we can find the z-coordinate of a point I on a line AB in 3D space by using

Equation A.3. 

Central projection of point P on screen

where λ indicates the position of the projection I′ relative to A′ and B′:

xI′ = xA′ + λ(xB′ − xA′)
yI′ = yA′ + λ(yB′ − yA′)

We have used Equation (A.3) in Chapters 6 and 7 to compute the z-coordinate of an unknown 3D point that is the original of a given 2D image point.

A different notation

In the preceding discussion we have written equations of the form

xI′ = xA′ + λ(xB′ − xA′)

in which the variable xA′ occurs twice. We can instead use a different equation, in which each of the variables xA′ and xB′ occurs only once, at the price of using two occurrences of the parameter λ:

xI′ = (1 − λ)xA′ + λxB

An example

Using λ = 0.5 in the above formulas, we obtain

xI′ = 0.5 (xA′ + xB′)
yI′ = 0.5 (yA′ + yB′)
Central projection of point P on screen

Figure A.2 illustrates this. The object shown in (a) is a wire-frame model of a cube, containing an extra square between the front and back faces and passing through point I. The viewpoint indicated in (c) as Eye is used to obtain the perspective view (b). Here the projection I′ is the midpoint of A′B′, so that the first and second of the above three equations clearly apply. In 3D space, I is not the midpoint of AB, but BI = 2AI, as (a) and (c) show. Since the negative ze-axis points from the eye to the center of the object, the distances shown in (c) imply that

Linear interpolation applied to inverse values

Figure A.2. Linear interpolation applied to inverse values

zA = −3
zI = −4
zB = −6

These values satisfy the third of the above three equations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset