Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/jolt_physics/Jolt/Physics/Collision/ManifoldBetweenTwoFaces.h
9912 views
1
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3
// SPDX-License-Identifier: MIT
4
5
#pragma once
6
7
#include <Jolt/Physics/Collision/Shape/ConvexShape.h>
8
#include <Jolt/Physics/Collision/ContactListener.h>
9
10
JPH_NAMESPACE_BEGIN
11
12
/// Remove contact points if there are > 4 (no more than 4 are needed for a stable solution)
13
/// @param inPenetrationAxis is the world space penetration axis (must be normalized)
14
/// @param ioContactPointsOn1 The contact points on shape 1 relative to inCenterOfMass
15
/// @param ioContactPointsOn2 The contact points on shape 2 relative to inCenterOfMass
16
/// On output ioContactPointsOn1/2 are reduced to 4 or less points
17
#ifdef JPH_DEBUG_RENDERER
18
/// @param inCenterOfMass Center of mass position of body 1
19
#endif
20
JPH_EXPORT void PruneContactPoints(Vec3Arg inPenetrationAxis, ContactPoints &ioContactPointsOn1, ContactPoints &ioContactPointsOn2
21
#ifdef JPH_DEBUG_RENDERER
22
, RVec3Arg inCenterOfMass
23
#endif
24
);
25
26
/// Determine contact points between 2 faces of 2 shapes and return them in outContactPoints 1 & 2
27
/// @param inContactPoint1 The contact point on shape 1 relative to inCenterOfMass
28
/// @param inContactPoint2 The contact point on shape 2 relative to inCenterOfMass
29
/// @param inPenetrationAxis The local space penetration axis in world space
30
/// @param inMaxContactDistance After face 2 is clipped against face 1, each remaining point on face 2 is tested against the plane of face 1. If the distance on the positive side of the plane is larger than this distance, the point will be discarded as a contact point.
31
/// @param inShape1Face The supporting faces on shape 1 relative to inCenterOfMass
32
/// @param inShape2Face The supporting faces on shape 2 relative to inCenterOfMass
33
/// @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)
34
/// @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)
35
#ifdef JPH_DEBUG_RENDERER
36
/// @param inCenterOfMass Center of mass position of body 1
37
#endif
38
JPH_EXPORT void ManifoldBetweenTwoFaces(Vec3Arg inContactPoint1, Vec3Arg inContactPoint2, Vec3Arg inPenetrationAxis, float inMaxContactDistance, const ConvexShape::SupportingFace &inShape1Face, const ConvexShape::SupportingFace &inShape2Face, ContactPoints &outContactPoints1, ContactPoints &outContactPoints2
39
#ifdef JPH_DEBUG_RENDERER
40
, RVec3Arg inCenterOfMass
41
#endif
42
);
43
44
JPH_NAMESPACE_END
45
46