V2! This is a demonstration of a triangle filling method. It does fill the triangles, but it isn't done yet. -------------- Instructions ---------------- Press the green flag to generate a new triangle. Then you can drag the 'Line width' (press 's' to show it) slider to change the width of the outline, or to let the program automatically calculate it for you, press 'a'. You can also press 't' to manually change the triangle data list (you have to click 'See inside' to edit the list). To run a benchmark, first set a triangle and line width and then press space to see how it would perform at different framerates. Also, you can press 'd' to enable debug rendering, which colors every rendering step in a different color. To hide the sliders, you can press 's'. ---------------- How it works ---------------- The idea is that the program finds the inscribed circle of the triangle and draws it. The outline of the triangle is drawn by insetting the original triangle by half the line width (which is calculated from the inscribed circle to perfectly fill all empty gaps in the triangle), so that the triangle gets filled in only three moves of the pen, which makes it incredibly fast. There's (of course) also a tradeoff, which is that the edges of the triangle gets rounded, which reduces how precisely you can draw (but that can be fixed by doing the same thing again on the outside until the corners are sharp enough, which I have now done in V2.). Quick note: There is a possibility to make a hybrid filler using various different techniques and changing their influence based on the size and shape of the triangle, which might drastically improve performance, although I haven't tested that.
NOTE: This is still quite ugly and hard to use, don't try to make anything with it. While i did all of the code myself, i got some of the maths from here: https://en.wikipedia.org/wiki/Incircle_and_excircles https://math.stackexchange.com/questions/17561/how-to-shrink-a-triangle Also, I was inspired to pick this back up after seing @Geotale's triangle filler, which to my surprise worked in the same way I originally thought of doing this. Also, this tri filler is way slower than 's (About 4800 tris/second on a low-end computer at 4 resolution, which by the way is the recommended resolution.), but I do have some optimizations in mind that will probably be implemented eventually.