Академический Документы
Профессиональный Документы
Культура Документы
Hogan
at
Putting 3D In Perspective
ASU
PROJECTIONS, CLIPPING PLANES, AND CALCULUS
This project was done for MAT 267: Calculus III for Engineers with Naala
Brewer as part of a Footnote 18 contract for honors credit with Barrett, the
Honors College at ASU, in Fall 2007.
Introduction
According to question prompt, 3D computer graphics can
be rendered by representing objects in XYZ space and
introducing a rectangular viewing plane or screen, a
camera point, and four triangular clipping planes
running from the edges of the screen to the camera. (See
Figure 1.) Only objects within the resulting pyramid will be
shown by projecting them onto the screen for a 2D
representation of what the camera sees; the rest will be
clipped.
Setup
Before tackling any problems, Figure 1 was constructed.
The camera C was located at (1000, 0, 0) and the four
points of the rectangle representing the viewing plane are
located at (0, 400, 0) and (0, 400, 600). We shall refer
to these four points as P, Q, R, and S clockwise from topright, as labeled in Figure 1.
Questions
1. The first question is, If a line L passes through the
points (230, 285, 102) and (860, 105, 264), at
would points will L be clipped by the clipping planes?
First we take the two points and describe L as a parametric vector function:
L = <230 + 630t, 285 + 390t, 102 + 162t>
Then generate equations for the left and right clipping planes so we can solve for their intersection
with L (if these do not intersect L properly then we will try the top and bottom planes). We find the
normal vector to the right clipping plane, nright, by crossing the vectors of the lines CP and CQ. So:
<1000, 400, 0> <1000, 400, 600> = nright = <240000, 600000, 0>.
The normal vector for the left clipping plane could be found in the same way, or by simply negating
the y component of nright, so:
nleft = <240000, 600000, 0>.
Coupling these normal vectors with the point they have in common, the camera point C, yields
equations for the (infinite) planes containing the triangular (bounded) clipping planes. The right
clipping planes equation is:
240000(x 1000) + 600000(y) + 0(z) = 0
or simplified,
240000(x 1000) + 600000(y) = 0
And similarly the left clipping plane is:
240000(x 1000) 600000(y) = 0
Then we want to find the points of intersection between these planes and our line L. We will call these
points P0 and P1, and they are the endpoints for our clipped line. To find them, we plug the values for
x, y, and z from the parametric equation of L into the equations of our clipping planes. First the right
side:
240000(230 + 630t 1000) + 600000(285 + 390t) = 0
5520 + 15120t 24000 17100 + 23400t = 0
38520t = 35580
t = 0.9236760125
which needs plugged back into L:
<230 + 630(0.9236760125), 285 + 390(0.9236760125), 102 + 162(0.9236760125)>
P0 = (811.9159, 75.2336, 251.6355)
Similarly we solve for the intersection of L and the left clipping plane:
AlanHogan.com
iv. Calculate the bounds of the rectangle as projected onto the screen.
v. Draw the projected line as before, except where h is inside the projected area of the rectangle,
do not draw it.
Alan J. Hogan.