< Summary

Line coverage
100%
Covered lines: 830
Uncovered lines: 0
Coverable lines: 830
Total lines: 1393
Line coverage: 100%
Branch coverage
100%
Covered branches: 333
Total branches: 333
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: IntersectsForContinuousCollision(...)100%6464100%
File 1: AppendMeshEmbedded2D(...)100%1818100%
File 1: AppendMeshCircleSlabContacts(...)100%11100%
File 1: AppendMeshSlabContacts(...)100%2626100%
File 1: TryAppendConvexMeshPrismContacts(...)100%88100%
File 1: FillPrismGeometry(...)100%66100%
File 2: TryCollide(...)100%22100%
File 2: TryBuildManifold(...)100%11100%
File 2: TryBuildDiscreteManifold(...)100%11100%
File 2: AppendManifold(...)100%5252100%
File 2: TryPrimitiveContact(...)100%77100%
File 2: TrySphereEmbedded2D(...)100%1818100%
File 2: TryCapsuleEmbedded2D(...)100%1010100%
File 2: TryCylinderEmbedded2D(...)100%1010100%
File 2: TryConeEmbedded2D(...)100%1010100%
File 2: TryGetCapsuleCircleSlabContact(...)100%22100%
File 2: TryTestCylinderCircleSlab(...)100%22100%
File 2: TryTestConeCircleSlab(...)100%66100%
File 2: TryTestCylinderCapsuleSlab(...)100%1212100%
File 2: TryTestConeCapsuleSlab(...)100%1010100%
File 2: CheckConeCircleSlabAxis(...)100%44100%
File 2: CheckCylinderPrismAxis(...)100%44100%
File 2: CheckConePrismAxis(...)100%44100%
File 2: KeepAxisPenetration(...)100%44100%
File 2: CheckEmbeddedCapsuleAxes(...)100%22100%
File 2: CheckEmbeddedCapsuleAxes(...)100%22100%
File 2: CheckCylinderEmbeddedCapsuleEdgeAxis(...)100%11100%
File 2: CheckConeEmbeddedCapsuleEdgeAxis(...)100%11100%
File 2: BuildCylinderContact(...)100%11100%
File 2: BuildConeContact(...)100%11100%
File 2: BuildCanonicalSupportContact(...)100%11100%
File 3: TryCuboidEmbedded2D(...)100%66100%
File 3: TryGetCuboidPrismContact(...)100%11100%
File 3: TryGetCuboidRelationContact(...)100%22100%
File 3: TryGetSphereConvexPrismContact(...)100%11100%
File 3: TryGetCapsuleConvexPrismContact(...)100%11100%
File 3: TryGetCylinderConvexPrismContact(...)100%11100%
File 3: TryGetConeConvexPrismContact(...)100%11100%
File 3: GetConvexPrismOffsets(...)100%1010100%
File 3: TryBuildFinitePrismContact(...)100%22100%
File 4: TryGetRotationalSeparationGap(...)100%88100%
File 4: TryGetSpherePolygonSlabSeparationGap(...)100%66100%
File 4: TryGetPolygonExteriorGap(...)100%66100%
File 4: TryGetPointIntervalGap(...)100%11100%
File 4: TryGetIntervalGap(...)100%44100%
File 5: TryNormalizeAxis(...)100%22100%
File 5: GetEmbeddedCenter3D(...)100%11100%
File 5: GetEmbeddedCapsuleAxes(...)100%22100%
File 5: GetRigidUpAxis(...)100%11100%
File 5: ResolveFallbackNormal(...)100%22100%
File 5: NoContact(...)100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Detection/Mixed/CollisionDetectionMixed.Complex.cs

#LineLine coverage
 1//=======================================================================
 2// CollisionDetectionMixed.Complex.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using FixedMathSharp;
 10using FixedMathSharp.Geometry;
 11using Gravitas.Colliders;
 12using SwiftCollections;
 13using SwiftCollections.Query;
 14
 15namespace Gravitas.CollisionHandling;
 16
 17/// <content>Builds independent finite mesh/slab regions without treating authored seams as physical features.</content>
 18public static partial class CollisionDetectionMixed
 19{
 20    // Interval probes need exact admission; depth, anchors and closing rows are
 21    // materialized once at the retained witness using the ordinary manifold path.
 22    internal static bool IntersectsForContinuousCollision(LSCollider collider3D, LSCollider2D embedded,
 23        Fixed64 padding = default, int surfaceOwner = -1, MeshSlabFaceRegions? handledFaces = null)
 24    {
 1647425        if (collider3D is not LSMeshCollider mesh
 1647426            || embedded is not (LSCircleCollider2D or LSCapsuleCollider2D or LSAABBoxCollider2D or LSPolygonCollider2D)
 1647427            || mesh.Mode == MeshColliderMode.Convex && mesh.IsClosedSurface)
 28            // A boundary-only query cannot exclude a solid hull's interior.
 1525029            return padding > Fixed64.Zero || TryBuildManifold(collider3D, embedded, collider3D.Context.CollisionScratch.
 122430        Fixed64 length = embedded is LSCapsuleCollider2D capsule ? capsule.AxisLength : Fixed64.Zero;
 122431        Fixed64 radius = embedded is LSCircleCollider2D circle ? circle.ScaledRadius
 122432            : embedded is LSCapsuleCollider2D stadium ? stadium.ScaledRadius : Fixed64.Zero;
 122433        Fixed64 halfThickness = embedded.MixedHalfThickness;
 122434        Vector3d center = GetEmbeddedCenter3D(embedded);
 122435        FixedBoundBox bounds = embedded.MixedBounds3D;
 122436        if (padding > Fixed64.Zero)
 37        {
 38            // This is an interval enclosure, never physical admission. A world
 39            // motion ball fits inside a stadium enlarged radially and at both caps.
 49740            if (embedded is not (LSCircleCollider2D or LSCapsuleCollider2D)
 49741                || !Fixed64.TryAdd(radius, padding, out radius)
 49742                || !Fixed64.TryAdd(halfThickness, padding, out halfThickness)
 56543                || !Fixed64.TryAdd(embedded.CanonicalCenteredProxyRadius, padding, out Fixed64 reach)) return true;
 44            // The existing affine section kernel proves these widths. Wider
 45            // trusted search padding remains unresolved rather than being capped.
 42946            if (!mesh.Mesh.GeometryFrame.IsRigid && (radius > ColliderGeometryPolicy.MaximumGeometryReach
 43147                || halfThickness > ColliderGeometryPolicy.MaximumGeometryReach)) return true;
 42748            Vector3d scope = new(reach, halfThickness, reach);
 42749            if (!Vector3d.TrySubtract(center, scope, out Vector3d minimum)
 42950                || !Vector3d.TryAdd(center, scope, out Vector3d maximum)) return true;
 42551            bounds = FixedBoundBox.FromMinMax(minimum, maximum);
 52        }
 121853        if (!mesh.Bounds.Intersects(bounds)) return false;
 108654        Fixed64 yaw = embedded is LSAABBoxCollider2D ? Fixed64.Zero : embedded.Rotation;
 108655        var section = new FiniteSlabSectionFrame(mesh.Mesh.GeometryFrame,
 108656            center, FixedQuaternion.FromAxisAngle(Vector3d.Up, -yaw), length, radius, halfThickness);
 108657        Span<Vector2d> box = stackalloc Vector2d[4];
 108658        ReadOnlySpan<Vector2d> offsets = GetConvexPrismOffsets(embedded, box);
 59        // A solved face still owns its true finite perimeter. Curved sections
 60        // admit exact retained subsegments; unknown prism cuts stay unresolved.
 108661        if (handledFaces != null)
 29262            return !offsets.IsEmpty || handledFaces.IntersectsContinuousBoundary(mesh, surfaceOwner, section);
 79463        SwiftList<int> candidates = mesh.Context.CollisionScratch.MeshTriangleCandidatesA;
 79464        mesh.GetTrianglesInBounds(new FixedBoundVolume(bounds.Min, bounds.Max), candidates);
 353265        foreach (int triangle in candidates.AsReadOnlySpan())
 66        {
 122067            if (surfaceOwner >= 0 && mesh.Mesh.GetManifoldSurfaceOwner(triangle) != surfaceOwner) continue;
 118568            mesh.Mesh.GetGeometryTriangleVertices(triangle, out Vector3d first, out Vector3d second, out Vector3d third)
 168169            if (section.IntersectsTriangle(new FixedTriangle(first, second, third), offsets)) return true;
 70        }
 29871        return false;
 72    }
 73
 74    private static void AppendMeshEmbedded2D(LSMeshCollider mesh, LSCollider2D embedded,
 75        ContactManifold manifold, int namespace3D, int namespace2D)
 76    {
 562177        if (embedded is not (LSCircleCollider2D or LSCapsuleCollider2D or LSAABBoxCollider2D or LSPolygonCollider2D))
 178            return;
 562079        SwiftList<int> triangleBuffer = mesh.Context.CollisionScratch.MeshTriangleCandidatesA;
 562080        FixedBoundVolume embeddedBounds = new(embedded.MixedBounds3D.Min, embedded.MixedBounds3D.Max);
 562081        mesh.GetTrianglesInBounds(embeddedBounds, triangleBuffer);
 562082        Vector3d center = GetEmbeddedCenter3D(embedded);
 562083        Fixed64 length = embedded is LSCapsuleCollider2D capsule ? capsule.AxisLength : Fixed64.Zero;
 562084        Fixed64 radius = embedded is LSCircleCollider2D circle ? circle.ScaledRadius
 562085            : embedded is LSCapsuleCollider2D stadium ? stadium.ScaledRadius : Fixed64.Zero;
 562086        Fixed64 yaw = embedded is LSAABBoxCollider2D ? Fixed64.Zero : embedded.Rotation;
 562087        Span<Vector2d> box = stackalloc Vector2d[4];
 562088        AppendMeshSlabContacts(mesh, embedded, center, FixedQuaternion.FromAxisAngle(Vector3d.Up, -yaw),
 562089            length, radius, embedded.MixedHalfThickness, GetConvexPrismOffsets(embedded, box),
 562090            triangleBuffer.AsReadOnlySpan(), manifold, namespace3D, namespace2D);
 562091    }
 92
 93    internal static bool AppendMeshCircleSlabContacts(LSMeshCollider mesh, Vector3d center,
 94        Fixed64 radius, Fixed64 halfThickness, ReadOnlySpan<int> candidates, ContactManifold manifold)
 95    {
 70396        AppendMeshSlabContacts(mesh, null, center, FixedQuaternion.Identity, Fixed64.Zero, radius,
 70397            halfThickness, ReadOnlySpan<Vector2d>.Empty, candidates, manifold, 0, 0);
 70398        return manifold.HasContact;
 99    }
 100
 101    private static void AppendMeshSlabContacts(LSMeshCollider collider, LSCollider2D? embedded,
 102        Vector3d center, FixedQuaternion rotation, Fixed64 length, Fixed64 radius, Fixed64 halfThickness,
 103        ReadOnlySpan<Vector2d> prismOffsets, ReadOnlySpan<int> candidates, ContactManifold manifold,
 104        int namespace3D, int namespace2D)
 105    {
 6323106        PhysicsMesh mesh = collider.Mesh;
 6323107        CollisionSatScratch scratch = collider.Context.CollisionScratch;
 6323108        bool closedHull = mesh.Mode == MeshColliderMode.Convex && mesh.IsClosedSurface;
 6323109        if (!prismOffsets.IsEmpty && (closedHull || mesh.HasSingleConvexCoplanarPatch)
 6323110            && TryAppendConvexMeshPrismContacts(collider, embedded!, center, rotation, halfThickness,
 6323111                prismOffsets, closedHull ? default : mesh.GetConvexCoplanarPatchCornerVertexIndices(0),
 10118112                manifold, namespace3D, namespace2D)) return;
 2528113        if (closedHull && prismOffsets.IsEmpty
 2528114            && ConvexHullCylinderContact.TryGetContactWithContainedCenter(mesh.GeometryFrame,
 2528115                mesh.GeometryVertices, mesh.Triangles, center, rotation, halfThickness * Fixed64.Two, radius,
 2528116                out FixedContactAnchors contact, Vector2d.Forward, length))
 117        {
 318118            manifold.AddContact(new ContactAnchor(contact.FirstAnchor), new ContactAnchor(contact.SecondAnchor),
 318119                contact.Depth, contact.Normal, collider.Material, embedded?.Material ?? collider.Material,
 318120                contact.DepthIsClamped, namespace3D, namespace2D);
 318121            return;
 122        }
 2210123        var section = new FiniteSlabSectionFrame(mesh.GeometryFrame, center, rotation, length, radius, halfThickness);
 2210124        scratch.MeshSurfaces.Clear();
 15992125        foreach (int triangle in candidates)
 126        {
 5786127            if (!scratch.MeshSurfaces.Add(mesh.GetManifoldSurfaceOwner(triangle))) continue;
 2152128            if (!MeshTriangleContactGenerator.GatherMeshSlabSurfaceTriangles(mesh, triangle, section,
 2152129                prismOffsets, candidates, scratch.MeshTriangleCandidatesB)) continue;
 1977130            mesh.GetGeometryTriangleVertices(triangle, out Vector3d a, out Vector3d b, out Vector3d c);
 1977131            var frame = new FiniteSlabRayFrame(new FixedTriangle(a, b, c), mesh.GeometryFrame,
 1977132                center, rotation, length, radius, halfThickness);
 1977133            MeshTriangleContactGenerator.AppendMeshSlabSurfaceContacts(collider, embedded, triangle, frame,
 1977134                prismOffsets, scratch.MeshTriangleCandidatesB.AsReadOnlySpan(),
 1977135                MeshSlabFaceRegions.ContainsSection(mesh, triangle, frame, prismOffsets), manifold, namespace3D, namespa
 136        }
 2210137    }
 138
 139    private static bool TryAppendConvexMeshPrismContacts(LSMeshCollider collider, LSCollider2D embedded,
 140        Vector3d center, FixedQuaternion rotation, Fixed64 halfThickness, ReadOnlySpan<Vector2d> offsets,
 141        ReadOnlySpan<int> patchCorners,
 142        ContactManifold manifold, int namespace3D, int namespace2D)
 143    {
 3795144        CollisionSatScratch scratch = collider.Context.CollisionScratch;
 11385145        int count = offsets.Length, triangleCount = 12 * count - 12, edgeCount = 6 * count;
 3945146        if (scratch.PolyhedronVertices.Length < 2 * count) Array.Resize(ref scratch.PolyhedronVertices, 2 * count);
 3945147        if (scratch.PolyhedronTriangles.Length < triangleCount) Array.Resize(ref scratch.PolyhedronTriangles, triangleCo
 3945148        if (scratch.PolyhedronEdges.Length < edgeCount) Array.Resize(ref scratch.PolyhedronEdges, edgeCount);
 3795149        Span<Vector3d> vertices = scratch.PolyhedronVertices.AsSpan(0, 2 * count);
 7590150        Span<int> triangles = scratch.PolyhedronTriangles.AsSpan(0, triangleCount), edges = scratch.PolyhedronEdges.AsSp
 3795151        FillPrismGeometry(offsets, halfThickness, vertices, triangles, edges);
 3795152        ReadOnlySpan<Vector3d> hullVertices = collider.Mesh.GeometryVertices;
 7590153        ReadOnlySpan<int> hullTriangles = collider.Mesh.Triangles, hullEdges = collider.Mesh.ConvexSatEdgeVertexPairs;
 3795154        ContactGroupKey group = default;
 3795155        if (!patchCorners.IsEmpty)
 156        {
 157            // Certified corners preserve the finite fill and omit artificial diagonals.
 1002158            MeshHullSurfaceContacts.FillPatch(collider.Mesh, patchCorners, scratch.ConvexPatchVertices,
 1002159                scratch.ConvexPatchTriangles, scratch.ConvexPatchEdges);
 1002160            hullVertices = scratch.ConvexPatchVertices.AsReadOnlySpan();
 1002161            hullTriangles = scratch.ConvexPatchTriangles.AsReadOnlySpan();
 1002162            hullEdges = scratch.ConvexPatchEdges.AsReadOnlySpan();
 1002163            group = new ContactGroupKey(namespace3D, namespace2D, collider.Mesh.GetCanonicalSurfaceOrdinal(0), 0);
 164        }
 3795165        return MeshTriangleContactGenerator.TryAppendHullContacts(collider, hullVertices, hullTriangles, hullEdges,
 3795166            ScaledRigidFrame3d.Rigid(center, rotation), center, vertices,
 3795167            triangles, edges, edges[..(2 * count + 2)], embedded.Material, manifold, false, namespace3D, namespace2D, gr
 168    }
 169
 170    internal static void FillPrismGeometry(ReadOnlySpan<Vector2d> offsets, Fixed64 halfThickness,
 171        Span<Vector3d> vertices, Span<int> triangles, Span<int> edges)
 172    {
 5131173        int count = offsets.Length;
 5131174        int face = 0;
 51432175        for (int index = 0; index < count; index++)
 176        {
 41170177            int bottom = 2 * index, next = 2 * ((index + 1) % count);
 20585178            vertices[bottom] = new(offsets[index].X, -halfThickness, offsets[index].Y);
 20585179            vertices[bottom + 1] = new(offsets[index].X, halfThickness, offsets[index].Y);
 61755180            triangles[face++] = bottom; triangles[face++] = next; triangles[face++] = next + 1;
 61755181            triangles[face++] = bottom; triangles[face++] = next + 1; triangles[face++] = bottom + 1;
 20585182            int edge = 2 * index;
 41170183            edges[edge] = bottom; edges[edge + 1] = next;
 41170184            edges[2 * count + edge] = bottom; edges[2 * count + edge + 1] = bottom + 1;
 41170185            edges[4 * count + edge] = bottom + 1; edges[4 * count + edge + 1] = next + 1;
 20585186            if (index == 0 || index == count - 1) continue;
 30969187            triangles[face++] = 0; triangles[face++] = bottom; triangles[face++] = next;
 30969188            triangles[face++] = 1; triangles[face++] = next + 1; triangles[face++] = bottom + 1;
 189        }
 5131190    }
 191}

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Detection/Mixed/CollisionDetectionMixed.cs

#LineLine coverage
 1//=======================================================================
 2// CollisionDetectionMixed.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System.Runtime.CompilerServices;
 9using FixedMathSharp;
 10using FixedMathSharp.Geometry;
 11using Gravitas.Colliders;
 12
 13namespace Gravitas.CollisionHandling;
 14
 15/// <summary>
 16/// Deterministic mixed 2D/3D narrow-phase collision checks.
 17/// </summary>
 18/// <content>Builds caller-owned mixed manifolds and provides representative contact inspection.</content>
 19public static partial class CollisionDetectionMixed
 20{
 21    /// <summary>Tests a 3D collider against an embedded 2D collider and returns a representative contact.</summary>
 22    /// <remarks>The representative is the deepest retained row, not a whole-owner escape. Use <see cref="TryBuildManifo
 23    public static bool TryCollide(LSCollider collider3D, LSCollider2D collider2D, out MixedContact contact)
 24    {
 430825        ChronicleGuard.ThrowIfNull(collider3D, nameof(collider3D));
 430826        ChronicleGuard.ThrowIfNull(collider2D, nameof(collider2D));
 430827        ContactManifold manifold = collider3D.Context.CollisionScratch.MixedManifold;
 430828        bool found = TryBuildManifold(collider3D, collider2D, manifold);
 430829        contact = found ? MixedContact.FromManifoldContact(manifold.PrimaryContact) : default;
 430830        return found;
 31    }
 32
 33    /// <summary>Rebuilds all mixed contacts in a caller-owned manifold, with A identifying the 3D participant and B the
 34    /// <remarks>Compound leaves retain separate provenance and materials. The buffer is cleared even when the pair is s
 35    public static bool TryBuildManifold(LSCollider collider3D, LSCollider2D collider2D, ContactManifold manifold)
 36    {
 1742637        ChronicleGuard.ThrowIfNull(collider3D, nameof(collider3D));
 1742538        ChronicleGuard.ThrowIfNull(collider2D, nameof(collider2D));
 1742439        ChronicleGuard.ThrowIfNull(manifold, nameof(manifold));
 1742340        manifold.BeginUpdate(collider3D.Context.FrameCount);
 1742341        AppendManifold(collider3D, collider2D, manifold, 0, 0, false);
 1742342        return manifold.HasContact;
 43    }
 44
 45    internal static bool TryBuildDiscreteManifold(LSCollider collider3D, LSCollider2D collider2D, ContactManifold manifo
 46    {
 1776947        manifold.BeginUpdate(collider3D.Context.FrameCount);
 1776948        return AppendManifold(collider3D, collider2D, manifold, 0, 0, true);
 49    }
 50
 51    internal static bool AppendManifold(LSCollider collider3D, LSCollider2D collider2D,
 52        ContactManifold manifold, int namespace3D, int namespace2D, bool surfaceResponse)
 53    {
 3751254        if (!collider3D.Bounds.Intersects(collider2D.MixedBounds3D))
 997055            return false;
 56
 2754257        if (collider3D is LSCompoundCollider compound3D)
 58        {
 19159            bool overlaps = false;
 109860            for (int i = 0; i < compound3D.PartCount; i++)
 35861                overlaps |= AppendManifold(compound3D.GetPartCollider(i), collider2D, manifold, i + 1, namespace2D, surf
 19162            return overlaps;
 63        }
 2735164        if (collider2D is LSCompoundCollider2D compound2D)
 65        {
 18766            bool overlaps = false;
 111867            for (int i = 0; i < compound2D.PartCount; i++)
 37268                overlaps |= AppendManifold(collider3D, compound2D.GetPartCollider(i), manifold, namespace3D, -(i + 1), s
 18769            return overlaps;
 70        }
 2716471        if (surfaceResponse && collider2D.StaticSurface is { } solidSurface
 2716472            && !collider3D.IsTrigger && !collider2D.IsTrigger
 2716473            && (collider3D is LSCuboidCollider or LSSphereCollider or LSCylinderCollider or LSConeCollider
 2716474                || collider3D is LSCapsuleCollider
 2716475                || collider3D is LSMeshCollider))
 742476            return solidSurface.AppendMixed(collider3D, collider2D, manifold, namespace3D, namespace2D);
 1974077        if (collider3D is LSMeshCollider mesh)
 78        {
 831279            if (surfaceResponse && mesh.StaticSurface is { } surface && !mesh.IsTrigger && !collider2D.IsTrigger)
 269180                return surface.AppendMixed(mesh, collider2D, manifold, namespace3D, namespace2D);
 562181            int previous = manifold.Count;
 562182            AppendMeshEmbedded2D(mesh, collider2D, manifold, namespace3D, namespace2D);
 562183            return manifold.Count != previous;
 84        }
 1142885        if (!TryPrimitiveContact(collider3D, collider2D, out MixedContact contact))
 182686            return false;
 87
 88        // Declared-domain CCD can aggregate several ordinary member contacts.
 89        // Preserve each supplier before its rows share a manifold and response owner.
 960290        bool declaredSupplier = collider2D.StaticSurface != null;
 960291        if (namespace3D != 0 || namespace2D != 0 || declaredSupplier)
 179592            contact = contact.WithFallbackMaterials(collider3D.Material, collider2D.Material);
 960293        ManifoldContact row = contact.ToManifoldContact(namespace3D, namespace2D);
 960294        manifold.AddContact(new ContactGroupKey(namespace3D, namespace2D,
 960295            sourceIdB: declaredSupplier ? collider2D.Id + 1 : 0,
 960296            sourceOrderB: declaredSupplier ? ((IPhysicsColliderRegistryItem)collider2D).ReplayOrder + 1 : 0), row);
 960297        return true;
 98    }
 99
 100    private static bool TryPrimitiveContact(LSCollider collider3D, LSCollider2D collider2D, out MixedContact contact) =>
 11428101        collider3D.Shape switch
 11428102        {
 2594103            ColliderType.Sphere => TrySphereEmbedded2D((LSSphereCollider)collider3D, collider2D, out contact),
 4248104            ColliderType.AABox or ColliderType.OBBox => TryCuboidEmbedded2D((LSCuboidCollider)collider3D, collider2D, ou
 3217105            ColliderType.Capsule => TryCapsuleEmbedded2D((LSCapsuleCollider)collider3D, collider2D, out contact),
 768106            ColliderType.Cylinder => TryCylinderEmbedded2D((LSCylinderCollider)collider3D, collider2D, out contact),
 554107            ColliderType.Cone => TryConeEmbedded2D((LSConeCollider)collider3D, collider2D, out contact),
 47108            _ => NoContact(out contact)
 11428109        };
 110
 111    private static bool TrySphereEmbedded2D(LSSphereCollider sphere, LSCollider2D embedded, out MixedContact contact)
 112    {
 2594113        if (embedded is LSAABBoxCollider2D or LSPolygonCollider2D)
 2129114            return TryGetSphereConvexPrismContact(sphere, embedded, out contact);
 115
 465116        Vector3d sphereCenter = sphere.Center;
 465117        Vector2d planarCenter = new(sphereCenter.X, sphereCenter.Z);
 465118        bool planarInside = embedded.ContainsPoint(planarCenter);
 465119        bool inside = planarInside
 465120            && MixedEmbedded2DGeometry.ContainsPointInSlab(
 465121                embedded,
 465122                sphereCenter.Y);
 465123        ContactAnchor embeddedAnchor =
 465124            MixedEmbedded2DGeometry.GetClosestAnchorOnEmbeddedVolume(
 465125                embedded,
 465126                sphereCenter);
 127        // Broad-phase overlap plus a closest-volume anchor bounds every
 128        // component of this relative offset to the Fixed64 domain.
 465129        _ = embeddedAnchor.TryGetOffsetFrom(
 465130            sphereCenter,
 465131            out Vector3d delta);
 132        // Outside overlap bounds the closest witness by the sphere's local
 133        // reach; inside, the nearer planar boundary bounds it independently of
 134        // slab height. Its magnitude and final penetration therefore fit.
 465135        _ = Vector3d.TryGetMagnitude(delta, out Fixed64 distance);
 465136        if (!inside && distance > sphere.ScaledRadius)
 137        {
 9138            contact = default;
 9139            return false;
 140        }
 141
 456142        Vector3d normal = distance > Fixed64.Zero
 456143            ? WideNormalization.GetNormalized(inside ? -delta : delta)
 456144            : ResolveFallbackNormal(sphereCenter, embedded);
 456145        Fixed64 depth = inside ? sphere.ScaledRadius + distance : sphere.ScaledRadius - distance;
 456146        contact = new MixedContact(
 456147            new ContactAnchor(
 456148                sphereCenter,
 456149                normal * sphere.ScaledRadius),
 456150            embeddedAnchor,
 456151            normal,
 456152            depth,
 456153            depthIsClamped: false);
 456154        return true;
 155    }
 156
 157    private static bool TryCapsuleEmbedded2D(LSCapsuleCollider capsule, LSCollider2D embedded, out MixedContact contact)
 158    {
 3217159        if (embedded is LSAABBoxCollider2D or LSPolygonCollider2D)
 2333160            return TryGetCapsuleConvexPrismContact(capsule, embedded, out contact);
 161
 884162        if (embedded is LSCircleCollider2D circle)
 314163            return TryGetCapsuleCircleSlabContact(capsule, circle, circle.ScaledRadius, out contact);
 164
 570165        var prism = (LSCapsuleCollider2D)embedded;
 570166        if (!WideConvexPrismRelations.TryGetCenteredCapsuleSlabCapsulePenetration(
 570167                GetEmbeddedCenter3D(prism), prism.Rotation, prism.AxisLength, prism.ScaledRadius, prism.MixedHalfThickne
 570168                capsule.Center, capsule.Rotation, capsule.AxisLength, capsule.ScaledRadius,
 570169                out Vector3d normal, out Fixed64 depth, out bool depthIsClamped))
 24170            return NoContact(out contact);
 171
 546172        contact = BuildCanonicalSupportContact(capsule, prism, -normal, depth, depthIsClamped);
 546173        return true;
 174    }
 175
 176    private static bool TryCylinderEmbedded2D(LSCylinderCollider cylinder, LSCollider2D embedded, out MixedContact conta
 177    {
 768178        if (embedded is LSAABBoxCollider2D or LSPolygonCollider2D)
 376179            return TryGetCylinderConvexPrismContact(cylinder, embedded, out contact);
 180
 392181        bool collided = embedded.Shape == ColliderType2D.Circle
 392182            ? TryTestCylinderCircleSlab(cylinder, (LSCircleCollider2D)embedded, out AxisPenetration penetration)
 392183            : TryTestCylinderCapsuleSlab(cylinder, (LSCapsuleCollider2D)embedded, out penetration);
 184
 392185        return collided
 392186            ? BuildCylinderContact(cylinder, embedded, penetration, out contact)
 392187            : NoContact(out contact);
 188    }
 189
 190    private static bool TryConeEmbedded2D(LSConeCollider cone, LSCollider2D embedded, out MixedContact contact)
 191    {
 554192        if (embedded is LSAABBoxCollider2D or LSPolygonCollider2D)
 385193            return TryGetConeConvexPrismContact(cone, embedded, out contact);
 194
 169195        bool collided = embedded.Shape == ColliderType2D.Circle
 169196            ? TryTestConeCircleSlab(cone, (LSCircleCollider2D)embedded, out AxisPenetration penetration)
 169197            : TryTestConeCapsuleSlab(cone, (LSCapsuleCollider2D)embedded, out penetration);
 198
 169199        return collided
 169200            ? BuildConeContact(cone, embedded, penetration, out contact)
 169201            : NoContact(out contact);
 202    }
 203
 204    private static bool TryGetCapsuleCircleSlabContact(
 205        LSCapsuleCollider capsule,
 206        LSCollider2D slab,
 207        Fixed64 radius,
 208        out MixedContact contact)
 209    {
 210        // Keep the admitted half-thickness even when full height is wider
 211        // than Fixed64. The complete query owns rim and interior-core minima.
 314212        Signed192 length = WideArithmetic.AddSigned192(
 314213            Signed192.Raw(slab.MixedHalfThickness), Signed192.Raw(slab.MixedHalfThickness));
 314214        if (!WideConvexPrismRelations.TryGetCenteredFiniteCylinderCapsulePenetration(
 314215                GetEmbeddedCenter3D(slab), FixedQuaternion.Identity, Vector3d.Up, length, radius,
 314216                capsule.Center, capsule.Rotation, Vector3d.Up, capsule.AxisLength, capsule.ScaledRadius,
 314217                out Vector3d normal, out Fixed64 depth, out bool depthIsClamped))
 6218            return NoContact(out contact);
 219
 220        // The geometry query is cylinder-first; mixed contacts are 3D-to-2D.
 308221        contact = BuildCanonicalSupportContact(capsule, slab, -normal, depth, depthIsClamped);
 308222        return true;
 223    }
 224
 225    private static bool TryTestCylinderCircleSlab(
 226        LSCylinderCollider cylinder,
 227        LSCircleCollider2D circle,
 228        out AxisPenetration penetration)
 229    {
 288230        penetration = default;
 231        // Keep the full admitted half-thickness: doubling in Fixed64 would
 232        // shorten slabs whose physical full height exceeds the scalar domain.
 288233        Signed192 slabLength = WideArithmetic.AddSigned192(
 288234            Signed192.Raw(circle.MixedHalfThickness), Signed192.Raw(circle.MixedHalfThickness));
 288235        if (!WideConvexPrismRelations.TryGetPositiveRadiusCylinderPairPenetration(
 288236                cylinder.Center, cylinder.Rotation, Vector3d.Up,
 288237                Signed192.Raw(cylinder.Height), cylinder.ScaledRadius,
 288238                GetEmbeddedCenter3D(circle), FixedQuaternion.Identity, Vector3d.Up,
 288239                slabLength, circle.ScaledRadius,
 288240                out Vector3d normal, out Fixed64 depth, out bool depthIsClamped))
 7241            return false;
 242
 281243        penetration = new AxisPenetration(normal, depth, depthIsClamped);
 281244        return true;
 245    }
 246
 247    private static bool TryTestConeCircleSlab(
 248        LSConeCollider cone,
 249        LSCircleCollider2D circle,
 250        out AxisPenetration penetration)
 251    {
 68252        penetration = default;
 68253        Vector3d coneAxis = GetRigidUpAxis(cone.Rotation);
 254
 68255        if (!CheckConeCircleSlabAxis(cone, circle, coneAxis, ref penetration))
 1256            return false;
 257
 67258        CheckConeCircleSlabAxis(cone, circle, Vector3d.Up, ref penetration);
 259
 67260        if (!CheckConeCircleSlabAxis(
 67261                cone,
 67262                circle,
 67263                Vector3d.Cross(coneAxis, Vector3d.Up),
 67264                ref penetration))
 1265            return false;
 266
 66267        Vector3d circleCenter = GetEmbeddedCenter3D(circle);
 268        // The admitted broad-phase bounds and separating axes guarantee that
 269        // this closest-feature offset is representable in either rigid frame.
 66270        _ = FixedSegment.TryGetClosestCenteredFiniteConeSurfaceAnchor(
 66271            circleCenter,
 66272            cone.Center,
 66273            cone.Rotation,
 66274            Vector3d.Up,
 66275            cone.Height,
 66276            cone.ScaledRadius,
 66277            Vector3d.Right,
 66278            out FixedPointAnchor conePoint,
 66279            out _,
 66280            out _);
 66281        _ = conePoint.TryGetOffsetFrom(
 66282            new FixedPointAnchor(
 66283                circleCenter,
 66284                FixedQuaternion.Identity,
 66285                Vector3d.Zero),
 66286            out Vector3d conePointFromCircle);
 287
 66288        Fixed64 closestCircleY = FixedMath.Clamp(
 66289            conePointFromCircle.Y,
 66290            -circle.MixedHalfThickness,
 66291            circle.MixedHalfThickness);
 66292        _ = Vector3d.TrySubtract(
 66293            new Vector3d(Fixed64.Zero, closestCircleY, Fixed64.Zero),
 66294            conePointFromCircle,
 66295            out Vector3d closestFeatureAxis);
 66296        if (!CheckConeCircleSlabAxis(
 66297                cone,
 66298                circle,
 66299                closestFeatureAxis,
 66300                ref penetration))
 1301            return false;
 302
 65303        return penetration.HasValue;
 304    }
 305
 306    private static bool TryTestCylinderCapsuleSlab(
 307        LSCylinderCollider cylinder,
 308        LSCapsuleCollider2D prism,
 309        out AxisPenetration penetration)
 310    {
 104311        penetration = default;
 104312        Vector3d cylinderAxis = GetRigidUpAxis(cylinder.Rotation);
 104313        GetEmbeddedCapsuleAxes(
 104314            prism,
 104315            out Vector2d prismPlanarAxis,
 104316            out Vector3d prismAxis,
 104317            out Vector3d prismNormal);
 318
 104319        if (!CheckCylinderPrismAxis(
 104320                cylinder,
 104321                prism,
 104322                cylinderAxis,
 104323                prismPlanarAxis,
 104324                cylinderAxis,
 104325                ref penetration))
 1326            return false;
 327
 103328        CheckCylinderPrismAxis(
 103329            cylinder,
 103330            prism,
 103331            cylinderAxis,
 103332            prismPlanarAxis,
 103333            Vector3d.Up,
 103334            ref penetration);
 335
 103336        if (!CheckCylinderPrismAxis(
 103337                cylinder,
 103338                prism,
 103339                cylinderAxis,
 103340                prismPlanarAxis,
 103341                Vector3d.Cross(cylinderAxis, Vector3d.Up),
 103342                ref penetration))
 1343            return false;
 344
 102345        if (!CheckEmbeddedCapsuleAxes(
 102346                cylinder,
 102347                cylinderAxis,
 102348                prism,
 102349                prismPlanarAxis,
 102350                prismAxis,
 102351                prismNormal,
 102352                ref penetration)
 102353            || !CheckCylinderEmbeddedCapsuleEdgeAxis(
 102354                cylinder,
 102355                cylinderAxis,
 102356                prism,
 102357                prismPlanarAxis,
 102358                prismAxis,
 102359                ref penetration))
 360        {
 8361            return false;
 362        }
 363
 94364        Vector3d closestFeatureAxis =
 94365            FixedSegment.GetClosestDirectionBetweenCenteredAxes(
 94366                cylinder.Center,
 94367                cylinderAxis,
 94368                cylinder.Height,
 94369                GetEmbeddedCenter3D(prism),
 94370                prism.AxisLength <= Fixed64.Epsilon
 94371                    ? Vector3d.Up
 94372                    : prismAxis,
 94373                prism.AxisLength);
 94374        if (!CheckCylinderPrismAxis(
 94375                cylinder,
 94376                prism,
 94377                cylinderAxis,
 94378                prismPlanarAxis,
 94379                closestFeatureAxis,
 94380                ref penetration))
 1381            return false;
 382
 93383        return penetration.HasValue;
 384    }
 385
 386    private static bool TryTestConeCapsuleSlab(
 387        LSConeCollider cone,
 388        LSCapsuleCollider2D prism,
 389        out AxisPenetration penetration)
 390    {
 101391        penetration = default;
 101392        Vector3d coneAxis = GetRigidUpAxis(cone.Rotation);
 101393        GetEmbeddedCapsuleAxes(
 101394            prism,
 101395            out Vector2d prismPlanarAxis,
 101396            out Vector3d prismAxis,
 101397            out Vector3d prismNormal);
 398
 101399        if (!CheckConePrismAxis(
 101400                cone,
 101401                prism,
 101402                prismPlanarAxis,
 101403                coneAxis,
 101404                ref penetration))
 1405            return false;
 406
 100407        CheckConePrismAxis(
 100408            cone,
 100409            prism,
 100410            prismPlanarAxis,
 100411            Vector3d.Up,
 100412            ref penetration);
 413
 100414        if (!CheckConePrismAxis(
 100415                cone,
 100416                prism,
 100417                prismPlanarAxis,
 100418                Vector3d.Cross(coneAxis, Vector3d.Up),
 100419                ref penetration))
 1420            return false;
 421
 99422        if (!CheckEmbeddedCapsuleAxes(
 99423                cone,
 99424                prism,
 99425                prismPlanarAxis,
 99426                prismAxis,
 99427                prismNormal,
 99428                ref penetration)
 99429            || !CheckConeEmbeddedCapsuleEdgeAxis(
 99430                cone,
 99431                coneAxis,
 99432                prism,
 99433                prismPlanarAxis,
 99434                prismAxis,
 99435                ref penetration))
 436        {
 3437            return false;
 438        }
 439
 96440        ContactAnchor embeddedPoint =
 96441            MixedEmbedded2DGeometry.GetClosestAnchorOnEmbeddedVolume(
 96442                prism,
 96443                cone.Center);
 444        // Earlier exact axes admit a shared finite feature neighborhood, so
 445        // each relative offset remains representable through the cone frame.
 96446        _ = embeddedPoint.TryGetOffsetFrom(
 96447            cone.Center,
 96448            out Vector3d centerToEmbedded);
 96449        _ = cone.Rotation.Inverse().TryRotate(
 96450            centerToEmbedded,
 96451            out Vector3d localEmbeddedPoint);
 96452        _ = FixedSegment.TryGetClosestCenteredFiniteConeSurfaceOffset(
 96453            localEmbeddedPoint,
 96454            Vector3d.Zero,
 96455            Vector3d.Up,
 96456            cone.Height,
 96457            cone.ScaledRadius,
 96458            Vector3d.Right,
 96459            out Vector3d coneSurfaceOffset,
 96460            out _,
 96461            out _);
 96462        _ = embeddedPoint.TryGetOffsetFrom(
 96463            new ContactAnchor(
 96464                cone.Center,
 96465                cone.Rotation,
 96466                coneSurfaceOffset),
 96467            out Vector3d closestFeatureAxis);
 96468        if (!CheckConePrismAxis(
 96469                cone,
 96470                prism,
 96471                prismPlanarAxis,
 96472                closestFeatureAxis,
 96473                ref penetration))
 8474            return false;
 475
 88476        return penetration.HasValue;
 477    }
 478
 479    private static bool CheckConeCircleSlabAxis(
 480        LSConeCollider cone,
 481        LSCircleCollider2D circle,
 482        Vector3d axis,
 483        ref AxisPenetration penetration)
 484    {
 268485        if (!TryNormalizeAxis(axis, out Vector3d normalizedAxis))
 23486            return true;
 487
 245488        if (!FixedSegment.TryGetCenteredFiniteConeCapsuleSlabAxisPenetration(
 245489                normalizedAxis,
 245490                cone.Center,
 245491                GetRigidUpAxis(cone.Rotation),
 245492                cone.Height,
 245493                cone.ScaledRadius,
 245494                GetEmbeddedCenter3D(circle),
 245495                Vector2d.Forward,
 245496                Fixed64.Zero,
 245497                circle.ScaledRadius,
 245498                circle.MixedHalfThickness,
 245499                out Vector3d orientedAxis,
 245500                out Fixed64 depth,
 245501                out bool depthIsClamped))
 502        {
 3503            return false;
 504        }
 505
 242506        return KeepAxisPenetration(
 242507            orientedAxis,
 242508            depth,
 242509            depthIsClamped,
 242510            ref penetration);
 511    }
 512
 513    private static bool CheckCylinderPrismAxis(
 514        LSCylinderCollider cylinder,
 515        LSCapsuleCollider2D prism,
 516        Vector3d cylinderAxis,
 517        Vector2d prismAxis,
 518        Vector3d axis,
 519        ref AxisPenetration penetration)
 520    {
 701521        if (!TryNormalizeAxis(axis, out Vector3d normalizedAxis))
 43522            return true;
 523
 658524        if (!FixedSegment.TryGetCenteredFiniteCylinderCapsuleSlabAxisPenetration(
 658525                normalizedAxis,
 658526                cylinder.Center,
 658527                cylinderAxis,
 658528                cylinder.Height,
 658529                cylinder.ScaledRadius,
 658530                GetEmbeddedCenter3D(prism),
 658531                prismAxis,
 658532                prism.AxisLength,
 658533                prism.ScaledRadius,
 658534                prism.MixedHalfThickness,
 658535                out Vector3d orientedAxis,
 658536                out Fixed64 depth,
 658537                out bool depthIsClamped))
 11538            return false;
 539
 647540        return KeepAxisPenetration(
 647541            orientedAxis,
 647542            depth,
 647543            depthIsClamped,
 647544            ref penetration);
 545    }
 546
 547    private static bool CheckConePrismAxis(
 548        LSConeCollider cone,
 549        LSCapsuleCollider2D prism,
 550        Vector2d prismAxis,
 551        Vector3d axis,
 552        ref AxisPenetration penetration)
 553    {
 690554        if (!TryNormalizeAxis(axis, out Vector3d normalizedAxis))
 46555            return true;
 556
 644557        if (!FixedSegment.TryGetCenteredFiniteConeCapsuleSlabAxisPenetration(
 644558                normalizedAxis,
 644559                cone.Center,
 644560                GetRigidUpAxis(cone.Rotation),
 644561                cone.Height,
 644562                cone.ScaledRadius,
 644563                GetEmbeddedCenter3D(prism),
 644564                prismAxis,
 644565                prism.AxisLength,
 644566                prism.ScaledRadius,
 644567                prism.MixedHalfThickness,
 644568                out Vector3d orientedAxis,
 644569                out Fixed64 depth,
 644570                out bool depthIsClamped))
 13571            return false;
 572
 631573        return KeepAxisPenetration(
 631574            orientedAxis,
 631575            depth,
 631576            depthIsClamped,
 631577            ref penetration);
 578    }
 579
 580    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 581    private static bool KeepAxisPenetration(
 582        Vector3d axis,
 583        Fixed64 depth,
 584        bool depthIsClamped,
 585        ref AxisPenetration penetration)
 586    {
 1520587        if (!penetration.HasValue || depth < penetration.Depth)
 588        {
 624589            penetration = new AxisPenetration(
 624590                axis,
 624591                depth,
 624592                depthIsClamped);
 593        }
 594
 1520595        return true;
 596    }
 597
 598    private static bool CheckEmbeddedCapsuleAxes(
 599        LSCylinderCollider cylinder,
 600        Vector3d cylinderAxis,
 601        LSCapsuleCollider2D capsule,
 602        Vector2d capsulePlanarAxis,
 603        Vector3d capsuleAxis,
 604        Vector3d capsuleNormal,
 605        ref AxisPenetration penetration)
 606    {
 102607        return CheckCylinderPrismAxis(
 102608                cylinder,
 102609                capsule,
 102610                cylinderAxis,
 102611                capsulePlanarAxis,
 102612                capsuleAxis,
 102613                ref penetration)
 102614            && CheckCylinderPrismAxis(
 102615                cylinder,
 102616                capsule,
 102617                cylinderAxis,
 102618                capsulePlanarAxis,
 102619                capsuleNormal,
 102620                ref penetration);
 621    }
 622
 623    private static bool CheckEmbeddedCapsuleAxes(
 624        LSConeCollider cone,
 625        LSCapsuleCollider2D capsule,
 626        Vector2d capsulePlanarAxis,
 627        Vector3d capsuleAxis,
 628        Vector3d capsuleNormal,
 629        ref AxisPenetration penetration)
 630    {
 99631        return CheckConePrismAxis(
 99632                cone,
 99633                capsule,
 99634                capsulePlanarAxis,
 99635                capsuleAxis,
 99636                ref penetration)
 99637            && CheckConePrismAxis(
 99638                cone,
 99639                capsule,
 99640                capsulePlanarAxis,
 99641                capsuleNormal,
 99642                ref penetration);
 643    }
 644
 645    private static bool CheckCylinderEmbeddedCapsuleEdgeAxis(
 646        LSCylinderCollider cylinder,
 647        Vector3d cylinderAxis,
 648        LSCapsuleCollider2D capsule,
 649        Vector2d capsulePlanarAxis,
 650        Vector3d capsuleAxis,
 651        ref AxisPenetration penetration)
 652    {
 94653        return CheckCylinderPrismAxis(
 94654            cylinder,
 94655            capsule,
 94656            cylinderAxis,
 94657            capsulePlanarAxis,
 94658            Vector3d.Cross(cylinderAxis, capsuleAxis),
 94659            ref penetration);
 660    }
 661
 662    private static bool CheckConeEmbeddedCapsuleEdgeAxis(
 663        LSConeCollider cone,
 664        Vector3d coneAxis,
 665        LSCapsuleCollider2D capsule,
 666        Vector2d capsulePlanarAxis,
 667        Vector3d capsuleAxis,
 668        ref AxisPenetration penetration)
 669    {
 96670        return CheckConePrismAxis(
 96671            cone,
 96672            capsule,
 96673            capsulePlanarAxis,
 96674            Vector3d.Cross(coneAxis, capsuleAxis),
 96675            ref penetration);
 676    }
 677
 678    private static bool BuildCylinderContact(
 679        LSCylinderCollider cylinder,
 680        LSCollider2D embedded,
 681        AxisPenetration penetration,
 682        out MixedContact contact)
 683    {
 374684        contact = BuildCanonicalSupportContact(
 374685            cylinder,
 374686            embedded,
 374687            penetration.Axis,
 374688            penetration.Depth,
 374689            penetration.DepthIsClamped);
 374690        return true;
 691    }
 692
 693    private static bool BuildConeContact(
 694        LSConeCollider cone,
 695        LSCollider2D embedded,
 696        AxisPenetration penetration,
 697        out MixedContact contact)
 698    {
 153699        contact = BuildCanonicalSupportContact(
 153700            cone,
 153701            embedded,
 153702            penetration.Axis,
 153703            penetration.Depth,
 153704            penetration.DepthIsClamped);
 153705        return true;
 706    }
 707
 708    private static MixedContact BuildCanonicalSupportContact(
 709        LSCollider collider3D,
 710        LSCollider2D embedded,
 711        Vector3d normal3DTo2D,
 712        Fixed64 depth,
 713        bool depthIsClamped)
 714    {
 1381715        return new MixedContact(
 1381716            new ContactAnchor(
 1381717                ConvexColliderSupport.GetSupportAnchor(
 1381718                    collider3D,
 1381719                    normal3DTo2D,
 1381720                    Vector3d.Zero)),
 1381721            MixedEmbedded2DGeometry.GetSupportAnchor(embedded, -normal3DTo2D),
 1381722            normal3DTo2D,
 1381723            depth,
 1381724            depthIsClamped);
 725    }
 726
 727}

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Detection/Mixed/CollisionDetectionMixed.FinitePrisms.cs

#LineLine coverage
 1//=======================================================================
 2// CollisionDetectionMixed.FinitePrisms.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using FixedMathSharp;
 10using FixedMathSharp.Geometry;
 11using Gravitas.Colliders;
 12
 13namespace Gravitas.CollisionHandling;
 14
 15/// <content>Finds contacts between 3D colliders and finite extrusions of planar shapes.</content>
 16public static partial class CollisionDetectionMixed
 17{
 18    private static bool TryCuboidEmbedded2D(
 19        LSCuboidCollider cuboid,
 20        LSCollider2D embedded,
 21        out MixedContact contact)
 22    {
 424823        if (embedded is LSCircleCollider2D circle)
 24        {
 200225            return TryGetCuboidRelationContact(
 200226                cuboid.OrientedBox.TryGetCircleSlabContact(
 200227                    GetEmbeddedCenter3D(circle),
 200228                    circle.Rotation,
 200229                    circle.MixedHalfThickness,
 200230                    circle.ScaledRadius,
 200231                    out FixedContactAnchors anchors),
 200232                anchors,
 200233                out contact);
 34        }
 35
 224636        if (embedded is LSCapsuleCollider2D capsule)
 37        {
 14938            return TryGetCuboidRelationContact(
 14939                cuboid.OrientedBox.TryGetCenteredCapsuleSlabContact(
 14940                    GetEmbeddedCenter3D(capsule),
 14941                    capsule.Rotation,
 14942                    Vector2d.Forward,
 14943                    capsule.AxisLength,
 14944                    capsule.ScaledRadius,
 14945                    capsule.MixedHalfThickness,
 14946                    out FixedContactAnchors anchors),
 14947                anchors,
 14948                out contact);
 49        }
 50
 209751        if (embedded is LSPolygonCollider2D polygon)
 52        {
 148753            return TryGetCuboidPrismContact(
 148754                cuboid,
 148755                embedded,
 148756                polygon.ScaledLocalVertices,
 148757                out contact);
 58        }
 59
 61060        Vector2d halfExtents =
 61061            ((LSAABBoxCollider2D)embedded).ScaledHalfExtents;
 61062        Span<Vector2d> centerRelativeVertices = stackalloc Vector2d[4];
 61063        centerRelativeVertices[0] = new Vector2d(-halfExtents.X, -halfExtents.Y);
 61064        centerRelativeVertices[1] = new Vector2d(halfExtents.X, -halfExtents.Y);
 61065        centerRelativeVertices[2] = new Vector2d(halfExtents.X, halfExtents.Y);
 61066        centerRelativeVertices[3] = new Vector2d(-halfExtents.X, halfExtents.Y);
 61067        return TryGetCuboidPrismContact(
 61068            cuboid,
 61069            embedded,
 61070            centerRelativeVertices,
 61071            out contact);
 72    }
 73
 74    private static bool TryGetCuboidPrismContact(
 75        LSCuboidCollider cuboid,
 76        LSCollider2D embedded,
 77        ReadOnlySpan<Vector2d> centerRelativeVertices,
 78        out MixedContact contact)
 79    {
 209780        Vector3d embeddedCenter = GetEmbeddedCenter3D(embedded);
 209781        return TryGetCuboidRelationContact(
 209782            cuboid.OrientedBox.TryGetConvexPrismContact(
 209783                embeddedCenter,
 209784                embedded.ConvexRotation,
 209785                centerRelativeVertices,
 209786                embedded.MixedHalfThickness,
 209787                out FixedContactAnchors anchors),
 209788            anchors,
 209789            out contact);
 90    }
 91
 92    private static bool TryGetCuboidRelationContact(
 93        bool collided,
 94        in FixedContactAnchors anchors,
 95        out MixedContact contact)
 96    {
 424897        if (!collided)
 87398            return NoContact(out contact);
 99
 3375100        contact = new MixedContact(
 3375101            new ContactAnchor(anchors.FirstAnchor),
 3375102            new ContactAnchor(anchors.SecondAnchor),
 3375103            anchors.Normal,
 3375104            anchors.Depth,
 3375105            anchors.DepthIsClamped);
 3375106        return true;
 107    }
 108
 109    private static bool TryGetSphereConvexPrismContact(
 110        LSSphereCollider sphere,
 111        LSCollider2D embedded,
 112        out MixedContact contact)
 113    {
 2129114        Span<Vector2d> boxOffsets = stackalloc Vector2d[4];
 2129115        ReadOnlySpan<Vector2d> offsets = GetConvexPrismOffsets(
 2129116            embedded,
 2129117            boxOffsets);
 2129118        bool collided = FixedConvexPrismRelations.TryGetSphereContact(
 2129119            sphere.Center,
 2129120            sphere.ScaledRadius,
 2129121            GetEmbeddedCenter3D(embedded),
 2129122            embedded.ConvexRotation,
 2129123            offsets,
 2129124            embedded.MixedHalfThickness,
 2129125            out FixedContactAnchors relation);
 2129126        return TryBuildFinitePrismContact(
 2129127            collided,
 2129128            relation,
 2129129            out contact);
 130    }
 131
 132    private static bool TryGetCapsuleConvexPrismContact(
 133        LSCapsuleCollider capsule,
 134        LSCollider2D embedded,
 135        out MixedContact contact)
 136    {
 2333137        Span<Vector2d> boxOffsets = stackalloc Vector2d[4];
 2333138        ReadOnlySpan<Vector2d> offsets = GetConvexPrismOffsets(
 2333139            embedded,
 2333140            boxOffsets);
 2333141        bool collided =
 2333142            FixedConvexPrismRelations.TryGetCenteredCapsuleContact(
 2333143                capsule.Center,
 2333144                capsule.Rotation,
 2333145                Vector3d.Up,
 2333146                capsule.AxisLength,
 2333147                capsule.ScaledRadius,
 2333148                GetEmbeddedCenter3D(embedded),
 2333149                embedded.ConvexRotation,
 2333150                offsets,
 2333151                embedded.MixedHalfThickness,
 2333152                out FixedContactAnchors relation);
 2333153        return TryBuildFinitePrismContact(
 2333154            collided,
 2333155            relation,
 2333156            out contact);
 157    }
 158
 159    private static bool TryGetCylinderConvexPrismContact(
 160        LSCylinderCollider cylinder,
 161        LSCollider2D embedded,
 162        out MixedContact contact)
 163    {
 376164        Span<Vector2d> boxOffsets = stackalloc Vector2d[4];
 376165        ReadOnlySpan<Vector2d> offsets = GetConvexPrismOffsets(
 376166            embedded,
 376167            boxOffsets);
 376168        bool collided =
 376169            FixedConvexPrismRelations.TryGetCenteredCylinderContact(
 376170                cylinder.Center,
 376171                cylinder.Rotation,
 376172                Vector3d.Up,
 376173                cylinder.Height,
 376174                cylinder.ScaledRadius,
 376175                GetEmbeddedCenter3D(embedded),
 376176                embedded.ConvexRotation,
 376177                offsets,
 376178                embedded.MixedHalfThickness,
 376179                out FixedContactAnchors relation);
 376180        return TryBuildFinitePrismContact(
 376181            collided,
 376182            relation,
 376183            out contact);
 184    }
 185
 186    private static bool TryGetConeConvexPrismContact(
 187        LSConeCollider cone,
 188        LSCollider2D embedded,
 189        out MixedContact contact)
 190    {
 385191        Span<Vector2d> boxOffsets = stackalloc Vector2d[4];
 385192        ReadOnlySpan<Vector2d> offsets = GetConvexPrismOffsets(
 385193            embedded,
 385194            boxOffsets);
 385195        bool collided =
 385196            FixedConvexPrismRelations.TryGetCenteredConeContact(
 385197                cone.Center,
 385198                cone.Rotation,
 385199                Vector3d.Up,
 385200                cone.Height,
 385201                cone.ScaledRadius,
 385202                GetEmbeddedCenter3D(embedded),
 385203                embedded.ConvexRotation,
 385204                offsets,
 385205                embedded.MixedHalfThickness,
 385206                out FixedContactAnchors relation);
 385207        return TryBuildFinitePrismContact(
 385208            collided,
 385209            relation,
 385210            out contact);
 211    }
 212
 213    internal static ReadOnlySpan<Vector2d> GetConvexPrismOffsets(
 214        LSCollider2D? embedded,
 215        Span<Vector2d> boxOffsets)
 216    {
 45725217        if (embedded is null or LSCircleCollider2D or LSCapsuleCollider2D)
 35197218            return ReadOnlySpan<Vector2d>.Empty;
 10528219        if (embedded is LSPolygonCollider2D polygon)
 6091220            return polygon.ScaledLocalVertices;
 221
 4437222        Vector2d halfExtents =
 4437223            ((LSAABBoxCollider2D)embedded).ScaledHalfExtents;
 4437224        boxOffsets[0] = new Vector2d(-halfExtents.X, -halfExtents.Y);
 4437225        boxOffsets[1] = new Vector2d(halfExtents.X, -halfExtents.Y);
 4437226        boxOffsets[2] = new Vector2d(halfExtents.X, halfExtents.Y);
 4437227        boxOffsets[3] = new Vector2d(-halfExtents.X, halfExtents.Y);
 4437228        return boxOffsets;
 229    }
 230
 231    private static bool TryBuildFinitePrismContact(
 232        bool collided,
 233        in FixedContactAnchors relation,
 234        out MixedContact contact)
 235    {
 5223236        if (!collided)
 833237            return NoContact(out contact);
 238
 4390239        contact = new MixedContact(
 4390240            new ContactAnchor(relation.FirstAnchor),
 4390241            new ContactAnchor(relation.SecondAnchor),
 4390242            relation.Normal,
 4390243            relation.Depth,
 4390244            relation.DepthIsClamped);
 4390245        return true;
 246    }
 247}

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Detection/Mixed/CollisionDetectionMixed.Separation.cs

#LineLine coverage
 1//=======================================================================
 2// CollisionDetectionMixed.Separation.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using FixedMathSharp;
 10using FixedMathSharp.Geometry;
 11using Gravitas.Colliders;
 12
 13namespace Gravitas.CollisionHandling;
 14
 15/// <content>
 16/// Computes separation gaps for supported mixed pairs during rotational CCD searches.
 17/// </content>
 18public static partial class CollisionDetectionMixed
 19{
 20    internal static bool TryGetRotationalSeparationGap(
 21        LSCollider collider3D,
 22        LSCollider2D collider2D,
 23        out Fixed64 separationGap,
 24        out bool supported)
 25    {
 1096726        separationGap = Fixed64.Zero;
 1096727        supported = false;
 28
 1096729        if (collider3D is LSSphereCollider sphere
 1096730            && collider2D is LSPolygonCollider2D polygon)
 31        {
 177932            supported = true;
 177933            return TryGetSpherePolygonSlabSeparationGap(
 177934                sphere,
 177935                polygon,
 177936                out separationGap);
 37        }
 38
 918839        if (collider3D is LSCuboidCollider cuboid
 918840            && collider2D is LSCircleCollider2D circle)
 41        {
 201242            supported = true;
 201243            separationGap = cuboid.OrientedBox.GetCircleSlabSeparationLowerBound(
 201244                new Vector3d(
 201245                    circle.Center.X,
 201246                    circle.MixedSlabCenterY,
 201247                    circle.Center.Y),
 201248                circle.MixedHalfThickness,
 201249                circle.ScaledRadius);
 201250            return true;
 51        }
 52
 717653        return false;
 54    }
 55
 56    private static bool TryGetSpherePolygonSlabSeparationGap(
 57        LSSphereCollider sphere,
 58        LSPolygonCollider2D polygon,
 59        out Fixed64 separationGap)
 60    {
 177961        Vector3d center3D = sphere.Center;
 177962        Vector2d center2D = new(center3D.X, center3D.Z);
 177963        if (!TryGetPolygonExteriorGap(polygon, center2D, out Fixed64 planarGap)
 177964            || !TryGetPointIntervalGap(
 177965                center3D.Y,
 177966                polygon.MixedBounds3D.Min.Y,
 177967                polygon.MixedBounds3D.Max.Y,
 177968                out Fixed64 verticalGap))
 69        {
 570            separationGap = default;
 571            return false;
 72        }
 73
 74        // Both gaps are non-negative representable distances, so subtracting a
 75        // positive representable radius cannot leave Fixed64's signed domain.
 177476        separationGap = FixedMath.Max(planarGap, verticalGap) - sphere.ScaledRadius;
 177477        if (separationGap < Fixed64.Zero)
 71278            separationGap = Fixed64.Zero;
 177479        return true;
 80    }
 81
 82    private static bool TryGetPolygonExteriorGap(
 83        LSPolygonCollider2D polygon,
 84        Vector2d point,
 85        out Fixed64 exteriorGap)
 86    {
 177987        ReadOnlySpan<Vector2d> offsets = polygon.ScaledLocalVertices;
 177988        if (FixedConvex2dRelations.ContainsPoint(
 177989                point,
 177990                polygon.Center,
 177991                polygon.Rotation,
 177992                offsets))
 93        {
 594            exteriorGap = Fixed64.Zero;
 595            return true;
 96        }
 97
 177498        FixedPointAnchor2d closestPoint =
 177499            FixedConvex2dRelations.GetClosestPointAnchor(
 1774100                point,
 1774101                polygon.Center,
 1774102                polygon.Rotation,
 1774103                offsets);
 1774104        if (!new ContactAnchor2D(closestPoint)
 1774105                .TryGetOffsetFrom(point, out Vector2d difference)
 1774106            || !Vector2d.TryGetMagnitude(difference, out exteriorGap))
 107        {
 3108            exteriorGap = default;
 3109            return false;
 110        }
 111
 1771112        return true;
 113    }
 114
 115    private static bool TryGetPointIntervalGap(
 116        Fixed64 point,
 117        Fixed64 min,
 118        Fixed64 max,
 119        out Fixed64 gap) =>
 1776120        TryGetIntervalGap(point, point, min, max, out gap);
 121
 122    private static bool TryGetIntervalGap(
 123        Fixed64 firstMin,
 124        Fixed64 firstMax,
 125        Fixed64 secondMin,
 126        Fixed64 secondMax,
 127        out Fixed64 gap)
 128    {
 1776129        if (firstMax < secondMin)
 26130            return Fixed64.TrySubtract(secondMin, firstMax, out gap);
 1750131        if (secondMax < firstMin)
 2132            return Fixed64.TrySubtract(firstMin, secondMax, out gap);
 133
 1748134        gap = Fixed64.Zero;
 1748135        return true;
 136    }
 137}

/home/runner/work/Gravitas/Gravitas/src/Gravitas/CollisionHandling/Detection/Mixed/CollisionDetectionMixed.Support.cs

#LineLine coverage
 1//=======================================================================
 2// CollisionDetectionMixed.Support.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System.Runtime.CompilerServices;
 9using FixedMathSharp;
 10using Gravitas.Colliders;
 11
 12namespace Gravitas.CollisionHandling;
 13
 14/// <content>
 15/// Resolves embedded planar poses, axes, and fallback normals for mixed collision detection.
 16/// </content>
 17public static partial class CollisionDetectionMixed
 18{
 19    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 20    private static bool TryNormalizeAxis(
 21        Vector3d axis,
 22        out Vector3d normalizedAxis)
 23    {
 165924        Fixed64 magnitudeSqr = axis.MagnitudeSquared;
 165925        if (magnitudeSqr <= Fixed64.Epsilon)
 26        {
 11227            normalizedAxis = Vector3d.Zero;
 11228            return false;
 29        }
 30
 154731        normalizedAxis = axis.Normalized;
 154732        return true;
 33    }
 34
 35    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 36    private static Vector3d GetEmbeddedCenter3D(LSCollider2D embedded) =>
 1919437        MixedEmbedded2DGeometry.GetCenter3D(embedded);
 38
 39    private static void GetEmbeddedCapsuleAxes(
 40        LSCapsuleCollider2D capsule,
 41        out Vector2d planarAxis,
 42        out Vector3d axis,
 43        out Vector3d normal)
 44    {
 20545        if (capsule.AxisLength <= Fixed64.Epsilon)
 46        {
 247            planarAxis = Vector2d.Forward;
 248            axis = Vector3d.Zero;
 249            normal = Vector3d.Zero;
 250            return;
 51        }
 52
 20353        planarAxis = new Vector2d(
 20354            -FixedMath.Sin(capsule.Rotation),
 20355            FixedMath.Cos(capsule.Rotation));
 20356        axis = new Vector3d(
 20357            planarAxis.X,
 20358            Fixed64.Zero,
 20359            planarAxis.Y);
 20360        Vector2d planarNormal = planarAxis.RightHandNormal;
 20361        normal = new Vector3d(
 20362            planarNormal.X,
 20363            Fixed64.Zero,
 20364            planarNormal.Y);
 20365    }
 66
 67    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 68    private static Vector3d GetRigidUpAxis(FixedQuaternion rotation) =>
 116269        (rotation * Vector3d.Up).Normalized;
 70
 71    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 72    private static Vector3d ResolveFallbackNormal(
 73        Vector3d sphereCenter,
 74        LSCollider2D embedded)
 75    {
 1176        Vector3d fallback = new(
 1177            embedded.Center.X - sphereCenter.X,
 1178            embedded.MixedSlabCenterY - sphereCenter.Y,
 1179            embedded.Center.Y - sphereCenter.Z);
 1180        return fallback.MagnitudeSquared > Fixed64.Epsilon
 1181            ? fallback.Normalized
 1182            : Vector3d.Right;
 83    }
 84
 85    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 86    private static bool NoContact(out MixedContact contact)
 87    {
 181788        contact = default;
 181789        return false;
 90    }
 91}

Methods/Properties

IntersectsForContinuousCollision(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,FixedMathSharp.Fixed64,System.Int32,Gravitas.CollisionHandling.MeshSlabFaceRegions)
AppendMeshEmbedded2D(Gravitas.Colliders.LSMeshCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.ContactManifold,System.Int32,System.Int32)
AppendMeshCircleSlabContacts(Gravitas.Colliders.LSMeshCollider,FixedMathSharp.Vector3d,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,System.ReadOnlySpan`1<System.Int32>,Gravitas.CollisionHandling.ContactManifold)
AppendMeshSlabContacts(Gravitas.Colliders.LSMeshCollider,Gravitas.Colliders.LSCollider2D,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,System.ReadOnlySpan`1<System.Int32>,Gravitas.CollisionHandling.ContactManifold,System.Int32,System.Int32)
TryAppendConvexMeshPrismContacts(Gravitas.Colliders.LSMeshCollider,Gravitas.Colliders.LSCollider2D,FixedMathSharp.Vector3d,FixedMathSharp.FixedQuaternion,FixedMathSharp.Fixed64,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,System.ReadOnlySpan`1<System.Int32>,Gravitas.CollisionHandling.ContactManifold,System.Int32,System.Int32)
FillPrismGeometry(System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,FixedMathSharp.Fixed64,System.Span`1<FixedMathSharp.Vector3d>,System.Span`1<System.Int32>,System.Span`1<System.Int32>)
TryCollide(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryBuildManifold(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.ContactManifold)
TryBuildDiscreteManifold(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.ContactManifold)
AppendManifold(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.ContactManifold,System.Int32,System.Int32,System.Boolean)
TryPrimitiveContact(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TrySphereEmbedded2D(Gravitas.Colliders.LSSphereCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryCapsuleEmbedded2D(Gravitas.Colliders.LSCapsuleCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryCylinderEmbedded2D(Gravitas.Colliders.LSCylinderCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryConeEmbedded2D(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryGetCapsuleCircleSlabContact(Gravitas.Colliders.LSCapsuleCollider,Gravitas.Colliders.LSCollider2D,FixedMathSharp.Fixed64,Gravitas.CollisionHandling.MixedContact&)
TryTestCylinderCircleSlab(Gravitas.Colliders.LSCylinderCollider,Gravitas.Colliders.LSCircleCollider2D,Gravitas.CollisionHandling.AxisPenetration&)
TryTestConeCircleSlab(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCircleCollider2D,Gravitas.CollisionHandling.AxisPenetration&)
TryTestCylinderCapsuleSlab(Gravitas.Colliders.LSCylinderCollider,Gravitas.Colliders.LSCapsuleCollider2D,Gravitas.CollisionHandling.AxisPenetration&)
TryTestConeCapsuleSlab(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCapsuleCollider2D,Gravitas.CollisionHandling.AxisPenetration&)
CheckConeCircleSlabAxis(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCircleCollider2D,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
CheckCylinderPrismAxis(Gravitas.Colliders.LSCylinderCollider,Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector3d,FixedMathSharp.Vector2d,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
CheckConePrismAxis(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector2d,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
KeepAxisPenetration(FixedMathSharp.Vector3d,FixedMathSharp.Fixed64,System.Boolean,Gravitas.CollisionHandling.AxisPenetration&)
CheckEmbeddedCapsuleAxes(Gravitas.Colliders.LSCylinderCollider,FixedMathSharp.Vector3d,Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector2d,FixedMathSharp.Vector3d,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
CheckEmbeddedCapsuleAxes(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector2d,FixedMathSharp.Vector3d,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
CheckCylinderEmbeddedCapsuleEdgeAxis(Gravitas.Colliders.LSCylinderCollider,FixedMathSharp.Vector3d,Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector2d,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
CheckConeEmbeddedCapsuleEdgeAxis(Gravitas.Colliders.LSConeCollider,FixedMathSharp.Vector3d,Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector2d,FixedMathSharp.Vector3d,Gravitas.CollisionHandling.AxisPenetration&)
BuildCylinderContact(Gravitas.Colliders.LSCylinderCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.AxisPenetration,Gravitas.CollisionHandling.MixedContact&)
BuildConeContact(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.AxisPenetration,Gravitas.CollisionHandling.MixedContact&)
BuildCanonicalSupportContact(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,FixedMathSharp.Vector3d,FixedMathSharp.Fixed64,System.Boolean)
TryCuboidEmbedded2D(Gravitas.Colliders.LSCuboidCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryGetCuboidPrismContact(Gravitas.Colliders.LSCuboidCollider,Gravitas.Colliders.LSCollider2D,System.ReadOnlySpan`1<FixedMathSharp.Vector2d>,Gravitas.CollisionHandling.MixedContact&)
TryGetCuboidRelationContact(System.Boolean,FixedMathSharp.Geometry.FixedContactAnchors&,Gravitas.CollisionHandling.MixedContact&)
TryGetSphereConvexPrismContact(Gravitas.Colliders.LSSphereCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryGetCapsuleConvexPrismContact(Gravitas.Colliders.LSCapsuleCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryGetCylinderConvexPrismContact(Gravitas.Colliders.LSCylinderCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
TryGetConeConvexPrismContact(Gravitas.Colliders.LSConeCollider,Gravitas.Colliders.LSCollider2D,Gravitas.CollisionHandling.MixedContact&)
GetConvexPrismOffsets(Gravitas.Colliders.LSCollider2D,System.Span`1<FixedMathSharp.Vector2d>)
TryBuildFinitePrismContact(System.Boolean,FixedMathSharp.Geometry.FixedContactAnchors&,Gravitas.CollisionHandling.MixedContact&)
TryGetRotationalSeparationGap(Gravitas.Colliders.LSCollider,Gravitas.Colliders.LSCollider2D,FixedMathSharp.Fixed64&,System.Boolean&)
TryGetSpherePolygonSlabSeparationGap(Gravitas.Colliders.LSSphereCollider,Gravitas.Colliders.LSPolygonCollider2D,FixedMathSharp.Fixed64&)
TryGetPolygonExteriorGap(Gravitas.Colliders.LSPolygonCollider2D,FixedMathSharp.Vector2d,FixedMathSharp.Fixed64&)
TryGetPointIntervalGap(FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&)
TryGetIntervalGap(FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64,FixedMathSharp.Fixed64&)
TryNormalizeAxis(FixedMathSharp.Vector3d,FixedMathSharp.Vector3d&)
GetEmbeddedCenter3D(Gravitas.Colliders.LSCollider2D)
GetEmbeddedCapsuleAxes(Gravitas.Colliders.LSCapsuleCollider2D,FixedMathSharp.Vector2d&,FixedMathSharp.Vector3d&,FixedMathSharp.Vector3d&)
GetRigidUpAxis(FixedMathSharp.FixedQuaternion)
ResolveFallbackNormal(FixedMathSharp.Vector3d,Gravitas.Colliders.LSCollider2D)
NoContact(Gravitas.CollisionHandling.MixedContact&)