# Finding vertex weight given the center of mass

I have a problem with given polygons. I am trying to figure out the vertex (or corner) weights. I do have the center of mass and the mass. Right now i tried simplifying the problem to a simple rectangle for text purpose. The real polygons have a lot more edges.

So my sample rectangle i used a 2d plane and the following coordinates : [0,0] [10,0] [10,5] [0,5] My center of mass is at [0.285,2.5] and weight 1000 units

For simplicity reason (you can calculate it if you want) the weight is centered in Y but the 2 left point has exactly 10% of the total distance if it add all distance from each corner to center of mass. So both left corner are 10% and both right corners are 40% this total to 100%. The problem i have the closest sides need to have more weight. Technically 4 times as much as the other sides. Both left side should have 400 weight unit and both right side corner need 100 weight unit.

I tried reversing the percentage but i end up with 90% and 60% and splitting the weight ends up obviously being way more than what i started with. I am wondering on how this can be done.

Overall i am looking for a way to nicely allocate more weight the closer the point is if it make any sense.

Call the vertices of your polygon $$(x_i, y_i)$$, and let $$d_i$$ be the distance from $$(x_i, y_i)$$ to the center of mass. The amount of mass we should distribute to $$(x_i, y_i)$$ is inversely proportional to its distance from the center of mass, so the fraction of the mass it should receive is $$\frac{1/d_i}{\sum_{j=1}^n 1/d_j},$$ and thus the mass that should be allocated to $$(x_i, y_i)$$ is $$\frac{1/d_i}{\sum_{j=1}^n 1/d_j} \cdot M,$$ where $$M$$ is the total mass you want across all the vertices.