May 2021
Beginner
248 pages
5h 26m
English

In the previous chapter, we took our first steps toward drawing simple shapes—namely, straight line segments—using only PutPixel and an algorithm based on simple math. In this chapter, we’ll reuse some of the math to draw something more interesting: a filled triangle.
We can use the DrawLine method to draw the outline of a triangle:
DrawWireframeTriangle (P0, P1, P2, color) { DrawLine(P0, P1, color); DrawLine(P1, P2, color); DrawLine(P2, P0, color); }
This kind of outline is called a wireframe, because it looks like a triangle made of wires, as you can see in Figure 7-1.
Figure 7-1: A ...
Read now
Unlock full access