From eef0fd0ab59edf89868ec026b09214abfa0f6d3b Mon Sep 17 00:00:00 2001 From: Ye Han <ye.han@khq.kitware.com> Date: Tue, 3 Nov 2020 15:26:35 -0500 Subject: [PATCH] BUG: Fix mismatch between point-capsule CD and vtkSource --- .../CollisionDetection/imstkNarrowPhaseCD.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/CollisionDetection/CollisionDetection/imstkNarrowPhaseCD.cpp b/Source/CollisionDetection/CollisionDetection/imstkNarrowPhaseCD.cpp index d6fe6dcea..7a1977184 100644 --- a/Source/CollisionDetection/CollisionDetection/imstkNarrowPhaseCD.cpp +++ b/Source/CollisionDetection/CollisionDetection/imstkNarrowPhaseCD.cpp @@ -254,9 +254,9 @@ pointToCapsule(const Vec3r& point, uint32_t pointIdx, Capsule* const capsule, // Get position of end points of the capsule // TODO: Fix this issue of extra computation in future - const Vec3d p0 = capsulePos; - const Vec3d p1 = p0 + capsule->getOrientationAxis() * length; - const Vec3d mid = 0.5 * (p0 + p1); + const Vec3d mid = capsulePos; + const Vec3d p1 = mid + 0.5 * capsule->getOrientationAxis() * length; + const Vec3d p0 = 2 * mid - p1; const Vec3d p = p1 - p0; const auto pDotp = p.dot(p); const auto pDotp0 = p.dot(p0); -- GitLab