Count line crossings🔗
Counts the number of times a trajectory or a set of trajectories crosses a line segment. The tool considers only the end of a trajectory; a crossing will be counted only if the last point of a trajectory is the first one on that side of the detection line.
The tool makes a distinction between positive and negative crossing direction. If you think of the line segment as the X axis of a right-handed coordinate system, positive and negative directions are defined by the direction of the Y axis. That is, if the line segment points up, positive direction is to the right.
Inputs🔗
trajectories
: A trajectory or a set of trajectories represented as an N-by-2 matrix. If there is only one trajectory, both outputs will be either 0 or 1.blockSize
: If the input contains multiple trajectories, this matrix stores the number of points in each. An M-by-1 integer matrix in which the number of rows (M) corresponds to the number of detected trajectories.identifiers
: A (temporarily) unique identifier for each trajectory. An M-by-1 integer matrix containing an auto-generated unique ID for each trajectory.startPoint
: The location of the start of a line segment.endPoint
: The location of the end of a line segment.width
: The width of the detection line. A non-zero width can be used as a hysteresis: a crossing will be detected only if a trajectory crosses two lines that are width units apart.
Outputs🔗
positiveCrossings
: The number of crossings to the positive direction.positiveIdentifiers
: Identifiers of those trajectories which made a positive crossing.negativeCrossings
: The number of crossings to the negative direction.negativeIdentifiers
: Identifiers of those trajectories which made a negative crossing.