Play around with the sliders and drag the vertices of the blue triangle Eventually I might use these techniques in whatever 3d stuff I make Explanation of visible variables: - rate: How quickly the pen shrinks for incircle fills (the smaller the faster) - FPS: frames per second (impacted mostly by the blue triangle) - border width: width of the blue triangle's border - resolution: desired resolution of the red and green triangles - ghost: transparency of the blue triangle - rate control: how aggressive the pen shrink rate calculation is (higher values result in more incircle iterations. 50 is mathematically ideal, but it might need to be higher due to pixel rounding)
I decided to jump on the triangle-fill bandwagon... The red and green triangles are filled with a fast incircle fill, and are drawn with pen transparency to give an idea of the pen movements used to create them. The main difference between this incircle fill and others on Scratch is the number of iterations needed to draw the triangle. My implementation uses the idea of a pen "shrink rate". Most other projects use a hardcoded value of 0.5, while I dynamically determine the smallest possible value that ensures that the triangle will be completely filled. Using a smaller value means that the pen size shrinks faster resulting in fewer iterations needed to get the desired resolution. The blue triangle is drawn with a simple scanline fill where lines are drawn vertically or horizontally (whichever uses fewer lines) without overlapping. This technique is much slower than the incircle technique, but scanline makes it possible to have a solid transparent background.