Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing a triangle in a coordinate plane given its three sides

The length of three sides of the triangle, a, b and c will be given, and I need to find the coordinates of the vertices. The center (probably the circumcenter) can either be the origin or (x,y).

Can anyone point me in the right direction?

like image 671
Kshitij Parajuli Avatar asked Oct 23 '10 01:10

Kshitij Parajuli


1 Answers

I've read brainjam's answer and checked whether his answer is true and he is right. Calculation: O(0;0), A(a;0) and B(x;y) are the three points of the triangle. C1 is the circle around A and r1 = c; C2 is the circle around O and r2 = b. B(X;Y) is the intersection of C1 and C2, which means that the point is on both of the circles.

alt text

C1: (x - a) * (x - a) + y * y = c * c

C2: x * x + y * y = b * b

y * y = b * b - x * x

(x - a) * (x - a) + b * b - x * x = c * c

x * x - 2 * a * x + a * a + b * b - x * x - c * c = 0

2 * a * x = (a * a + b * b - c * c)

x = (a * a + b * b - c * c) / (2 * a)

y * y = b * b - ((a * a + b * b - c * c) / (2 * a)) * ((a * a + b * b - c * c) / (2 * a))

y = +- sqrt(b * b - ((a * a + b * b - c * c) / (2 * a)) * ((a * a + b * b - c * c) / (2 * a)))

like image 150
Lajos Arpad Avatar answered Oct 04 '22 02:10

Lajos Arpad