ShaderPlane.h 459 B

123456789101112131415161718
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2025 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. JPH_Plane JPH_PlaneFromPointAndNormal(float3 inPoint, float3 inNormal)
  5. {
  6. return JPH_Plane(inNormal, -dot(inNormal, inPoint));
  7. }
  8. float3 JPH_PlaneGetNormal(JPH_Plane inPlane)
  9. {
  10. return inPlane.xyz;
  11. }
  12. float JPH_PlaneSignedDistance(JPH_Plane inPlane, float3 inPoint)
  13. {
  14. return dot(inPoint, inPlane.xyz) + inPlane.w;
  15. }