# Create a subdividing triangle to find it’s centroid in Java

I do not think there is any reason why anyone want to do this, but I will toss it out there.  I  had a class project to find the solution to the shortest path joining 3 points problem. I thought a subdividing triangle would make sense, but it just find it’s centroid (average the 3 points is the same).  After searching close to 50 pages i finial found it to be Fermat point.

This app was created using Processing , which is a low level graphic software that uses Java. You can drag any of the points.  Just in case you happen to know the simple algorithm for creating a subdividing it is:

pt D = A(A,B);     // taking average of 2 points  (pt A(pt A, pt B) {return P((A.x+B.x)/2,(A.y+B.y)/2);} )
pt E = A(C,B);
pt F = A(A,C);

while((d(D,E) > 1) && (d(D,F) > 1) && (d(E,F) > 1)){
G = A(D,E);   // taking average of 2 points  (pt A(pt A, pt B) {return P((A.x+B.x)/2,(A.y+B.y)/2);} )
H = A(D,F);
I = A(E,F);
D=G;     // store previous number
E=H;
F=I;
}

Posted by in Coding

Tags: ,

### Tags

Fabulou wholesale Petr Mrazek jersey is back. Best choice to get the wholesale Petr Mrazek jersey is suitable for all style of people.