# Rigid Body Collisions in golf

1. May 11, 2012

### Epidemius5

hi there,
I have been working on this particular problem for some weeks?months? now, and it has me quite stumped. I need to calculate the x,y,z co-ords of a golf ball after it has been putted into a hole, when it contacts the opposite rim, assuming it is travelling fast enough to contact the other side.
The first problem is to find a function for the x,y co-ordinates in a cross section. I have tried to find the distance between the point where it will contact and the COM of the ball as it flies through the air, and when this distance equals the radius of the ball it will have contacted. however, this method rearranged to something crazy with I and stuff when i tried to find t. is based on the radius of the ball, radius of hole, and initial v by the way.
I tried various methods, and failed, to cut a long story short. I was wondering if anyone could think of a way to create a function for the impact co-ords in a 2 dimensional reference frame?
I ended up using an iterative method in MSexcel, calculating co-ords every small increment of time, and finding when co-ords are equal to rim of hole.
now, whether based on a funtion, or iteratively, moving this problem into 3 dimensions presents a problem, only if you change the angle the ball is putted in. i called this the impact parameter, which is the distance perpendicular to the direction the ball travels from the center of the hole to the center of the ball
the problem is to find the 3-dimensional location of the impact of the golf ball based in radius of ball, radius of hole, initial velocity, and impact parameter.
hopefully I've interested you enough to have a think about it :)

2. May 11, 2012

### A.T.

If you want to simulate it correctly, you have to include this:

http://www2.eng.cam.ac.uk/~hemh/movies.htm#ballincylinder

As for your imminent collision check problem. Simple geometry will tell you if a sphere intersects a cylinder, so you can solve this problem iteratively for any ball trajectory.

3. May 11, 2012

### Staff: Mentor

You can remove the size of the ball from your equations by making the cylinder smaller. That should help.
For every flight path, the ball is restricted to a two-dimensional plane, given by the z-axis and the initial horizontal direction of movement. Your cylinder, restricted to this plane, just has a constant value at the horizontal axis, which allows you to solve the two-dimensional problem again.
The time to the impact is just given by the horizontal distance, divided by the horizontal velocity. This neglects air resistance.

4. May 11, 2012

### Epidemius5

@mfb
are you meaning to say simulate the golf ball as a sphere? the problem is that although the balls flight is restricted to 2 dimensions, it could contact the hole outside of these 2 dimensions.
@A.T
wow.... i had not thought of that before... thats so COOL!
from both of you i'm getting the message that it wouldnt be possible to create a function to determine the contact point?

5. May 12, 2012

### haruspex

Quite so.
There's also a nasty complication as the ball clears the leading edge of the hole. In general it will be deflected towards the centre of the hole, and computing this will get into horrible complications with gyroscopic effects and moments of inertia.
To have some hope, let's ignore that, as we can if the line is not too far off the hole's centre.
Let B be the radius of the ball, R the radius of the hole, H the horizontal displacement from hole's centre to path of ball, V the velocity. Let X, Y and Z be the co-ordinates of the point on the ball that strikes the far edge of the hole, relative to the centre of the ball at the moment of impact. Let T be the time from leaving near edge to striking far edge. L = √(R$^{2}$-H$^{2}$)
We have:
X$^{2}$+Y$^{2}$+Z$^{2}$ = B$^{2}$
(X+H)$^{2}$ + (VT-L+Y)$^{2}$ = R$^{2}$
Z = gT$^{2}$/2 - B

(Quick check: X=Y=T=0, Z=-B is a solution.)

We have 4 unknowns, X, Y, Z, T, but only 3 equations. We can eliminate any two of X, Y, Z (X and Z say) to leave an equation for the third as a function of T. This will be a quartic.
Here's the clever bit. In principle we can factorise the quartic to obtain (Y-a)(Y-b)(Y-c)(Y-d) = 0, where a, b, c, d are functions of T, possibly imaginary. At the moment of impact, a real root appears. In fact, it will be a repeated root, e.g. a in:
(Y-a)(Y-a)(Y-c)(Y-d) = 0
Look at what happens if we differentiate the LHS wrt Y. It still has a factor Y-a, so the expression obtained by differentiating the quartic is also 0 at moment of impact. This will be a cubic. We can combine the quartic and cubic (i.e. take the remainder of the quartic modulo the cubic) to obtain a quadratic in Y, then repeat the process with the cubic and quadratic to obtain Y (still as a function of T). Finally eliminate Y to obtain T.
The details I leave as an exercise for the reader

6. May 12, 2012

### Staff: Mentor

You can simulate the ball in the cylinder as a point.

It is possible, and it can be done in an analytic way quite easily for your vertical cylinder if you know the initial parameters for the flight.

7. May 12, 2012

### haruspex

I don't see how. The method you described before does not work. It overlooks the fact that the point of the ball which strikes the far edge of the hole will not be in a vertical plane through the flight path of the centre of the ball. It will be offset from that, away from the hole's centre, by the X in my equations.

8. May 13, 2012

### Epidemius5

my current method to attack this problem is to analyse it from the reference frame across the top of the cylinder, i.e on the golf green. i can calculate the flight path, and then figure out the cross section of the sphere in the plane over the top of the cylinder, and figure out where it contacts the top of the cylinder. from this, i can find the COM of the sphere if it I know the flight path and the point of contact. however, I'm not the best at math, being 16, i havn't done calculus yet at my high school, which is why i fall back on iterative methods regularly. Do you guys think this method would be mathematically do-able?
so far:
radius of cross section at the top of cylinder:
sqrt(r^2-d^2)
where d=offset in center of ball from plane across the top of the cylinder
distance from center of cylinder to center of sphere in plane across top of cylinder:
sqrt(p^2+(v*t-sqrt(R^2-p^2)))
where p=distance perpendicular to balls path, from center of ball to center of cylinder
where v=initial velocity of ball
where t=time(for any point crossing the cylinder)
point where sphere contacts cylinder:
sqrt(r^2-(r-(g*t^2/2))^2)=R-sqrt(p^2+(v*t-sqrt(R^2-p^2)))
this is when the shortest distance from the edge of the cylinder to the balls vertical axis equals the first equation i mentioned.
does this all seem sound? also, how would i go about finding x, y co-ords from this eqn? i have tried solving for t, but to no avail.
any help would be much appreciated

9. May 13, 2012

### Staff: Mentor

The ball with radius r will hit the hole with radius R if its center has the distance R-r from the center. In addition, the surface is always perpendicular to the (center of ball)-(center of hole)-line. Therefore, you can model the system as a hole with radius R-r and a point-like ball.
This does not work for the initial movement over the edge - but as long as the ball speed is high, its deflection there is small and can be approximated in some way.

@Epidemius5: Add a sketch, please. It is always hard to talk about 3-dimensional systems with words and a lot of new variables hanging around in the formulas.

10. May 13, 2012

### Epidemius5

i would like to, but can't until i have 10 posts :(

11. May 13, 2012

### haruspex

You'll need to complete the model before I'll be convinced.
If you shrink the ball to a point, how high above the green do you have it on approach? Presumably zero. In that case it will never strike the opposite rim.

12. May 13, 2012

### Staff: Mentor

@haruspex: Ok, I see the issue. I assumed that the ball falls deep enough to hit the walls, not the rim. If it does not, things get a bit more complicated. Maybe possible in an analytic way, maybe not.

13. May 13, 2012

### haruspex

Do you see a problem with my analysis (#5)?

14. May 14, 2012

### Epidemius5

I have a few questions about it, is H perpendicular to the path of the ball? and is X the axis along which the ball travels?
X^2+Y^2+Z^2 = B^2
(X+H)^2 + (VT-L+Y)^2 = R^2
Z = gT2/2 - B
where does the first eqn originate from? the second one is the eqn of the ball, yes? but view in which cross section? and shouldnt the last eqn be +B instead of -B?

15. May 14, 2012

### haruspex

H, X are horizontal, perpendicular to line of travel. L, Y are in the line of travel.
X, Y and Z are co-ordinates of impact point of ball relative to ball's centre. First eqn expresses that.
Relative to hole centre, impact point has co-ordinates (X+H, VT-L+Y, 0), hence 2nd eqn.
The sign of Z doesn't matter - you can orient it either way up. But it's either as I had it or -gT^2/2+B.