Debian Codegraph @

thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.h

raw symbols SCIP
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/Geometry/AABox.h>
8 #include <Jolt/Physics/Collision/Shape/Shape.h>
9 #include <Jolt/Physics/Collision/Shape/SubShapeID.h>
10 #include <Jolt/Physics/Collision/Shape/ConvexShape.h>
11
12 JPH_NAMESPACE_BEGIN
13
14 class CollideShapeSettings;
15
16 /// Collision detection helper that collides a convex object vs one or more triangles
17 class JPH_EXPORT CollideConvexVsTriangles
18 {
19 public:
20 /// Constructor
21 /// @param inShape1 The convex shape to collide against triangles
22 /// @param inScale1 Local space scale for the convex object (scales relative to its center of mass)
23 /// @param inScale2 Local space scale for the triangles
24 /// @param inCenterOfMassTransform1 Transform that takes the center of mass of 1 into world space
25 /// @param inCenterOfMassTransform2 Transform that takes the center of mass of 2 into world space
26 /// @param inSubShapeID1 Sub shape ID of the convex object
27 /// @param inCollideShapeSettings Settings for the collide shape query
28 /// @param ioCollector The collector that will receive the results
29 CollideConvexVsTriangles(const ConvexShape *inShape1, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeID &inSubShapeID1, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector);
30
31 /// Collide convex object with a single triangle
32 /// @param inV0 , inV1 , inV2: CCW triangle vertices
33 /// @param inActiveEdges bit 0 = edge v0..v1 is active, bit 1 = edge v1..v2 is active, bit 2 = edge v2..v0 is active
34 /// An active edge is an edge that is not connected to another triangle in such a way that it is impossible to collide with the edge
35 /// @param inSubShapeID2 The sub shape ID for the triangle
36 void Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 inActiveEdges, const SubShapeID &inSubShapeID2);
37
38 protected:
39 const CollideShapeSettings & mCollideShapeSettings; ///< Settings for this collision operation
40 CollideShapeCollector & mCollector; ///< The collector that will receive the results
41 const ConvexShape * mShape1; ///< The shape that we're colliding with
42 Vec3 mScale1; ///< The scale of the shape (in shape local space) of the shape we're colliding with
43 Vec3 mScale2; ///< The scale of the shape (in shape local space) of the shape we're colliding against
44 Mat44 mTransform1; ///< Transform of the shape we're colliding with
45 Mat44 mTransform2To1; ///< Transform that takes a point in space of the colliding shape to the shape we're colliding with
46 AABox mBoundsOf1; ///< Bounds of the colliding shape in local space
47 AABox mBoundsOf1InSpaceOf2; ///< Bounds of the colliding shape in space of shape we're colliding with
48 SubShapeID mSubShapeID1; ///< Sub shape ID of colliding shape
49 float mScaleSign2; ///< Sign of the scale of object 2, -1 if object is inside out, 1 if not
50 ConvexShape::SupportBuffer mBufferExCvxRadius; ///< Buffer that holds the support function data excluding convex radius
51 ConvexShape::SupportBuffer mBufferIncCvxRadius; ///< Buffer that holds the support function data including convex radius
52 const ConvexShape::Support * mShape1ExCvxRadius = nullptr; ///< Actual support function object excluding convex radius
53 const ConvexShape::Support * mShape1IncCvxRadius = nullptr; ///< Actual support function object including convex radius
54 };
55
56 JPH_NAMESPACE_END