Class ContactManifold2D
- Namespace
- Gravitas.CollisionHandling
- Assembly
- Gravitas.dll
Pair-owned deterministic contact manifold with up to two samples per geometric surface group and no fixed pair-wide group or contact limit.
public sealed class ContactManifold2D : IEnumerable<ManifoldContact2D>, IEnumerable
- Inheritance
-
ContactManifold2D
- Implements
- Inherited Members
Remarks
Inspection flattens canonical structural group order, then ascending contact identity within each group. Index zero is not necessarily the deepest contact; use PrimaryContact for that purpose. Overflow capacity is retained across updates and resets; reaching a new high-water mark can allocate.
Constructors
ContactManifold2D()
public ContactManifold2D()
Fields
MaxContactCount
Maximum samples in the default group; independent groups have no pair-wide cap.
public const int MaxContactCount = 2
Field Value
MaxContactsPerGroup
Maximum number of point samples retained per geometric surface group.
public const int MaxContactsPerGroup = 2
Field Value
Properties
Count
Total number of active samples across all groups, without a fixed pair-wide cap.
public int Count { get; }
Property Value
GroupCount
Number of independent surface regions currently retained; this has no fixed pair-wide cap.
public int GroupCount { get; }
Property Value
HasContact
Gets whether this manifold currently contains narrow-phase contact data.
public bool HasContact { get; }
Property Value
this[int]
Gets a contact in flattened structural-group/ascending-contact-identity order.
public ManifoldContact2D this[int index] { get; }
Parameters
indexint
Property Value
LastUpdatedFrame
Simulation frame in which the active contacts were last rebuilt.
public long LastUpdatedFrame { get; }
Property Value
PrimaryContact
Deepest contact in the manifold. Ties use the lowest contact identity.
public ManifoldContact2D PrimaryContact { get; }
Property Value
Methods
AddContact(Vector2d, Vector2d, Fixed64, Vector2d)
Adds a contact, keeping up to two samples in the default surface group and exposing them by stable contact identity.
public void AddContact(Vector2d pointA, Vector2d pointB, Fixed64 depth, Vector2d normal)
Parameters
pointAVector2dpointBVector2ddepthFixed64normalVector2d
AddContact(ContactAnchor2D, ContactAnchor2D, Fixed64, Vector2d, bool)
Adds a rigid-frame contact, keeping up to two samples in the default surface group and exposing them by stable anchor identity.
public void AddContact(ContactAnchor2D anchorA, ContactAnchor2D anchorB, Fixed64 depth, Vector2d normal, bool depthIsClamped = false)
Parameters
anchorAContactAnchor2DanchorBContactAnchor2DdepthFixed64normalVector2ddepthIsClampedbool
BeginUpdate(long)
Clears contacts and records the frame for a new narrow-phase pass.
public void BeginUpdate(long frame)
Parameters
framelong
GetEnumerator()
Returns an allocation-free enumerator over the active contacts.
public ContactManifold2D.Enumerator GetEnumerator()
Returns
GetGroupContactCount(int)
Gets the number of retained samples in a group, from one through MaxContactsPerGroup.
public int GetGroupContactCount(int groupIndex)
Parameters
groupIndexint
Returns
GetGroupStartIndex(int)
Gets the first flattened point index of a group in canonical structural order.
public int GetGroupStartIndex(int groupIndex)
Parameters
groupIndexint
Returns
Reset()
Clears all contact data.
public void Reset()
SetContact(Vector2d, Vector2d, Fixed64, Vector2d)
Replaces the manifold with one contact.
public void SetContact(Vector2d pointA, Vector2d pointB, Fixed64 depth, Vector2d normal)
Parameters
pointAVector2dpointBVector2ddepthFixed64normalVector2d
SetContact(ContactAnchor2D, ContactAnchor2D, Fixed64, Vector2d, bool)
Replaces the manifold with one rigid-frame contact.
public void SetContact(ContactAnchor2D anchorA, ContactAnchor2D anchorB, Fixed64 depth, Vector2d normal, bool depthIsClamped = false)
Parameters
anchorAContactAnchor2DanchorBContactAnchor2DdepthFixed64normalVector2ddepthIsClampedbool