# calculating the Fermat point of a triangle

Is there any algorithm by which one can calculate the fermat's point for a set of 3 points in a triangle? a fermat's point is such a point that the sum of distances of the vertices of the triangle to this point is minimum. I came across several mathematical proofs regarding this ,but can't get an algo for actually calculating it programmatically for given 3 points. Can someone please help on this? Thanks.

-
The construction described at en.wikipedia.org/wiki/Fermat_point seems like a straightforward algorithm to me. – Ted Aug 28 '11 at 6:04
programmatically?? – pranay Aug 28 '11 at 15:24
What's the difficulty with implementing that construction programmatically? – Ted Aug 28 '11 at 19:14

If the angle at A is 120 degrees or more, $a^2 \geq b^2 + bc + c^2$ and the Fermat point is at A. Check this for B and C, as well.

When all angles are less than 120 degrees, the Fermat point is number 13 in the list of triangle centers here:

http://faculty.evansville.edu/ck6/encyclopedia/ETC.html

where you can find barycentric coordinates of that point as a function of the sides of the triangle. Given barycentric coordinates for any point its Cartesian coordinates can be calculated from the Cartesian coordinates of the vertices of the triangle.

-
thanks a lot :) – pranay Aug 30 '11 at 7:00
i tried calculating the catesian co-ordinates but not getting the correct result: Y= ((U+V+W)/3.0+(ax*cy)-(cx*ay)+(bx*ay)-(ax*by)+(cx*by)-(bx*cy))/((2*(bx-cx))); X= ((U-V-W)/3.0+(cx*by)-(bx*ay)-(ax*cy)+(cx*ay)-(bx*ay)+(ax*by))/((2*(by-cy))); where U,V,W are the barycenters and a,b,c are the cartesian co-ordinates of vertices. – pranay Aug 31 '11 at 13:07
If A,B,C are Cartestian coordinates of the vertices and barycentric coordinates are (p,q,r) then the Cartesian coordinates of the point are (pA+qB+rC)/(p+q+r). Usually the barycoordinates are normalized so p+q+r = 1. The "+" means addition of vectors. At the Encyc.Triangle Centers web site they sometimes list trilinear coordinates and not barycentric, but there is an explanation (a formula) at the top of the page on how to convert the two. – zyx Aug 31 '11 at 17:13
thanx a lot again :) – pranay Sep 2 '11 at 14:43