Simple math question about Sin, Cos, Tan

Started by
11 comments, last by LowRad 23 years, 9 months ago
Hi, That''s a pretty easy question. I have a triangle, i got the two lenght of the sides, but not the hypotenuse. I try to find the angle. Like this: The formula : tan (ang) = long1 / long2 The answer : ang = tan-1 (long1 / long2) It''s tan at power -1... So i can i code this Line in c/c++ ?! c dont have any tan-1 fnc. Thanks for your help ?! LowRad
Advertisement
What you''re looking for for is arctan(), that''s the inverse cosine function, as is arcsin, etc.



ByteMe95::~ByteMe95()
ByteMe95::~ByteMe95()My S(h)ite
I too had the same problem. But it''s easy to solve
use 1/tan(Same with Sin, Cos). It''s the same as tan-1
"To some its a six-pack, to me it's a support group."
I beg to differ:

cos(90 degrees) = 0
cos-1(0) = 90 degrees
1/cos(90 degrees) = divide by zero error



plus it''s not right non-general rule anyway. Where did you study maths? And don''t claim it works in radians because it doesn''t.
Mindwipe, that''s completely wrong, where did you come up with that???

Just use arccos()



ByteMe95::~ByteMe95()
ByteMe95::~ByteMe95()My S(h)ite
I think mindwipe read "tan()-1" as "tan() to the -1 power" which is 1/tan() of course
arctan(x) isn't the same as 1/tan(x). arctan(x) means: "the inverse function of tan", it's not the "inverse result of tan(x)".
To find the angle use:

theta = arctan(length_y/length_x);
Result in radians.

Do not invert the sides. length_y is the opposite side, and length_x is the adjacent side.

Edited by - blazter on July 21, 2000 5:43:38 PM
Anonymous Poster> Yup that was what I ment. I''ve actally used it. And it works. Well, I no master on math. Due to lack of knowledge.

Just wanted to try to help
"To some its a six-pack, to me it's a support group."
Umm, are we assuming this is a right triangle? Those trig identities only work for a right triangle, don''t they? I''ve almost got an AA in Math on accident ...
I don't know what is a right triangle in English. Do you mean that one of the angles must be 90 degrees ?
If so, yes it's right. These trig. functions only work on orthogonal coord. and on right triangles. By the way only a triangle with a angle of 90 degrees can have a hypotenuse.

Edited by - blazter on July 24, 2000 1:20:30 PM

This topic is closed to new replies.

Advertisement