Maybe some people might be interested in this formula when trying to dodge missiles.
Knowing a missile position and velocity via appropriate methods .pos & .velocity.
p stands for position
v stands for velocity
d stands for the closest distance the missile will pass by your hero.
p = missile.pos ;
p0 = this.pos ;
v = missile.velocity ;
vNorm = Math.sqrt( v.x * v.x + v.y * v.y ) ;
d = Math.abs( ( v.x * ( p.y - p0.y ) ) - ( v.y * ( p.x - p0.x ) ) ) / vNorm ;
In explicit wording, d is equal to the positive ( cross product of ( (the missile velocity) and (the vector “missile -> me”) ) ) divided by the norm of the missile velocity. (This definition would also work in 3D btw, as long as the trajectories are still linear)
A for-loop across the missiles that are close to your hero will provide you a list of dangerous missiles (if d < colisionRadius ). You might want to dodge those missiles.
For more documentation, I invite you to check Wikipedia
Edit : added 3 handwritten lines of explainations.
Explaination