3
$\begingroup$

If we have three masses $m_1,m_2,m_3$ (assuming that are all equal to $1$) located at $r_1,r_2,r_3$ respectively, then the center of mass is at $(1.00,0.83)$. In the Wolfram Documentation page says that the RegionCentroid is known as the center of mass, so if I make a triangle with vertices at $r_1,r_2,r_3$ the RegionCentroid should give me $(1.00,0.83)$ and this is not the case.

The code I used is the following

r1 = {0.5, 0.5}; r2 = {0.5, 1}; r3 = {2, 1}; 
m1 = 1; m2 = 1; m3 = 1;
r1Arrow = Arrow[{{0, 0}, r1}]; r2Arrow = Arrow[{{0, 0}, r2}]; r3Arrow = Arrow[{{0, 0}, r3}];

centroid = (m1 r1 + m2 r2 + m3 r3)/(m1 + m2 + m3); 
centroidArrow = Arrow[{{0, 0}, centroid}];
ρ = Line[{r1, r2, r3, r1}];

Graphics[
 {Thick, r1Arrow, r2Arrow, r3Arrow, {Red, centroidArrow}, Gray, ρ,
  Text[Style["m1", 30, Black], r1 + 0.1],
  Text[Style["m2", 30, Black], r2 + 0.1],
  Text[Style["m3", 30, Black], r3 + 0.1]},
 Epilog -> {PointSize[0.02], Point@centroid, Gray, Point@RegionCentroid[ρ]}
]

centroid == RegionCentroid[ρ]

enter image description here

where the black arrows are the position vectors of the masses, the red arrow is pointing to the center of mass position (black point) calculated with the formula and the gray point is the RegionCentroid result $(1.15,0.85)$.

If my understanding is correct, the center of mass formula and RegionCentroid should be the same, but clearly this is not happening. What am I missing?

$\endgroup$

1 Answer 1

9
$\begingroup$

Why are you taking the RegionCentroid of a Line object? If you take the RegionCentroid of the points, you get your expected result:

RegionCentroid[Point[{r1,r2,r3}]]

{1.,0.833333}

$\endgroup$
2
  • 1
    $\begingroup$ Ok, I understand now. I thought that making the triangle with Line would work, but is better to use Polygon or Point as you said. $\endgroup$
    – Verktaj
    Commented Nov 9, 2019 at 20:46
  • 1
    $\begingroup$ If you do use the Line object, RegionCentroid will calculate the center of mass of a rigid triangle made out of thin uniform-mass rods instead. This might be useful in some circumstance, but it won't be the same as the centroid of the vertices. $\endgroup$ Commented Nov 10, 2019 at 13:49

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.