From ca660b5057d531908809895eb356e4726b3de577 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Wed, 5 Nov 2014 20:52:21 +0100 Subject: [PATCH] Replace some matrix multiplications by quaternion multiplications --- src/collision/narrowphase/EPA/EPAAlgorithm.cpp | 2 +- src/collision/narrowphase/GJK/GJKAlgorithm.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/collision/narrowphase/EPA/EPAAlgorithm.cpp b/src/collision/narrowphase/EPA/EPAAlgorithm.cpp index 45ca8446..8c6e7b77 100644 --- a/src/collision/narrowphase/EPA/EPAAlgorithm.cpp +++ b/src/collision/narrowphase/EPA/EPAAlgorithm.cpp @@ -392,7 +392,7 @@ bool EPAAlgorithm::computePenetrationDepthAndContactPoints(const Simplex& simple } while(nbTriangles > 0 && triangleHeap[0]->getDistSquare() <= upperBoundSquarePenDepth); // Compute the contact info - v = transform1.getOrientation().getMatrix() * triangle->getClosestPoint(); + v = transform1.getOrientation() * triangle->getClosestPoint(); Vector3 pALocal = triangle->computeClosestPointOfObject(suppPointsA); Vector3 pBLocal = body2Tobody1.getInverse() * triangle->computeClosestPointOfObject(suppPointsB); Vector3 normal = v.getUnit(); diff --git a/src/collision/narrowphase/GJK/GJKAlgorithm.cpp b/src/collision/narrowphase/GJK/GJKAlgorithm.cpp index 393830bf..a9cd6c4d 100644 --- a/src/collision/narrowphase/GJK/GJKAlgorithm.cpp +++ b/src/collision/narrowphase/GJK/GJKAlgorithm.cpp @@ -133,7 +133,7 @@ bool GJKAlgorithm::testCollision(ProxyShape* collisionShape1, ProxyShape* collis pB = body2Tobody1.getInverse() * (pB + (collisionShape2->getMargin() / dist) * v); // Compute the contact info - Vector3 normal = transform1.getOrientation().getMatrix() * (-v.getUnit()); + Vector3 normal = transform1.getOrientation() * (-v.getUnit()); decimal penetrationDepth = margin - dist; // Reject the contact if the penetration depth is negative (due too numerical errors) @@ -165,7 +165,7 @@ bool GJKAlgorithm::testCollision(ProxyShape* collisionShape1, ProxyShape* collis pB = body2Tobody1.getInverse() * (pB + (collisionShape2->getMargin() / dist) * v); // Compute the contact info - Vector3 normal = transform1.getOrientation().getMatrix() * (-v.getUnit()); + Vector3 normal = transform1.getOrientation() * (-v.getUnit()); decimal penetrationDepth = margin - dist; // Reject the contact if the penetration depth is negative (due too numerical errors) @@ -195,7 +195,7 @@ bool GJKAlgorithm::testCollision(ProxyShape* collisionShape1, ProxyShape* collis pB = body2Tobody1.getInverse() * (pB + (collisionShape2->getMargin() / dist) * v); // Compute the contact info - Vector3 normal = transform1.getOrientation().getMatrix() * (-v.getUnit()); + Vector3 normal = transform1.getOrientation() * (-v.getUnit()); decimal penetrationDepth = margin - dist; // Reject the contact if the penetration depth is negative (due too numerical errors) @@ -232,7 +232,7 @@ bool GJKAlgorithm::testCollision(ProxyShape* collisionShape1, ProxyShape* collis pB = body2Tobody1.getInverse() * (pB + (collisionShape2->getMargin() / dist) * v); // Compute the contact info - Vector3 normal = transform1.getOrientation().getMatrix() * (-v.getUnit()); + Vector3 normal = transform1.getOrientation() * (-v.getUnit()); decimal penetrationDepth = margin - dist; // Reject the contact if the penetration depth is negative (due too numerical errors)