Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the centroid of a polygon with weighted vertices

I know how to find the centroid (center of mass) of a regular polygon. This assumes that every part of the polygon weighs the same. But how do I calculate the centroid of a weightless polygon (made from aerogel perhaps :), where each vertex has a weight?

Simplified illustration of what I mean using straight line:

5kg-----------------5kg
           ^center of gravity

10kg---------------5kg
        ^center of gravity offset du to weight of vertices

Of course, I know how to calculate the center of gravity on a straight line with weighted vertices, but how do I do it on a polygon with weighted vertices?

Thanks for your time!

like image 860
Calle Kabo Avatar asked May 14 '10 08:05

Calle Kabo


People also ask

How do you find the weighted centroid?

The Weighted Mean Center is calculated by multiplying the x and y coordinate by the weight for that feature and summing all for both x and y individually, and then dividing this by the sum of all the weights.

How do you find the centroid given vertices?

To find the centroid, follow these steps: Step 1: Identify the coordinates of each vertex. Step 2: Add all the x values from the three vertices coordinates and divide by 3. Step 3: Add all the y values from the three vertices coordinates and divide by 3.

How do you find the center of gravity of a polygon?

The general method for finding the center of gravity of a polygon is to use its diagonals to split it into several triangles and then find the intersection of the lines connecting the centroids of the pairs of triangles that share a common diagonal [1,2].


2 Answers

You want take a weighted average over all the vertices. So say your vertices are v1, v2, v3 .... vn with masses m1, m2 ...mn and have x and y coordinates v1x, v1y, v2x, v2y etc then to get the center of mass (cx, cy) you want:

cx = (v1x*m1 + v2x*m2 + ... vnx*mn) / (m1 + m2 .... mn) 
cy = (v1y*m1 + v2y*m2 + ... vny*mn) / (m1 + m2 .... mn)

It's essentially the same principle as when you do it for a line.

like image 175
pheelicks Avatar answered Oct 12 '22 18:10

pheelicks


1) Generate a vector for each vertex

2) Multiply each vector for the weight of the vertex

3) Sum the vectors

4) Divide for total mass

5) There's your center of mass!

like image 41
nico Avatar answered Oct 12 '22 16:10

nico