ManifoldBetweenTwoFaces.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Jolt/Physics/Collision/Shape/ConvexShape.h>
  5. #include <Jolt/Physics/Collision/ContactListener.h>
  6. JPH_NAMESPACE_BEGIN
  7. /// Remove contact points if there are > 4 (no more than 4 are needed for a stable solution)
  8. /// @param inPenetrationAxis is the world space penetration axis (must be normalized)
  9. /// @param ioContactPointsOn1 The contact points on shape 1 relative to inCenterOfMass
  10. /// @param ioContactPointsOn2 The contact points on shape 2 relative to inCenterOfMass
  11. /// On output ioContactPointsOn1/2 are reduced to 4 or less points
  12. #ifdef JPH_DEBUG_RENDERER
  13. /// @param inCenterOfMass Center of mass position of body 1
  14. #endif
  15. void PruneContactPoints(Vec3Arg inPenetrationAxis, ContactPoints &ioContactPointsOn1, ContactPoints &ioContactPointsOn2
  16. #ifdef JPH_DEBUG_RENDERER
  17. , RVec3Arg inCenterOfMass
  18. #endif
  19. );
  20. /// Determine contact points between 2 faces of 2 shapes and return them in outContactPoints 1 & 2
  21. /// @param inContactPoint1 The contact point on shape 1 relative to inCenterOfMass
  22. /// @param inContactPoint2 The contact point on shape 2 relative to inCenterOfMass
  23. /// @param inPenetrationAxis The local space penetration axis in world space
  24. /// @param inSpeculativeContactDistanceSq Squared speculative contact distance, any contact further apart than this distance will be discarded
  25. /// @param inShape1Face The supporting faces on shape 1 relative to inCenterOfMass
  26. /// @param inShape2Face The supporting faces on shape 2 relative to inCenterOfMass
  27. /// @param outContactPoints1 Returns the contact points between the two shapes for shape 1 relative to inCenterOfMass (any existing points in the output array are left as is)
  28. /// @param outContactPoints2 Returns the contact points between the two shapes for shape 2 relative to inCenterOfMass (any existing points in the output array are left as is)
  29. #ifdef JPH_DEBUG_RENDERER
  30. /// @param inCenterOfMass Center of mass position of body 1
  31. #endif
  32. void ManifoldBetweenTwoFaces(Vec3Arg inContactPoint1, Vec3Arg inContactPoint2, Vec3Arg inPenetrationAxis, float inSpeculativeContactDistanceSq, const ConvexShape::SupportingFace &inShape1Face, const ConvexShape::SupportingFace &inShape2Face, ContactPoints &outContactPoints1, ContactPoints &outContactPoints2
  33. #ifdef JPH_DEBUG_RENDERER
  34. , RVec3Arg inCenterOfMass
  35. #endif
  36. );
  37. JPH_NAMESPACE_END