Click or drag to resize
DigitalRuneContactSet Class
A collection of Contacts that describe the contact points or closest points between to collision objects.
Inheritance Hierarchy
SystemObject
  DigitalRune.Geometry.CollisionsContactSet

Namespace: DigitalRune.Geometry.Collisions
Assembly: DigitalRune.Geometry (in DigitalRune.Geometry.dll) Version: 1.18.0.0 (1.18.2.14427)
Syntax
public sealed class ContactSet : IList<Contact>, 
	ICollection<Contact>, IEnumerable<Contact>, IEnumerable, 
	ICollection, IRecyclable

The ContactSet type exposes the following members.

Methods
  NameDescription
Public methodAdd
Adds a Contact to the end of the ContactSet.
Public methodAsReadOnly
Public methodClear
Removes and recycles all Contacts from the ContactSet.
Public methodContains
Determines whether the ContactSet contains a specific Contact.
Public methodCopyTo
Copies the Contacts of the ContactSet to an Array, starting at a particular Array index.
Public methodStatic memberCreate
Creates an instance of the ContactSet class. (This method reuses a previously recycled instance or allocates a new instance if necessary.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumerator that iterates through the ContactSet.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Determines the index of a specific Contact in the ContactSet.
Public methodInsert
Inserts an Contact in the ContactSet at the specified index.
Public methodRecycle
Recycles this instance of the ContactSet class.
Public methodRecycle(Boolean)
Recycles this instance of the ContactSet class.
Public methodRemove
Removes the first occurrence of a specific Contact from the ContactSet.
Public methodRemoveAt
Removes the Contact at the specified index.
Public methodReset
Resets this contact set to default values.
Public methodToString
Returns a String that represents the current Object.
(Overrides ObjectToString.)
Top
Extension Methods
  NameDescription
Public Extension MethodAddRangeContact (Defined by CollectionHelper.)
Public Extension MethodDoContact(ActionContact)Overloaded.
Performs the given action on each element in a sequence when it is enumerated.
(Defined by LinqHelper.)
Public Extension MethodDoContact(ActionContact, Int32)Overloaded.
Performs the given action on each element (incorporating its index) in a sequence when it is enumerated.
(Defined by LinqHelper.)
Public Extension MethodForEachContact(ActionContact)Overloaded.
Immediately performs the given action on each element in a sequence.
(Defined by LinqHelper.)
Public Extension MethodForEachContact(ActionContact, Int32)Overloaded.
Immediately performs the given action on each element (incorporating its index) in a sequence.
(Defined by LinqHelper.)
Public Extension MethodIndexOfContact
Returns the index of the first element in a sequence that satisfies the specified condition.
(Defined by LinqHelper.)
Top
Properties
  NameDescription
Public propertyCount
Gets the number of Contacts contained in the ContactSet.
Public propertyHaveContact
Gets or sets a value indicating whether ObjectA and ObjectB are in contact.
Public propertyItem
Gets or sets the Contact at the specified index.
Public propertyObjectA
Gets collision object A.
Public propertyObjectB
Gets collision object B.
Public propertySwapped
Gets a copy of the contact set where ObjectA and ObjectB are swapped.
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodICollectionCopyTo
Copies the Contacts of the ContactSet to an Array, starting at a particular Array index.
Explicit interface implementationPrivate methodIEnumerableContactGetEnumerator
Returns an enumerator that iterates through the collection.
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through a collection.
Explicit interface implementationPrivate propertyICollectionContactIsReadOnly
Explicit interface implementationPrivate propertyICollectionIsSynchronized
Gets a value indicating whether access to the ICollection is synchronized (thread safe).
Explicit interface implementationPrivate propertyICollectionSyncRoot
Gets an object that can be used to synchronize access to the ICollection.
Top
Remarks

A ContactSet collects Contacts between two CollisionObjects. A CollisionDomain creates one ContactSet for each pair of touching objects.

Swapped Contact Sets: The order of ObjectA and ObjectB is determined in the collision detection when the contact set is created. When the collision detection returns a contact set with a method like GetContacts(objectA, objectB), the objects in the contact set could be swapped such that contactSet.ObjectA == objectB and contactSet.ObjectB == objectA. If your algorithms rely on the order of ObjectA and ObjectB, for example when the contact normal vectors are used, you need to manually check whether the objects are in the expected order. By calling the property Swapped you can get a copy of the contact set where ObjectA and ObjectB are swapped and all contacts are updated accordingly.

See Also