How do I calculate a 3D centroid?

后端 未结 4 1594
眼角桃花
眼角桃花 2020-12-16 03:11

Is there even such a thing as a 3D centroid? Let me be perfectly clear—I\'ve been reading and reading about centroids for the last 2 days both on this site and across the we

4条回答
  •  情书的邮戳
    2020-12-16 04:09

    You will have to recreate face information from the vertices (essentially a Delauney triangulation).

    If your vertices define a convex hull, you can pick any arbitrary point A inside the object. Treat your object as a collection of pyramidal prisms having apex A and each face as a base.

    For each face, find the area Fa and the 2d centroid Fc; then the prism's mass is proportional to the volume (== 1/3 base * height (component of Fc-A perpendicular to the face)) and you can disregard the constant of proportionality so long as you do the same for all prisms; the center of mass is (2/3 A + 1/3 Fc), or a third of the way from the apex to the 2d centroid of the base.

    You can then do a mass-weighted average of the center-of-mass points to find the 3d centroid of the object as a whole.

    The same process should work for non-convex hulls - or even for A outside the hull - but the face-calculation may be a problem; you will need to be careful about the handedness of your faces.

提交回复
热议问题