Java, Simulation, Programming, Science, Coding.
(dvdv == 0) return Double.POSITIVE_INFINITY; double drdr = dx * dx + dy * dy; double sigma = this.radius + that.radius; double d = (dvdr * dvdr) - dvdv * (drdr - sigma * sigma); if (d < 0) return Double.POSITIVE_INFINITY; return -(dvdr + Math.sqrt(d)) / dvdv; } Here comes the heavy lifting. This