# How to find how many times an object’s path crosses another?

I have several hundred objects that will move in a fixed area throughout the day. Frequently the objects will cross over another object’s path, either at the same time (eg. a collision) or within a few seconds or minutes, the time window tolerance. How can I determine how many times that happens throughout a fixed period of time, let’s say in a day?

For example, to visualize it on a simple level, let’s say I have 2 points, A & B, arranged in a north-south and east-west configuration:

``         (A) - Loc 1                |               | ``

Loc 3———————- (B) Loc 4

``              |               |             Loc 2 ``

Object A moves only from Loc 1 to Loc 2 throughout a given period of time. Likewise Object B only moves from Loc 3 to Loc 4 during that same period of time. They cross paths at the center. One could just calculate the speed of A and figure out when it hits the location of the path cross, and also do that with B. Then simply determine when those cross point time windows are close. However that logic breaks down when I have hundreds of objects, variable indirect paths, and changing speeds.

What I am given at the end of the day is the path of each object, timestamps along the path, stops and times. Is there a straightforward way or algorithm to determine how many times one path crossed another during a time window tolerance?