Drawing Triangles
Triangles are both simple and flexible making them important when it comes to drawing to the screen. The first method of drawing a triangle involves checking for each pixel, whether it lies inside or outside of the triangle we want to draw.
We do this through the half-plane point in polygon test. Given three points \(p_{1}, p_{2}, p_{3}\) oriented counter clockwise, we want to see if \(p\) lies inside the triangle. We can first compute the normals \(n_{1}, n_{2}, n_{3}\):
We also calculate the vectors going towards point \(p\). So we just have to check if \(p\) lies on the left of each oriented half-plane given by the requirement that: \begin{equation*} v_{i} \cdot n_{i} \leq 0 \end{equation*} This means that drawing triangles to the frame buffer starts by computing the bounding box, and iterating through the rows and columns to perform this check. Here are some results:

























