How to calculate Fermat point in a triangle most efficiently?

6.9k Views Asked by At

I am aware of this question, but mine is a bit more specific.
I want to find the coordinates of the Fermat point for a given triangle. Assuming that no angle in the triangle is larger than 120 degrees, there's an algorithm for doing that that goes something like this:

  1. Construct equilateral triangles on two sides of our given (original) triangle.
  2. Connect the new vertexes with the opposite vertexes from the original triangle.
  3. Find the point in which the connecting lines intersect - that's the Fermat point of our original triangle.

(paraphrased from Wikipedia)

Now, I want to do this programmatically, so I can't do it by drawing. It would be ideal if I had a formula for the coordinates of the Fermat point, but I've tried Google and I can't find it.

Anyway, what I plan on doing is to write a program that does something like this:

  1. Calculate the coordinates of the third vertex in the equilateral triangles for two sides of the original triangle.
  2. Calculate the equations of the lines that connect the new vertexes with the opposite vertexes from the original triangle. I can do this because two point uniquely determine a line.
  3. Given the two line equations that I got in step 2, calculate the coordinates of the intersection of those lines.

Am I missing something? The fact that I can't find a formula for this makes me think that I am, because, if what I'm trying to do is correct, why isn't there a direct formula? I mean, what I'm doing in each step is basically using a formula on what I got from the previous step, so why wouldn't there be a formula to go from step 0 (coordinates of the original triangle) to step 3 (coordinates of the Fermat point)?

Furthermore, if there isn't a formula and if I'm not missing anything, is there a simpler way of doing what I'm trying to do?