什么是计算3D(或Nd)质心的最好方法是什么? [英] What's the best way to calculate a 3D (or n-D) centroid?

查看:497
本文介绍了什么是计算3D(或Nd)质心的最好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如在工作项目的一部分我要计算在三维空间中的一组点的质心。现在我做的,这似乎简单,但天真的方式 - 通过为各组点的平均值,如:

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 average of each set of points, as in:

centroid = average(x), average(y), average(z)

其中, X 以Z 是数组的浮点数。我似乎记得,有一种方式来获得更准确的质心,但我还没有找到一个简单的算法这样做。任何人有任何意见或建议?我使用Python这一点,但我能适应其他语言的例子。

where x, y and z are arrays of floating-point numbers. I seem to recall that there is a way to get a more accurate centroid, but I haven't found a simple algorithm for doing so. Anyone have any ideas or suggestions? I'm using Python for this, but I can adapt examples from other languages.

推荐答案

不,这是点的集合的质心的唯一公式。参见维基百科: http://en.wikipedia.org/wiki/Centroid

Nope, that is the only formula for the centroid of a collection of points. See Wikipedia: http://en.wikipedia.org/wiki/Centroid

这篇关于什么是计算3D(或Nd)质心的最好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆