Esempio n. 1
0
 Vector3d Skeleton::getWorldCOM() {
     assert(mMass != 0);
     Vector3d com(0, 0, 0);
     const int nNodes = getNumNodes();
     for(int i = 0; i < nNodes; i++) {
         BodyNode* node = getNode(i);
         com += (node->getMass() * node->getWorldCOM());
     }
     return com / mMass;
 }
Esempio n. 2
0
Eigen::Vector3d Skeleton::getWorldCOM()
{
    Eigen::Vector3d com(0, 0, 0);

    assert(mTotalMass != 0);
    const int nNodes = getNumBodyNodes();

    for(int i = 0; i < nNodes; i++)
    {
        BodyNode* bodyNode = getBodyNode(i);
        com += (bodyNode->getMass() * bodyNode->getWorldCOM());
    }

    return com / mTotalMass;
}