Java, Simulation, Programming, Science, Coding.
particle on a 2D plane. public double timeToHitHorizontalWall() { if (vy > 0) return (1.0 - ry - radius) / vy; else if (vy < 0) return (radius - ry) / vy; else return Double.POSITIVE_INFINITY; } public double timeToHitVerticalWall() { if (vx > 0) return (1.0 - rx - radius) / vx; else if (vx < 0)