Advertisement

math

Started by April 25, 2001 05:07 PM
1 comment, last by wingman20 23 years, 9 months ago
What is the formula for a point on a sphere? i know there are two formuli (or is it formulas) for a circle: x=r*sin(a)+x1 y=r*con(a)+y1 (i think) but is there a simalar formula for a sphere? I am using this for positoining the camera and target in my game (the target should allways be on the surface of an immaginary sphere arround the camera) Is this meathod the best or is there another meathod that is faster? thanks
Well if you''re using coordinates and angles, you''re going to need 2 angles in order to represent 3 dimensions. a is the angle in the x/y plane, you need an angle in the x/z or y/z plane.

Of course, I am almost certain that there is a better way to do it using vector maths, but I don''t know it

This much is true though, if you want to check if your point lies on the surface of that sphere:

(x1 - x)² + (y1 - y)² + (z1 - z)² = r²

Harry.
Harry.
Advertisement
may be this helps

x = p*cos(a)*sin(b)
y = p*sin(a)*sin(b)
z = p*cos(b)

This topic is closed to new replies.

Advertisement