compute COM taking non-uniform model into account
This commit is contained in:
@@ -974,12 +974,14 @@ public:
|
||||
/* Return the volume */
|
||||
btScalar getVolume() const;
|
||||
/* Cluster count */
|
||||
btVector3 getCenterOfMass() const{
|
||||
btVector3 com(0,0,0);
|
||||
for(int i = 0; i<m_nodes.size(); i++){
|
||||
com += m_nodes[i].m_x;
|
||||
btVector3 getCenterOfMass() const
|
||||
{
|
||||
btVector3 com(0, 0, 0);
|
||||
for (int i = 0; i < m_nodes.size(); i++)
|
||||
{
|
||||
com += (m_nodes[i].m_x / m_nodes[i].m_im);
|
||||
}
|
||||
com/=m_nodes.size();
|
||||
com /= this->getTotalMass();
|
||||
return com;
|
||||
}
|
||||
int clusterCount() const;
|
||||
|
||||
Reference in New Issue
Block a user