Original Post
Hi, I have what seems to be a simple trig problem, but for some reason it doesn''t quite work how it seems it should.
Here is a diagram of what my problem looks like (hope this works)
A------B
\ |
\ |
\ |
\ |
\ |
\|
C
In the case of my program, A is the camera, C is the point in space I''m wanting to look at, and the angle at A represents the pitch of the camera, which is what I''m trying to find. I know distances AB, AC, and BC. So, to find angle A I would think I just need to do the inverse cosine function of AB/AC, right? When done on a calculator, this works fine and get the right answer, but in my program it''s different. I know it''s calculating AB and AC correctly, and the only other thing I do is acos(AB/AC). For some reason though, it comes out as 0 every time. As far as I know, acos is the inverse cosine function, or is it something else? I''m either doing something stupidly wrong, or there is different math involved when dealing with 3d stuff, but it seems it shouldn''t matter.
Any help is appreciated.