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