1

我正在为 BeamNG 开发一个应用程序,其中用户输入其物理结构的重心和总重量,然后程序将加载结构的所有 XYZ 位置并在 KG 中单独加权每个点。

有人有这背后的数学吗?该程序会将每个点加载到 XYZ 坐标中,并具有坐标计数,并且它还将在 XYZ 坐标中具有重心。

4

2 回答 2

1

假设每个点 XYZ 是 Pi = (xi,yi,zi) 并且每个点的权重是 Wi,您可以这样计算 CoG = (xc, yc, zc):

xc = ( W1*x1 + W2*x2 + ... + Wn*xn ) / ( W1 + W2 + .... + Wn )

yc = ( W1*y1 + W2*y2 + ... + Wn*yn ) / ( W1 + W2 + .... + Wn )

zc = ( W1*z1 + W2*z2 + ... + Wn*zn ) / ( W1 + W2 + .... + Wn )
于 2015-03-19T20:01:37.623 回答
0

I would try to do it like this:

  1. compute CoG.x
  2. compare it with predefined CoG0.x
    • if not zero then shift some weight from left to right
    • or reverse (dependent on CoG0.x-Cog.x sign)
    • scale weight amount by the CoG0.x-Cog.x magnitude
    • and by distance of source and destination mass point position from CoG0
    • this can also be done by uniformly changing all points not just two
    • just divide points by relative position to CoG0 to left and right ...
  3. loop and increase accuracy up to some treshold/recursion layer...
  4. process y,z coordinates in the same way
  5. when done loop the whole thing few times to iteratively get close to result
    • because approximating each axis can change the other ones
    • to avoid that you should choose points close to x,y,z axises
于 2015-03-20T07:49:15.433 回答