Sierpinski Pedal Triangle

Let T be an acute triangle. The pedal triangle of T is the triangle formed by the three points that lie at the feet of the three altitudes of T. Remove the interior of the pedal triangle, leaving three triangles that are similar to the original triangle. Continue to iterate this construction on the remaining triangles. The limit of this iteration is the Sierpinski Pedal Triangle. For more details, see https://larryriddle.agnesscott.org/ifs/siertri/sierpedal.htm.
Use the slider to change the number of iterations (up to 6). The initial pedal triangle will be highlighted (along with the three triangle altitudes) at the first iteration. You can also click on a vertex and move it with the mouse. Vertices will snap to the grid if close enough. If the triangle is not acute, no pedal triangles will be drawn. (Note: a lot of calculations are going on behind the scenes each time a vertex is moved, so there may be a slight delay before you see the change.)