Problem:

Find the point where it is the shortest distance to each of the 3 points of the triangle.


Solution:

Fermat point is the solution to the problem. It is constructed by creating 3 regular triangles out

 of the 3 edges of the triangle. For each new vertex of the regular triangle, draw a line from it

to the opposite triangle's vertex. These three lines intersect at the Fermat point.

pseudo code

create 3 new vectors out of the 3 triangle edges:

rotate the 3 vectors by -45 degrees;

create a point at the end;

complete the triangle;

draw a line from the new point to the opposite point of the triangle;

where all 3 lines intersect is the Fermat Point.

 

Reference

Fermat point Wikipedia

c o n c u r r e n c i e s blog (compared my app with his, did not look at his code)

Source code: P1 pv P1.zip

Built with Processing