Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有N分。每个点都有 X 和 Y 坐标。
我需要找到这个点的质心 X 和 Y。你能给我一个算法来完成这个任务吗?
仅按质量取加权平均值有什么问题吗?
for each point n { totalmass += n.mass totalx += n.x*n.mass totaly += n.y*n.mass } center = (totalx/totalmass,totaly/totalmass)
根据需要添加其他尺寸。