I needed to draw an equilateral triangle using SVG and Javascript ...
I tried to answer Xantix the first question in order to build an equilateral triangle defined by the center point (cx, cy) and the radius of the circle (r), which, as indicated, easily solves the coordinates for the point C (cx, cy + r).
However, I could not understand how to obtain the equations of rotation for solving both coordinates for points A and B, so my solution is this.
Math time - solve for x
Suppose cx = 9, cy = 9, r = 6 and a horizontal base.
First find the length of the sides of the triangle (a, b, c):
9r^2 = a^2 + b^2 + c^2 r^2 = 36, 9r^2 = 324, 324/3 = 108, sqrt(432) = 10.39
Once we know the length of each side of the triangle (s = 10.39), we can calculate for the x coordinates. Add s / 2 (5.2) to cx for Bx (14.2) and subtract s / 2 from cx for Ax (3.8).
x now requires y
Speaking of s / 2, if we divide the triangle in half vertically (from point C to the middle between points A and B), we can solve for y (ultimately giving us Ay and By):
a^2 + b^2 = c^2 a^2 + 27.04 (1/2 s squared) = 107.95 (length s squared) a^2 = 80.91 sqrt(80.91) = 8.99
Subtracting this y from cy + r (15 - 8.99 = 6.01) gives us a new graph of y for both points A and B.
Center ( 9.00, 9.00) C ( 9.00,15.00) B (14.20, 6.01) A ( 3.80, 6.01)
Conclusion
As soon as we know the length of the sides of the equivariant triangle, we can calculate the coordinates of the point given by the center point, the radius of the circle, and the horizontal base.