s*a 发帖数: 33 | 1 One approach maybe: divide the 多边形 into (n-2) triangulars,
then the mass (area) and the position of the center of mass
of each triangular is known. Now the problem becomes to find
the CM of (n-2) points and could be easily done. | C******a 发帖数: 115 | 2 假设顶点按某方向排列是(x1,y1),(x2,y2),...,(xn,yn).
令ai=xi*y(i+1)-x(i+1)*yi, Xi=(xi+x(i+1))/3, Yi=(yi+y(i+1))/3.
其中x(n+1)=x1, y(n+1)=y1.
则重心可能是((a1X1+...+anXn)/(a1+...+an), (a1Y1+...+anYn)/(a1+...+an))。
至少在凸多边形且原点在形内时这是正确的。一般情形可能也对,还没证明。 | s*a 发帖数: 33 | 3 The division into triangulars is not a problem. Assume 顶点s are labled
as A1, A2, ..., An. Then can always choose A1A2A3, A1A3A4, ..., A1A(n-1)An.
When calculating the area of each triangular, remember it can be either
positive or negative (based on the particular ordering of the three
end points AiAjAk), which means each triangular can either have a positive
mass or a negative mass. This will take care of 凹多边形.
Of course, if catalina's formula is correct, then that is easier. :) | C******a 发帖数: 115 | 4 ai是有向三角形((0,0),(xi,yi),(x(i+1),y(i+1))的面积的两倍。
(Xi,Yi)是此三角形的重心。 | b***n 发帖数: 6 | 5
(a1Y1+...+anYn)/(a1+...+an))。
明。
takes
of
Assuming density to be 1, the area under (x1,y1) to (x2,y2) is
integral from x1 to x2: (y2-y1)/(x2-x1) *(x-x1) +y1 dx. Add all them
together is the area, or say mass.
Add a factor x to the integral, we get the x torque to the origin
(0,0), divided by area(mass) is the x cordinate of center of mass.
switch x and y in the result we can get y.
【在 C******a 的大作中提到】 : ai是有向三角形((0,0),(xi,yi),(x(i+1),y(i+1))的面积的两倍。 : (Xi,Yi)是此三角形的重心。
|
|