MATLAB: Triangle centroid

geometric barycentertriangle centroid

Hello, do you somebody know any simlpe method how to find the triangle centroid (or geometric barycenter) in 3D?
Thanks a lot,
Tom

Best Answer

Just average all the coordinates. For example, if you have a vector containing x coordinates and a vector containing y coordinates, you can find it in the following manner.
x = rand(3,1); % x-coordinate
y = rand(3,1); % y-coordinate
x_centroid = mean(x);
y_centroid = mean(y);