I created a square around an equilateral triangle, meaning it has all equal sides. The square also has the same side length. I found the ratio of the side to the height of the triangle. It may not be exact (irrational #) but it is very close. If anyone can explain this, please tell me in the comments.
Put a number greater than -180 but less than 180. Negative number will make an upside-down triangle. The red lines show the heights of the two shapes, the lower one is calculated using the ratio. Press any key or click to restart, as well as green flag.