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(x′1, y′1, zi1 and P2(x′2, y′2, zi2), where x′1, y′1, x′2 and y′2 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
x′M = 0.5 (x′1 + x′2) |
y′M = 0.5 (y′1 + y′2) |
ziM = 0.5(zi1 + zi2) |
In general we have
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.
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
or
To compute the point of intersection of this ray of light and line l, we substitute this result in (A.1), finding
Dividing the left- and right-hand sides of this equation ...
Get Computer Graphics for Java Programmers, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.