Wrapped the calculation of the collision event probability in its own function.
This commit is contained in:
parent
951c2e3935
commit
bb5f70ce7f
@ -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
|
Loading…
Reference in New Issue
Block a user