9 lines
308 B
Mathematica
9 lines
308 B
Mathematica
|
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
|