You will need
  • The coordinates of the triangle
Let the point A of the trianglepolygon ABC has coordinates x1, y1, point B of this tregon - coordinates x2, y2 and point C coordinates x3, y3. What are the x and y coordinates of the vertices of the triangleof a square. In a Cartesian coordinate system with mutually perpendicular axes X and Y from the origin it is possible to hold the radius-vectors for all three points. The projection of the radius-vectors on the coordinate axes and will give the coordinates of the points.
Let r1 is the radius vector of point A, r2 is the radius-vector of point B, and r3 is the radius-vector of the point C.
It is obvious that the length of the side AB is equal to |r1-r2|, the length of side AC = |r1-r3|, a, BC = |r2-r3|.
Therefore AB = sqrt(((x1-x2)^2)+((y1-y2)^2)), AC = sqrt(((x1-x3)^2)+((y1-y3)^2)), BC = sqrt(((x2-x3)^2)+((y2-y3)^2)).
The angles of the trianglepolygon ABC can be found from the spherical law of cosines. The theorem of cosines can be written in the following form: BC^2 = (AB^2)+(AC^2) - 2AB*AC*cos(BAC). Hence, cos(BAC) = ((AB^2)+(AC^2)-(BC^2))/2*AB*AC. After substituting in this expression the coordinates, you get: cos(BAC) = (((x1-x2)^2)+((y1-y2)^2)+((x1-x3)^2)+((y1-y3)^2)-((x2-x3)^2)-((y2-y3)^2))/(2*sqrt(((x1-x2)^2)+((y1-y2)^2))*sqrt(((x1-x3)^2)+((y1-y3)^2)))