Trick Shot: Difference between revisions

From programming_contest
Jump to navigation Jump to search
imported>Kmk21
No edit summary
imported>Kmk21
No edit summary
Line 13: Line 13:
There are a couple other caveats:
There are a couple other caveats:
* we have to check whether any of the above lines are impossible because they would intersect some other ball first. It should be sufficient to check that no other balls are within 2r of a given line over the range which we need the ball to travel freely (HINT: java line.ptsegdist)
* we have to check whether any of the above lines are impossible because they would intersect some other ball first. It should be sufficient to check that no other balls are within 2r of a given line over the range which we need the ball to travel freely (HINT: java line.ptsegdist)
* we have to check whether our target ball is not in the way of the the point at which we need to contact the same ball (imagine 3 and 1 being in opposite positions)
* we have to check whether intersection points lie on the table
* we have to check whether intersection points lie on the table
* We should not have to worry about whether the cue ball could later interfere with ball 3 as the problem indicates the speed is irrelevant
* We should not have to worry about whether the cue ball could later interfere with ball 3 as the problem indicates the speed is irrelevant

Revision as of 02:38, 7 November 2017

This problem asks us if it is possible to sink 2 pool balls in a very specific manner giving an invented physics.

This problem is purely mathematical.

  1. We can calculate exactly where ball 3 must be struck in order to fall. (hint: colinear with ball 3 and the hole at a distance 2r from the center of ball 3)
  2. we can then calculate where ball 1 must be struck in order to reach the point calculated above in the same manner
  3. We can then calculate where ball 2 must be struck
  4. We can then determine the angle the cue ball must take after striking ball 1 before striking ball 2 (using the points calculated in 2 and 3)
  5. We can then determine the INCOMING angle of the cueball (the reflected business described in the problem)
  6. We can then intersect the line at the angle from 5 with the 'h' line
  7. if the intersection lies within w, it is possible

There are a couple other caveats:

  • we have to check whether any of the above lines are impossible because they would intersect some other ball first. It should be sufficient to check that no other balls are within 2r of a given line over the range which we need the ball to travel freely (HINT: java line.ptsegdist)
  • we have to check whether our target ball is not in the way of the the point at which we need to contact the same ball (imagine 3 and 1 being in opposite positions)
  • we have to check whether intersection points lie on the table
  • We should not have to worry about whether the cue ball could later interfere with ball 3 as the problem indicates the speed is irrelevant