From: Patrik Gornicz Date: Wed, 21 Jan 2009 22:55:44 +0000 (-0500) Subject: refactor of CollisionInfo X-Git-Tag: physics-premerge~58 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=e86c86b38b25bcb463943dc166b60f236aa4af10;p=libbear.git refactor of CollisionInfo --- diff --git a/src/CollisionInfo.cpp b/src/CollisionInfo.cpp index e98bdb4..8098b0d 100644 --- a/src/CollisionInfo.cpp +++ b/src/CollisionInfo.cpp @@ -24,8 +24,8 @@ CollisionInfo::CollisionInfo() } -CollisionInfo::CollisionInfo(const Vector2& point, const Vector2& normal) - : point(point), normal(normal) +CollisionInfo::CollisionInfo(const Vector2& vecPoint, const Vector2& vecNormal) + : m_vecPoint(vecPoint), m_vecNormal(vecNormal) { } diff --git a/src/CollisionInfo.h b/src/CollisionInfo.h index 379373b..5d9f1f4 100644 --- a/src/CollisionInfo.h +++ b/src/CollisionInfo.h @@ -27,12 +27,12 @@ class CollisionInfo { public: CollisionInfo(); - CollisionInfo(const Vector2& point, const Vector2& normal); + CollisionInfo(const Vector2& vecPoint, const Vector2& vecNormal); ~CollisionInfo(); - Vector2 point; - Vector2 normal; + Vector2 m_vecPoint; + Vector2 m_vecNormal; }; #endif // COLLISIONINFO_H diff --git a/src/collisionManager.cpp b/src/collisionManager.cpp index 95a2193..72dcd6b 100644 --- a/src/collisionManager.cpp +++ b/src/collisionManager.cpp @@ -228,8 +228,8 @@ void applyCollision(Ball* b1, Ball* b2) return; // a few values to simplify the equations - const Vector2& normal = cInfo.normal; - const Vector2& point = cInfo.point; + const Vector2& normal = cInfo.m_vecNormal; + const Vector2& point = cInfo.m_vecPoint; float m1 = b1->mass; float m2 = b2->mass; @@ -259,7 +259,7 @@ void applyCollision(Polygon* pPoly, Ball* pBall) return; float fCoR = pBall->CoR; - Vector2 vecNorm = cInfo.normal; + Vector2 vecNorm = cInfo.m_vecNormal; Vector2 vecVelo = pBall->velocityRaw(); @@ -274,7 +274,7 @@ void applyCollision(Polygon* pPoly, Ball* pBall) // from center to point Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->radius; - pBall->applyNudge(cInfo.point + vecCollP - pBall->positionRaw()); + pBall->applyNudge(cInfo.m_vecPoint + vecCollP - pBall->positionRaw()); } bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo) @@ -305,8 +305,8 @@ bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo) if ((v1 - v2).dot(p1 - p2) >= 0) return false; - pcInfo->point = p1 - (p1 - p2) * r1 / (r1 + r2); - pcInfo->normal = p1 - p2; + pcInfo->m_vecPoint = p1 - (p1 - p2) * r1 / (r1 + r2); + pcInfo->m_vecNormal = p1 - p2; return true; } @@ -356,8 +356,8 @@ bool getInfo(const Polygon* pPoly, const Ball* pBall, CollisionInfo* pcInfo) return false; - pcInfo->point = vecTotVec / iTot + vecPos; - pcInfo->normal = vecPos - pcInfo->point; + pcInfo->m_vecPoint = vecTotVec / iTot + vecPos; + pcInfo->m_vecNormal = vecPos - pcInfo->m_vecPoint; return true; }