# Rotating a pool ball

1. Dec 3, 2007

### dezo

Hi,
I'm trying to create a simple pool game. The ball is moving with speed vx along x axis and vy along y axis. This way I can easily compute the rotation in x and y direction. But how can I compute the rotation when the ball is not moving along any axis? I mean in angle 30 degrees, for example. Because rotating by angle about x axis followed by rotation by angle along y axis doesn't give the right result.

Thanks for any suggestions.

http://www.fi.muni.cz/~xkacer/other/ball.png

2. Dec 3, 2007

### Staff: Mentor

Hi Dezo,

Welcome to physics forums.

I am not sure that I understand your question. Are you trying to have the ball spin in a different direction than it rolls, e.g. putting some backspin on it so that it rolls back after striking the next ball? Or are you simply trying to convert from e.g. 2 m/s at 30º to a certain vx and vy?

3. Dec 4, 2007

### dezo

No, imagine that for example vx=15 nad vy=10 (whatever units). Now I can say, that in x direction it has rotated by 45 degrees and in y direction by 30 degrees. Now I want to paint the ball. If I rotate it by 45 degrees along the y axis and THEN by 30 degrees along x axis, the final rotation is not correct. So I need some equations that will combine these TWO rotations into ONE (with correct result).

4. Dec 4, 2007

### Mentz114

Why do you think someone will give you a method that doesn't work ?

Anyhow, you can always rotate your axes so that Vy = 0 in the new frame.

The angle is $$\theta = tan^{-1}(v_y/v_x)$$.

Now calculate the rotation of the ball, then rotate through -theta to get back to the table frame.

5. Dec 4, 2007

### Staff: Mentor

There may be some confusion in your setup. You are talking about a game of pool, right? In a game of pool you want to keep the ball on the table. If you rotate about the x or y axis you will wind up with the ball above or below the table. The only axis that you will ever rotate about is the z axis. The axis of rotation is always perpendicular to the plane of rotation.

6. Dec 4, 2007

### Mentz114

Hi Dalespam,
some confusion of rotations here. I think the OP is talking about the rotation of the ball around its own center. You refer to a rotation of the reference frame, which as you say is always around the z-axis as in my suggestion above.

7. Dec 5, 2007

### Bumbleflea

This sounds like a classic little app. Okay, I'm no expert, but I do have a few thoughts:

I'd say you'll want to have parameters not only for velocity [v(x),v(y)] but also spin [s(x),s(y),s(z)] Heck, you may even want v(z) in the case of the ball bouncing up or being hit with extremely low english. If you incorporate spin, you'll want to derive the amount of friction between the ball & the felt. (Perhaps you could test this with some real-life experimentation!) Add some 'collision' code, & you're most of the way home.

8. Dec 9, 2007

### dezo

Hi guys,
thanks for ideas.

@Mentz114:
I don't want to blame anyone for giving a method that doesn't work. I only wanted to say, that MY solution wasn't right.
Your method must work, definitely. But imagine the following situation: Let's have a dot on the ball. The "default" rotation of the ball is when the dot is up. Now the ball starts to roll and comes to the wall (-> collision). It hits the wall when the dot is down, so along its movement it made a rotation of 180 degrees. Now the ball rolls in different direction (after collision with wall). If I would compute the rotation with your method, I would get a wrong result, because the starting frame would be "a dot is down".

@DaleSpam:
Sorry, I exchanged the z and y axis.

9. Dec 9, 2007

### Mentz114

OK, I understand now what you meant.

You are trying to do a very difficult calculation here, and it can be simplified by rotating your frame, is all I said. I haven't prescribed any 'method'. You are working 3 dimensions because the dot on the ball can move up and down. I wish you well with it.

M

10. Dec 9, 2007

### pmbasa

when u said that it is moving along with the x and y axes, did u mean that it was in the top view? I dont understand when you said that it rotated in the y direction (did you meant that i rolled forward) and rotated in the y direction (rolled sideward?). If you are using two vectors (x, y), you can use this:
xfinal = x * cos(theta_y)
yfinal = y * cos(theta_x)
where theta_y is the rotation along the y-axis and theta_x is the rotation along the x-axis.

If this doesn't fix ur problem, you maybe suffering from gimbal lock. Gimbal lock happens when you rotate along one axis, then try to rotate along another. This results to wrong motion or no motion at all.

One way out of this is by using quaternions (this may be too advance). I can't post how you can do rotations using quaternions because the math is somehow complex since quaternions deal with complex numbers. But if you learn how to use quaternion rotation, it may become intuitive to use it rather than the usual axis-angle rotation method.