From bb5f70ce7f260d57b0f7dfc83c2f0a98d0b94b00 Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Sun, 11 Jul 2021 14:39:26 +0200 Subject: [PATCH] Wrapped the calculation of the collision event probability in its own function. --- .../@MOTSimulator/computeCollisionProbability.m | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 MOT Capture Process Simulation/@MOTSimulator/computeCollisionProbability.m diff --git a/MOT Capture Process Simulation/@MOTSimulator/computeCollisionProbability.m b/MOT Capture Process Simulation/@MOTSimulator/computeCollisionProbability.m new file mode 100644 index 0000000..7b34fe7 --- /dev/null +++ b/MOT Capture Process Simulation/@MOTSimulator/computeCollisionProbability.m @@ -0,0 +1,9 @@ +function ret = computeCollisionProbability(this) + collision = rand(1); + CollisionProbability = 1 - exp(-this.TimeSpentInInteractionRegion/this.CollisionTime); + if this.BackgroundCollision && collision <= CollisionProbability + ret = true; + else + ret = false; + end +end \ No newline at end of file