What is the function to find the center of 3d triangle?

I have a three float[3] arrays. Each describing the location of a vertex. Now I need the center.

Does this look right?

FVector vertexActual = { v0[0] + v1[0] + v2[0] / 3, v0[1] + v1[1] + v2[1] / 3, v0[2] + v1[2] + v2[2] / 3 };

Just thought Iā€™d add a simplified semi-pseudo version:

FVector centroid = FVector(Point1.Location + Point2.Location + Point3.Location) /3;

1 Like