views:

88

answers:

4

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?

+6  A: 
brainjam
Very good solution, I'll upvote you, but I find this answer incomplete, because you didn't write the details down. I took a sheet of paper and a pen and calculated what you've said, would like to share the result with anybody interested in the subject.
Lajos Arpad
@Lajos, I'm not sure what needs to be proven. The construction results in sides of length a,b,c ... I'd say this is obvious, why would you say this is not obvious?
brainjam
Because a question was asked about this. I didn't know about this solution and I had to check. I'm an agnostic, believing only what I see. You were absolutely right with your post, I just wanted to specify it further. Also, the solution is a solution, because you can put the triangle anywhere you want using rotation and translation techniques.
Lajos Arpad
@Lajos, I didn't mean that the construction was obvious, I meant that once you had it the lengths of the three sides were obvious. Anyways, it was helpful of you to spell out the details of the third vertex, and I have linked to that.
brainjam
"I meant that once you had it the lengths of the three sides were obvious." Sorry, I misunderstood at first. You're right.
Lajos Arpad
+2  A: 

When drawing an unknown triangle, it's usually easiest to pick one side (say, the longest) and place it horizontally or vertically. The endpoints of that side make up two of the triangle's vertices, and you can calculate the third by subdividing the triangle into two right triangles (the other two sides are the hypotenuses) and using the inverse sine/cosine functions to figure out the missing angles. By subdividing into right triangles, I mean something that looks like the image here: http://en.wikipedia.org/wiki/File:Triangle.TrigArea.svg Your first side would be AC in that drawing.

Once you have the triangle figured out, it should be easy to calculate it's center and translate it so that it is centered on whatever arbitrary center point you like.

bta
+1  A: 

First check the that the triangle is possible:

    a+b >= c
    b+c >= a
    c+a >= b
Then, if it is, solve for the intersection of the two circles. The basic vertices are
    {0,0}, {a,0}, {x,y}
where
    x = (a^2-b^2+c^2)/(2a)
    y = sqrt(c^2-x^2)
Finding the circumcenter is pretty easy from this point.

Eric Towers
Where did you get the formula for `x` and `y`?
Kshitij Parajuli
The formula is not correct (try it for a,b,c = 4,3,5 for example). The correct formula is derived in the answer by Lajos.
brainjam
@brainjam: x = (4^2 - 3^2 + 5^2)/(8) == 32/8 == 4 == a, as expected. y = sqrt(5^2-16) = 3 == b, as expected. It's a dressed up version of the law of cosines and then the Pythagorean theorem. It also happens to be the *only* solution to the intersection of the two circles that *also* satisfies the triangle inequality for the side lengths (the three possibility tests I gave).
Eric Towers
@Kshitij Parajul: I made Mathematica solve for the intersection point, under the assumption of the triangle inequalities and positivity of a, b, c, x, and y. However I recognized them as a tweaked law of cosines and Pythagoras' theorem and therefore understood how they would be derived and that they were correct.
Eric Towers
@Eric, you are absolutely right. I was associating the radius b (instead of c) with the center (0,0), so was expecting the answer (0,3) instead of (4,3).
brainjam
+5  A: 

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)))

Lajos Arpad
+1 for posting math..
Ninja Dude