As part of a project at work I have to calculate the centroid of a set of points in 3D space. Right now I\'m doing it in a way that seems simple but naive -- by taking the avera
You vaguely mention "a way to get a more accurate centroid". Maybe you're talking about a centroid that isn't affected by outliers. For example, the average household income in the USA is probably very high, because a small number of very rich people skew the average; they are the "outliers". For that reason, statisticians use the median instead. One way to obtain the median is to sort the values, then pick the value halfway down the list.
Maybe you're looking for something like this, but for 2D or 3D points. The problem is, in 2D and higher, you can't sort. There's no natural order. Nevertheless, there are ways to get rid of outliers.
One way is to find the convex hull of the points. The convex hull has all the points on the "outside" of the set of points. If you do this, and throw out the points that are on the hull, you'll be throwing out the outliers, and the points that remain will give a more "representative" centroid. You can even repeat this process several times, and the result is kind like peeling an onion. In fact, it's called "convex hull peeling".