I'm sorry...I am a math newb who needs angle help
Uhm well the title says it. What I am trying to do, is to find the angles for one point to another in 3d. Like say I have hypothetically a camera at 1,0,0 and I want to know the xy angle, and the xz angle to a point 2,3,5. How would I do that? Actually I''m pretty sure I can figure out the angle for xy, but I don''t know the angle for yz. Can someone be really nice and explain it? =D
-=Lohrno
look up cross product and dot product with vectors. those two things will solve many problems, including yours....
Contrary to what our friend camcbri (who was kind enough not to answer your question or explain anything he said) the dot and cross products aren''t necessary for what you require. If I''m understanding what you want, you''re looking for two angles from one point such that you could look at another point (similar to spherical coordinates). In order to do this, you can simply just use an arctan function with the two variables for which you want that angle for. That last sentence was a wreck, so let me try to clarify.
To find the ''xy-angle'', that is, the angle that lies strictly in the xy-plane, all you need to do is find arctan(delta y/delta x)or arctan(delta x/delta y) depending on whether you''d like the angle to originate in the x- or y-direction, respectively. To find the angles that lie in the xz- or yz-plane, just find the arctangent using those variables (ie. arctan(delta y/delta z) for yz-plane).
It''s easier to visualize this if you can graph two points in 3-space, with a bounding box for them, if you can. It all turns out to be simple trigonometry with triangles.
I hope this was helpful, if I even touched on your question...
Elijah
To find the ''xy-angle'', that is, the angle that lies strictly in the xy-plane, all you need to do is find arctan(delta y/delta x)or arctan(delta x/delta y) depending on whether you''d like the angle to originate in the x- or y-direction, respectively. To find the angles that lie in the xz- or yz-plane, just find the arctangent using those variables (ie. arctan(delta y/delta z) for yz-plane).
It''s easier to visualize this if you can graph two points in 3-space, with a bounding box for them, if you can. It all turns out to be simple trigonometry with triangles.
I hope this was helpful, if I even touched on your question...
Elijah
--"The greatest pleasure in life is in doing what people say you cannot do." -- Walter Bageholt
Don''t ever start a question with sorry... There''s no need to be sorry... It''s a perfectly legitimate question, and so is it to be a n00b...
You know what they say... "We were all newbs onces"... Or maybe that''s with babies?
Nevermind, now I should write something meaningful to avoid making a useless post =)
If you still have a little hard time understanding what your doing, first break it down to 2D... You want the angle x/y/z (and not a two angled solution like angle xz and angle y), therefore you can do this.
Grab some paper and a pen, draw a line on the paper and name it benny the vector(* optional). Now it can be helpful to draw out the two axes of course perpendicular to eachother and name them x and y. That means the roation you''re looking at, is the rotation around the z-axis. Now from benny you draw lines parallel to the axes to form a triangle.
As you can see you will have the two sides and one hypotenuse (the vector itself)... Now it''s easy to see that
(this is of course depended on where you have chosen angle v to be)
tan v = sidex / sidey
v is therefore atan(sidex/sidey)
I don''t feel I''ve said anything new, but it''s always good to have different spins on stuff...
did I forget to mention that benny is the camera minus the point? (in each axis seperatly)...
/G
You know what they say... "We were all newbs onces"... Or maybe that''s with babies?
Nevermind, now I should write something meaningful to avoid making a useless post =)
If you still have a little hard time understanding what your doing, first break it down to 2D... You want the angle x/y/z (and not a two angled solution like angle xz and angle y), therefore you can do this.
Grab some paper and a pen, draw a line on the paper and name it benny the vector(* optional). Now it can be helpful to draw out the two axes of course perpendicular to eachother and name them x and y. That means the roation you''re looking at, is the rotation around the z-axis. Now from benny you draw lines parallel to the axes to form a triangle.
As you can see you will have the two sides and one hypotenuse (the vector itself)... Now it''s easy to see that
(this is of course depended on where you have chosen angle v to be)
tan v = sidex / sidey
v is therefore atan(sidex/sidey)
I don''t feel I''ve said anything new, but it''s always good to have different spins on stuff...
did I forget to mention that benny is the camera minus the point? (in each axis seperatly)...
/G
---GUI Programming Division Manager at Wildfire Gamesworking on the 0 A.D. project
Thanks for your reply Gee. I agree completely that its good to have different spins on stuff, and also that nobody should be sorry to ask a legitimate question here, even if it seems simplistic or basic.
The only thing I ask is that people try to show us that they have done some work on their own before asking the question. I want to understand their thought process before I spend my scarce and valuable time to answer a question. I''m thrilled to have many forum participants such as yourself who make my job as moderator an easier job!
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
The only thing I ask is that people try to show us that they have done some work on their own before asking the question. I want to understand their thought process before I spend my scarce and valuable time to answer a question. I''m thrilled to have many forum participants such as yourself who make my job as moderator an easier job!
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement