From b6d56e9e7be2c95bacf08c5e51b2700674646f50 Mon Sep 17 00:00:00 2001 From: Karthik Chandrashekara Date: Sun, 11 Jul 2021 14:35:54 +0200 Subject: [PATCH] Wrapped the exit condition in to its own function now checking if the position, velocity meet certain criteria and account for collision events. --- .../@MOTSimulator/exitCondition.m | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 MOT Capture Process Simulation/@MOTSimulator/exitCondition.m diff --git a/MOT Capture Process Simulation/@MOTSimulator/exitCondition.m b/MOT Capture Process Simulation/@MOTSimulator/exitCondition.m new file mode 100644 index 0000000..de84d2f --- /dev/null +++ b/MOT Capture Process Simulation/@MOTSimulator/exitCondition.m @@ -0,0 +1,11 @@ +function ret = exitCondition(this, PositionVector, VelocityVector, CollisionEvent) + d = Helper.calculateDistanceFromPointToLine(PositionVector, [0 0 0], [0 1 0]); + y = PositionVector(2); + DivergenceAngle = (d/abs(y)); + %DivergenceAngle = atan(norm(cross(PositionVector, )) / norm(dot(PositionVector, [0 1 0]))); + if (y >= 0) && (DivergenceAngle <= this.MOTExitDivergence) && (abs(VelocityVector(2))<=this.VelocityCutoff) && ~CollisionEvent + ret = true; + else + ret = false; + end +end \ No newline at end of file