 # From center of mass to individual points with mass

Hi all,

calculating from a bunsh of point with different mass the center of mass can be done like this is there a way to calculate m1,m2,m3 etc. if Xcom,Ycom,Mass_com and all individual point positions are known ?.

Not if you have more than about 2 masses, I think, because you only have 2 equations…

1 Like

Your total mass equation gives you a third equation so you could get an answer with 3 points.
You might be able to find more, if you have some rotational information like moment of inertia.

I think if you have more points there is probably not one unique solution. I’m not 100% sure it would work, but it might be fun to try seeing if Galapagos can help you find valid solutions.

True,
one with geometry solution.

``````import Rhino as rh

a = []
for i in x:
L = []
for j in x:
if i != j:
L.append(j)
Li1 = rh.Geometry.Line(i,y)
Li2 = rh.Geometry.Line(L,L)
t = rh.Geometry.Intersect.Intersection.LineLine(Li1,Li2)
IntPt = Li2.PointAt(t)
IntDis = rh.Geometry.Point3d.DistanceTo(IntPt,y)
Dis = rh.Geometry.Point3d.DistanceTo(i,IntPt)
weight = IntDis/Dis
a.append(weight)
`````` one with a matrix solution

``````import os
location = os.path.join(os.path.expanduser("~"),
'C:/Users/Florian/Desktop/MathNet.Numerics/lib/net40/MathNet.Numerics.dll')

import MathNet.Numerics.LinearAlgebra as la
from System import Array as sys_array
def array(*x): return sys_array[float](x)

A = la.Double.Matrix.Build.DenseOfRowArrays(
array(*[i.X for i in x]),
array(*[i.Y for i in x]),
array(*(1,1,1))
)

b = la.Double.Vector.Build.DenseOfArray(array(y,y,1))

a = A.Solve(b)
``````

Both solutions gives the same results

I ask myself if triangles between 4 points could be made if the mass point is in between.
So 4 points with 1 mass point gives 2 triangles. and in suspension points with two results i would divide the sum by the amount of triangles to get the average.
A exact solution is not required only a non optimum solution is good enougth.
My onkel gives me already a solution to deal with 4 points but i was not able to build the equations with his explenation…maybe someone give it a try.

The translated text is this.

Assuming that the individual masses in the quadrants are equal and add up to a sum (M1, M2, M3, M4).
M1, M2, M3, M4 = Sum of the (same) masses in the respective quadrant
X1, X2, X3, X4 = X coordinate of the centers of mass of M1, M2, M3 …
ie. the mean distances of the X - axis in the respective quadrant
Y1, Y2, Y3, Y4 = Y coordinates of the center of gravity of M1, M2 …
ie. the mean distances from the Y axis in the respective quadrant
(all distance values as amount positive!)
G = total weight in the coordinate origin = M1 + M2 + M3 + M4

If you let the masses (weights) turn around the X- and Y-axis follows
Equation system with 4 unknowns: