I have the coordinates (x,y) of 2 points. I want to build the third point so that these 3 points make an equilateral triangle.
How can I calculate the third point?
Thank you
If the triangle were equilateral then 2|AO| = |AC|. Since \triangle AOC is a right triangle, the Pythagorean Theorem says that |OC|^2 + |AO|^2 = |AC|^2.
question_answer Answers(2) Substituting the value of y in equation (1) and equating it to 26. Solving the quadratic equation using the quadratic formula, [-b ± √(b2 - 4ac)]/2a. Hence, the coordinates of the third vertex of the equilateral triangle are ([1 ± √(3)] / 2, [7 ± 5√(3)] / 2). Answer.
Hypotenuse calculator The hypotenuse is opposite the right angle and can be solved by using the Pythagorean theorem. In a right triangle with cathetus a and b and with hypotenuse c , Pythagoras' theorem states that: a² + b² = c² . To solve for c , take the square root of both sides to get c = √(b²+a²) .
A simple way is to: find the vectors connecting the point to each of the triangle's three vertices and sum the angles between those vectors. If the sum of the angles is 2*pi then the point is inside the triangle.
After reading the posts (specially vkit's) I produced this simple piece of code which will do the trick for one direction (remember that there are two points). The modification for the other case shold be trivial.
#include<stdio.h>
#include<math.h>
typedef struct{
double x;
double y;
} Point;
Point vertex(Point p1, Point p2){
double s60 = sin(60 * M_PI / 180.0);
double c60 = cos(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 v;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With