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