(introductory sound) We saw in the previous lesson that to write a ray tracer, you need a mathematical way to answer a bunch of questions. Where does a ray intersect a scene object? Does a shadow ray reach the light source before it intersects another object? How does the surface reflect light? How far away is the light source? Finally, where is the camera? In the remainder of this lesson, we're going to focus on the first sub-problem, that of ray object intersection. We're going to start our study by first looking at the simpler problem of how to do ray object intersection in two dimensions. What does ray tracing look like in two dimensions? Let's start with our three-dimensional situation and take a cross-section through this white plane that contains the camera and the viewing direction. Notice too that the white plane intersects the image plane on the line, which we'll call the image line. That means if we draw just what's in the white plane, we get a picture like this. To make the problem even easier, we'll try first intersecting with the simplest object possible, the line segment. Here's our scene: Just a line segment connecting two points, A and B. To render the scene, just as in three dimensions, we need to pick a location for our camera. Call the camera point, C. Next, we pick a viewing direction, shown here in red. In three dimensions, the camera location and viewing direction defines an image plane. but in two dimensions, it gives us an image line. That's the line in which our image will be formed. Now, let's pick a point, P, on the image line to denote the pixel we want to determine the color of. Recall that the ray tracer builds a ray from C through P off into the scene. We need a mathematical way to compute intersection points. Like this one, called 'I'. To develop the math, we first introduce a coordinate system. The math we need comes from looking at the Algebra of intersecting a ray with a line segment. We've introduced quite a few ideas in this video. So, use the next exercise to make sure you're comfortable with two-dimensional ray tracing.