Tempo atual:0:00Duração total:3:03
0 pontos de energia
Transcrição de vídeo
- Recall that to figure out where a two-dimensional ray intersects a line segment, we started by first introducing a coordinate system. Once we have our coordinate system, we can write our line AB in slope intercept form. Since in this example A has coordinates three two, and B has coordinates four negative one, the slope intercept form of AB is y equals negative three x plus 11. Similarly, if I pick P to have coordinates two, one half, then the slope intercept form of the ray CP is y equals one quarter x. The point I we're looking for is on both of these lines. So if I sub x and I sub y represent the coordinates of I, then I sub y equals negative three I sub x plus eleven, because I lies on AB. And I sub y equals one quarter I sub x, because I lies on the ray CP. Solving these two equations for the two unknowns gives us the coordinates I sub x and I sub y. Using the slope intercept form of the ray works in two dimensions, and is fairly simple to understand, but there's a problem when we generalize it to three dimensions. The problem is that in three dimensions, the ray doesn't have a slope intercept form. So we'll have to throw out this representation of our ray in preparation for three dimensional raytracing. To represent our ray CP, we'll use something called a parametric function. What I'm about to write looks a little strange at first, but bear with me, these functions start to become familiar with practice. My ray will be represented by a new function, R of t, that is the weighted average of C and P, where t is the weight. In particular, I'm going to write R of t as one minus t times C, plus t times P. Notice what happens when t equals zero. One minus t is just one. So R of zero is C. And when t equals one, R of one equals P. That's convenient, because I can relabel C as R of zero, and I can relabel P as R of one. R of one half would be exactly halfway between C and P. Values of t greater than one name points on the ray off in the scene beyond P. Before we continue, get some experience using this kind of parametric function in the next exercise.