Snooker Physics Problem

I have the cue ball on my snooker table. The Cue tip rests at the cue ball, and the user swings the cue round wth the mouse. Now, the velocity exerted on the cue ball by the cue is directly through the centre of the cueball, given an angle theta that the cue is around the ball in the XZ plane, how do i represent the velocity vector? This is my current calculation, and through a process of guesstimation, ive tried different COS/SIN combinations and still dont get anything sensible.

cueball.set_velocity_x(sin(cue.angle*DEG2RAD));
cueball.set_velocity_z(cos(cue.angle*DEG2RAD));
LVL 1
Stephen ChamberlainSenior Software Engineer/System DesignerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
How do you get cue.angle?
0
Stephen ChamberlainSenior Software Engineer/System DesignerAuthor Commented:
cue.angle is obtained from the mouse. As the user moves left or right, the cue swings around the cue ball. It is also clamped between 0 and 360 degrees.
0
Stephen ChamberlainSenior Software Engineer/System DesignerAuthor Commented:
If you would like a visual idea of what I mean, please visit my site, then under the uni-work section from the menu bar, select the snooker simulation and there is a screenshot.

http://www.steve-chamberlain.co.uk/

0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

NeilNeilOrangePeelCommented:
I think u want to use x = cos(theta) - sin(theta), y = sin(theta) + cos(theta)
0
Stephen ChamberlainSenior Software Engineer/System DesignerAuthor Commented:
I have tried that but the result does not seem to be correct. I am also (for the time being) discounting the Y-axis as a simplification to my system (i.e. the balls are confined to the XZ plane and you cannot do a 'jump' trick shot). Thanks for the input though.
0
NeilNeilOrangePeelCommented:
sorry If the snooker table is in the x-z plane I meant:
x = cos(theta) - sin(theta), z = sin(theta) + cos(theta)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ozoCommented:
what did you get when you tried
cueball.set_velocity_x(sin(cue.angle*DEG2RAD));
cueball.set_velocity_z(cos(cue.angle*DEG2RAD));
?
what did you use for cue.angle and DEG2RAD?
0
HermeticCommented:
This is going to sound like a bunch of silly questions, but based on your description, I can't think of anything else to add. (sounds like it should work)

What level of detail are the cueball velocity and cue angle numbers stored in? (float or double)

Are you sure that you have stored the cue angle in degrees?

Are you sure that the sign is correct for your velocity equations?

Are you sure you have the correct conversion for cue angle in DEG2RAD?

What do you mean by sensible? (completely wrong or a little off)
0
Stephen ChamberlainSenior Software Engineer/System DesignerAuthor Commented:
The velocity and angle are stored as floats.

The angles is stored in degrees, and the conversion to radians is correct.

I am now sure that :

x = cos(theta) - sin(theta)
z = sin(theta) + cos(theta)

is the correct answer and will accept this as the answer, it provides 'correct' results, i.e the ball moves at the same speed in any direction, as opposed to when it was moving very fast in one direction then just slipping in another direction. However I still have some problems, but i can sort those out in due course.

0
frooblyCommented:
Sorry to dig up a dead topic, but the accepted solution sounds completely wrong.  I think that the problem is that you're not multiplying cos(theta) or sin(theta) by the speed of the cue.

The equation should be Vx = speed*cos(theta); Vy = speed*sin(theta);

If this doesn't work, then it means that you're giving this function incorrect values for speed and theta.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.