math - How to find coordinates of a 2d equilateral triangle in C? -


I have 2 point coordinates (X, Y). I want to make the third point so that this 3 digit becomes an equilateral triangle Able to

How can I calculate the third point?

Thanks

After reading the posts (especially vkit) Simple code is created which will move for one direction (remember that there are two points). The modification for the other case is trivial.

  #include & lt; Stdio.h & gt; # Include & lt; Math.h> Typedef Structure {Double X; Double wi; } Point; Point Point (Point P1, Point P2) {Double C60 = Sin (60 * MOPI / 180.0); Double C 60 = Kos (60 * M_PI / 180.0); Point v = {c60 * (p1.x - p2.x) - s60 * (p1.y - p2.y) + p2.x, s60 * (p1.x - p2.x) + c60 * (p1.y - p2.y) + p2.y}; Return vi; }  

Comments