2
$\begingroup$

Given a list of 3D coordinates that define the surface( Point3D1, Point3D2, Point3D3, and so on), how to calculate the centroid of the surface?

More specifically, I am looking for a natural extension of the following 2D centroid algorithm in 3 or more dimension:

alt text alt text

alt text

Any idea?

P/S: All the points are coplanar, this is the assumption.

$\endgroup$
10
  • 1
    $\begingroup$ Before asking for the centroid of a surface bounded by a polygonal cycle, you should define more clearly what the surface is. Are all the vertices required to lie on the same plane as each other, so you really just have a 2d polygon embedded into 3d? Or are you trying to describe non-flat 3d surfaces? $\endgroup$ Mar 4, 2010 at 3:14
  • 1
    $\begingroup$ I don't think this question is well-defined unless all your points are coplanar. In that case you'd probably just want to project down onto R^2. $\endgroup$ Mar 4, 2010 at 3:16
  • 9
    $\begingroup$ Then the centroid sits over the centroid of its projection to any plane. So, you can use the formulas for two coordinates to compute each coordinate for the centroid. $\endgroup$ Mar 4, 2010 at 6:43
  • 2
    $\begingroup$ to add to what Douglas says, since the points are coplanar, just find that plane and rotate the object so it's in the x,y plane, and proceed as before $\endgroup$ Mar 18, 2010 at 20:18
  • 2
    $\begingroup$ To subtract from what Suresh says, you don't need to rotate anything. Just project onto the (x,y)-plane to get the x- and y-coordinates, and project onto the (x,z)-plane to get the z-coordinate. $\endgroup$
    – TonyK
    May 4, 2010 at 20:30

4 Answers 4

6
$\begingroup$

In response to JBL's comment, I offer this answer merely to close out this topic. It has been effectively answered in the comments: Simply project to xy and to xz and compute the centroid there. (One tiny wrinkle not addressed is if the polygon lies in a plane perpendicular to xy or to xz. But then simply chose the coordinate planes in which it does not lie.)

On the advice of Andrew Stacey, I am designating this answer "community wiki," and hope that someone will vote it up so it will no longer be bumped to the top of the active list by the MO background process.

$\endgroup$
3
  • $\begingroup$ Well, I would have voted you up in any case. :) Mentioning the "extra wrinkle" is good, too. $\endgroup$
    – JBL
    Jun 16, 2010 at 13:02
  • $\begingroup$ I think you meant 'perpendicular', not 'parallel'. Another wrinkle is that this method generates two values for the x-coordinate of the centroid, and you have to decide what to do when they are not equal due to rounding errors. Probably you should take the one that came from the 'least perpendicular' projection, i.e. the one with the greater area A. $\endgroup$
    – TonyK
    Jun 17, 2010 at 18:41
  • $\begingroup$ @TonyK: Thanks for the correction, now edited. In practice I have simply averaged the two x-coordinates, although your method may be more accurate. $\endgroup$ Jun 29, 2010 at 11:25
2
$\begingroup$

These formulas could be deduced using Green's theorem . For example the formula used to compute the polygon's area is proved using the vector field F=(-y/2,x/2).

Maybe you can do the same in the space using analogous vector fields and Stokes' theorem .

$\endgroup$
0
$\begingroup$

I'm not sure about the centroid of the surface area, but I might be able to help with the centroid of it's enclosed volume under some specific circumstances.

If each surface formed by the points creates a triangle (as is the case with the vast majority of computer related applications) then you can use this method that i outlined in StackOverflow (i understand its not in the from a mathematician would like it in, but if you read the explanation the answer is fairly simple).

https://stackoverflow.com/questions/2083771/a-method-to-calculate-the-centre-of-mass-from-a-stl-stereo-lithography-file

Hopefully that helps

$\endgroup$
0
$\begingroup$

It seems easiest to give up on the centroid and simply find the average of the vertices of the planar figure you want to find the "center" of. I have a demo program: http://www.mjmtools.com/webgl/tutorial/rhombicTriacontahedron/index.html

With it you can load 3D shapes, and then display new shapes based on the centroid of the each face (using the projection method outlined in the other answers) and you can also display new shapes using the simple vertex average of each face. You can see by visual inspection they are the same, even for shapes with irregular faces (e.g. the Tetartoid.)

Interested to dig deeper and see why these produce the same results.

$\endgroup$
1
  • $\begingroup$ Actually upon further review there is a slight difference between the centroid method and the average vertex method on the faces of the tetartoid - the faces of which are irregular pentagons. The difference is very slight, so I think the advice still holds, as the goal I think was to just roughly center a label. $\endgroup$
    – Max Mammel
    Oct 6, 2016 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.