Mathematics behind rotating triangles

I created a Trefoil knot from a list of points. Could someone explain the mathematics behind the amount of scaling between the different triangles. Thank you.
Here is the project: Snap! Build Your Own Blocks

Well, let's see... Start by imagining that the angle at the bottom right is 90° instead of 60°. And suppose the length of the base of the outer triangle is 10. Then we have the following computation of lengths of bottom-ish sides:

triangle #     bottom endpoint    top endpoint    length
0              [0, 0]             [10, 0]         10
1              [1, 0]             [10, 1]         √82
2              [2, 0]             [10, 2]         √68
...
n              [n, 0]             [10, n]         √[(10-n)²+n²]

This is a quadratic function, not a linear one, so the change from one triangle to the next isn't constant. If you want to compare areas rather than side lengths, to a first approximation just don't take the square roots. (The area of the outer isosceles right triangle is half the square value; the area of the actual outer equilateral triangle is umm something with √3? times the square value. That's just a constant factor difference for all the triangles, I think.)

Does that help? I'm too lazy to work out the details today.

Thank you, I don't understand were this is taking me. I have added the script so far and some scribblings (first iteration) to explain my thinking. Somewhere this goes wrong.

Your diagram looks fine to me; I was just trying to avoid the trig. But there's a subtlety that your diagram doesn't capture, namely, all the smaller triangles are relative to the original base, not recursively drawn relative to the next-bigger one. I think that that's not reflected in your code, although what I'd really like is for you to add a third triangle to your diagram.

I also think you could avoid some of the computation by taking more advantage of turtle graphics. But my script ended up longer than yours:

Thank you for your time and insight..it is beautiful. The only restraint...the script, not really draws the triangles in one take. It's in some sense similar to the first project were I started this post with my question. The Trefoil project from a list of points that draws the triangles from reference points in a list. Snap! Build Your Own Blocks
But again thank you...still wondering about how you came to the quadratic function.

You did too! In your diagram there's a √(base²+height²). I tried to simplify the math by making an isosceles right triangle instead of an equilateral one. But of course that just complicates the code. ("Of course" because the three legs of the smaller triangles aren't a REPEAT 3.)

That's right...perhaps I wasn't clear enough, I was referring to my initial question and project.
Thanks anyway...trying to make the REPEAT of 3 ⃤