Wrapped the exit condition in to its own function now checking if the position, velocity meet certain criteria and account for collision events.

This commit is contained in:
Karthik 2021-07-11 14:35:54 +02:00
parent 058fa0fb19
commit b6d56e9e7b

View File

@ -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