diff --git a/include/bounce/dynamics/contacts/contact_cluster.h b/include/bounce/dynamics/contacts/contact_cluster.h index e40b0b7..2635cd3 100644 --- a/include/bounce/dynamics/contacts/contact_cluster.h +++ b/include/bounce/dynamics/contacts/contact_cluster.h @@ -69,6 +69,9 @@ public: // void AddObservation(const b3Observation& observation); + // + u32 GetIterations() const; + // const b3Array& GetObservations() const; @@ -92,6 +95,8 @@ private: // u32 BestCluster(const b3Vec3& point) const; + u32 m_iterations; + b3StackArray m_observations; b3StackArray m_clusters; }; @@ -101,6 +106,11 @@ inline void b3ClusterSolver::AddObservation(const b3Observation& observation) m_observations.PushBack(observation); } +inline u32 b3ClusterSolver::GetIterations() const +{ + return m_iterations; +} + inline const b3Array& b3ClusterSolver::GetObservations() const { return m_observations; diff --git a/src/bounce/dynamics/contacts/contact_cluster.cpp b/src/bounce/dynamics/contacts/contact_cluster.cpp index e1e7862..ae65b31 100644 --- a/src/bounce/dynamics/contacts/contact_cluster.cpp +++ b/src/bounce/dynamics/contacts/contact_cluster.cpp @@ -201,7 +201,7 @@ void b3ReducePolygon(b3ClusterPolygon& pOut, b3ClusterSolver::b3ClusterSolver() { - + m_iterations = 0; } b3ClusterSolver::~b3ClusterSolver() @@ -443,6 +443,8 @@ void b3ClusterSolver::Solve() ++iter; } + m_iterations = iter; + // Remove empty clusters b3StackArray usedClusters;