The idea behind this is to draw a triangle by drawing a line which covers the triangle and lies on one edge. Then subtracting the overlap with two other lines. This means you can fill a triangle with 100% accuracy with just 3 lines. If you want to visually see how it calculates the subtractive lines see this Geogebra applet: https://www.geogebra.org/m/p2dantt5 For info on how the algorithm works please see inside.
The maths was immensely difficult to figure out. You'll quickly notice this too if you read how it works or look at the code. -------------------- Known bugs ------------------- - Right angled triangles do not render properly, likely due to division by zero edge case. - sprite does not draw pen lines which go off the screen