C******a 发帖数: 115 | 1 A是大的多边形,B是内部的多边形洞,C(A)和C(B)是各自的重心,
S(A)和S(B)是各自的面积。则A-B的重心是(C(A)S(A)-C(B)S(B))/(S(A)-S(B))。 | C******a 发帖数: 115 | 2 C(A),C(B),S(A),S(B)都是用分三角形的方法得到的,所以这也是间接的分三角法。
如果直接来也可以。一个图形由若干个封闭的折线段围成,给每个线段一个定向,
使得图形在此线段的左方。记每条线段为[Pi,Qi],1<=i<=n。
令Si=(Pi×Qi)/2,×是外积。Si是有向三角形OPiQi的面积。
令Ci=(O+Pi+Qi)/3,Ci是有向三角形OPiQi的重心。
整个图形的重心是(\sum SiCi)/(\sum Si)。 | h***o 发帖数: 539 | 3 假设实心的多边形重心在m1(x1, y1), 质量是m1, 空心部分的重心是
m2(x2, y2), 质量m2, 可以这样求合重心M(x, y), M = m1-m2:
将m1(x1, y1)分解成两个质点的合中心,其中一个质点质量及位置正好是
m2(x2, y2),而另一个质点的位置就是要求的重心位置M(x, y)了。
这下总简单了吧。
x = x2 + (x1 - x2) * m1 / (m1 - m2)
y = y2 + (y1 - y2) * m1 / (m1 - m2)
欢迎批评指正,呵呵
| a**u 发帖数: 99 | 4 能不能这样算一个多边形的重心?
选取一个中心为原点,如,取各点x坐标的平均,y坐标的平均.
把每个端点和该点相连,就形成乐N个三角形.
然后,调用N次计算三角形重心和重量的子程序.
得到(M_1,C_1),(M_2,C_2),……,(M_N,C_N)
M_i为重量,C_i=(x_i,y_i)为重心位置.
这样,该多边形的重心为
X=∑(M_i*x_i)/∑M_i
Y=∑(M_i*y_i)/∑M_i
同理,可以得到凹多边形的重心。
整个怪异多边形的重心则易得到。 | h****a 发帖数: 234 | 5 There must be an algorithm for the computer
to distinguish which
triangle is positive and which one is negative
For example if one marks the veritices of the
outer polygon counterclockwise as A1, A2 .. An
and choose some arbitrary point in the plane,
say O
then:
the triangle [O Ai Ai+1] would be positive if
OAi -> OAi+1 goes counterclockwise, and vice
versa.
Thus adding the masses and moments of OAiAi+1
i=1,2,..,n-1 will give the result for the
outside one.
Do the same for the inside one, and su |
|