sphere vectors 2D to 3D

Started by
1 comment, last by noobnerd 11 years, 3 months ago

hi everyone and thanks for helping me with the questions ive asked so far.

I have encountered yet another problem in my billiards (pool) game, when trying to do a kind of selector which allows you to select where on the ball you want to hit.

I want to have a circle which symbolizes the side of the cue ball facing you. you can then click anywhere on the surface of the circle to select the spot you want to hit. now to calculate the change in agular velocity i need the vector (3D) that goes from the center of the ball to the point which i just selected. That is a radius to the surface of the ball. considering that the ball is "pointing" in the direction that you are going to shoot it means that if you select the precise center of the ball you are going to get the vector -F/|F| r that is the vector in the vector in the opposite direction of the shot that has length r which is the radius.

can anyone help me with this? if my formluation was confusing i will try to draw it somehow.

cheers

Advertisement

I assume you are presenting the ball as a circle by orthogonal projection, you can look at the situation in coordinates where the projection is simply removing one coordinate. So you'll plot (x,y) and ignore z for this view. You can recover z by solving x^2+y^2+z^2=r^2 : z = sqrt(r^2-x^2-y^2), or perhaps minus that, depending on your conventions.

thank you for they quick answer it worked perfectly.

This topic is closed to new replies.

Advertisement