CollisionDetection2D Class

Utility class for performing Collision Detection 2D on Plane XY (for ICurve and Region types only).
Public Class CollisionDetection2D 
Inherits WorkUnit
This language is not supported or no code example is available.
public class CollisionDetection2D : WorkUnit
This language is not supported or no code example is available.
Name Description
Public constructor CollisionDetection2D(IList<Entity>, BlockKeyedCollection, bool, collisionCheckType, int) The Collision detection utility constructor with a list of entity. The collision test checks collisions among the entities of the same list (all to all check).
Public constructor CollisionDetection2D(IList<Entity>, IList<Entity>, BlockKeyedCollection, bool, collisionCheckType, int) The Collision detection utility constructor with two entity lists. The collision test checks collisions from the first entity list to the second one.
Top
Name Description
Public property CheckMethod Gets or sets the collision accuracy type.
Public property CoincidenceAsCollision When true it considers the coincidence between objects as collision. It avoids them otherwise.
Public property ExecutionTime Gets the (last) work execution time in milliseconds. (inherited from WorkUnit).
Public property FirstOnly When true the collision detection will stop at the first entities tuple found.
Public property Log Gets the list of errors and warnings generated during execution. (inherited from WorkUnit).
Public property Result The resulting collision Data subdivided for tuples of intersecting entities.
Public property Status Gets the WorkUnit status. (inherited from WorkUnit).
Public property Static obbCollisionText Gets or sets the "Collision detection..." text string.
Public property Static octreeCollisionText Gets or sets the "Collision detection with QuadTree..." text string.
Public property Static preCollisionText Gets or sets the "Preparing data..." text string.
Top
Methods
 
Name Description
Protected method AccurateIntersection(Entity, Entity, bool, out List<Entity>) Checks if two entity intersect geometrically.
Protected method BuildEntityTree(Entity, int, BackgroundWorker, DoWorkEventArgs)
Internal protected (Protected Friend) method Cancelled(BackgroundWorker, DoWorkEventArgs) Checks if the user has requested cancellation of the background operation. (inherited from WorkUnit).
Public method ClearCache() Removes all the objects defined for collision detection.
Protected method ComputeAccurateVolume(Entity, Transformation, Entity, Transformation, ref List<Entity>)
Public method ComputeIntersectionVolume() Performs extra computation to find the intersection volumes of each Colliding Entities tuple. The CollisionResult.CollisionItems is filled with the list of the intersection volumes found.
Protected method ComputeLeafsTrees(BackgroundWorker, DoWorkEventArgs)
Protected method ComputeOrientedBoundings(BackgroundWorker, DoWorkEventArgs) Computes the oriented bounding rect/box for all the entities in the groups (or update only the modified entities)
Protected method ComputeSubdivisionTreeVolume(Entity, Transformation, Entity, Transformation, ref List<Entity>)
Internal protected (Protected Friend) method DoWork(BackgroundWorker, DoWorkEventArgs) Does the actual work allowing progress bar update and cancellation.
Public method Equals(Object) Determines whether the specified object is equal to the current object. (inherited from Object).
Protected method Static FillCollidedTuple(Entity, Entity, List<CollisionResult>, List<Entity>)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (inherited from Object).
Protected method Static GetEntitiesToBuildTree(IList<Entity>, BlockKeyedCollection)
Protected method GetEntityForSubdivisionTree(Entity)
Public method GetHashCode Serves as the default hash function. (inherited from Object).
Public method GetType Gets the Type of the current instance. (inherited from Object).
Protected method IntersectOB(Entity, Entity, ref List<CollisionResult>, out List<Entity>, BackgroundWorker, DoWorkEventArgs) Check intersection between Oriented Bounding (Rect or Box) of two root entities (the entities can be BlockReference), by using SAT algorithm.
Protected method IntersectTree(Entity, Entity, ref List<CollisionResult>, out List<Entity>, BackgroundWorker, DoWorkEventArgs) Check intersection between Octrees of two root entities (the entities can be BlockReference), by using SAT algorithm.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (inherited from Object).
Protected method OrientedBoundingBoxCollision(BackgroundWorker, DoWorkEventArgs) Check collision among oriented bounding boxes of the entities groups
Public method PrepareDataForCollision(BackgroundWorker, DoWorkEventArgs) Computes the collision detection data needed during the check.
Internal protected (Protected Friend) method ResetProgressParallel(int) Resets the progress bar for a parallel loop. (inherited from WorkUnit).
Internal protected (Protected Friend) method StartContinuousAnimation(string, BackgroundWorker, params string[]) Start the animation for the continuous progress bar. (inherited from WorkUnit).
Internal protected (Protected Friend) method StopContinuousAnimation(BackgroundWorker) Stop the animation for the continuous progress bar. (inherited from WorkUnit).
Public method ToString Returns a string that represents the current object. (inherited from Object).
Protected method TreesCollision(BackgroundWorker, DoWorkEventArgs) Check collision among octrees of the entities groups
Internal protected (Protected Friend) method UpdateProgress(double, double, string, BackgroundWorker, bool, params string[]) Updates the progress bar value. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgress(int, int, string, BackgroundWorker, bool, params string[]) Updates the progress bar value. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressAndCheckCancelled(int, int, string, BackgroundWorker, DoWorkEventArgs, bool, params string[]) Updates the progress bar value and checks if the worker thread has been canceled. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressAndCheckCancelledParallel(int, string, BackgroundWorker, DoWorkEventArgs, params string[]) Updates the progress bar value and checks if the worker thread has been canceled, for a parallel loop. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressParallel(double, string, BackgroundWorker, params string[]) Updates the progress bar value for a parallel loop. (inherited from WorkUnit).
Internal protected (Protected Friend) method UpdateProgressTo100(string, BackgroundWorker, params string[]) Set the progress bar to 100% and forces screen update. (inherited from WorkUnit).
Internal protected (Protected Friend) method WorkCancelled(Environment) Called when the work is cancelled. (inherited from WorkUnit).
Internal protected (Protected Friend) method WorkCompleted(Environment) Called when the work has completed. In the case you are modeling something, the environment parameter allows you to easily add the model to the entities collection. (inherited from WorkUnit).
Internal protected (Protected Friend) method WorkFailed(Environment) Called when the work has failed. (inherited from WorkUnit).
Top
Events
 
Name Description
Public event ProgressChanged Occurs when the DoWork() is called synchronously and the progress has changed. (inherited from WorkUnit).
Top
Name Description
Public structure CollisionResult The resulting collision information after a Collision check between two colliding leaves entities.
Public structure CollisionTupleItem The resulting sub-item of the CollisionResult.CollidedEntities tuple result. If the resulting collided entity is a leaf, then the name of the first block containing that entity will be saved into ParentName field and the trasformation field will be filled.
Top
Name Description
Public enumeration collisionCheckType The accuracy type used during collision detection.
Top
Fields
 
Name Description
Protected field _allToAll When true, it detects collition from a unique list of entities intersecting each others. When false, it takes two list of separate object. Detects wich entities of the first list intersect what of the second.
Public field _checkMethod
Protected field _entities1 Lists of entities to check during collision detection.
Protected field _entities2 Lists of entities to check during collision detection.
Protected field blocks
Protected field currentProgress
Internal protected (Protected Friend) field log (inherited from WorkUnit).
Protected field maxNumElemForQuadTreeNode
Top
Remarks
 
The Regen() method needs to be called first for the interested entities (except for LinearPath).

.NET Framework

Supported in: 4.8

In this article

Definition