#47936 - lewisrevill - Thu Jul 14, 2005 9:36 pm
Hey guys. Again really need your help. lets say i have a right angle triangle with height of 30 pixels (opposite) and length of 40 pixels (adjacent). How in c programming would i use "TAN" to get angle of theta? Do i need any libaries for this?
#47937 - poslundc - Thu Jul 14, 2005 10:19 pm
You need the inverse of tangent, which is arctangent, often abbreviated to atan in math libraries.
Because the situation you describe is encountered frequently, there's also a function called atan2 which takes both the y and x values as parameters, saving you the division step.
Try searching the forum for "atan", it produced a bunch of promising results when I tried it.
Dan.
#47939 - lewisrevill - Thu Jul 14, 2005 10:32 pm
Where can i get the maths.h libery from?
#47945 - tepples - Fri Jul 15, 2005 2:03 am
In general, you'd use a BIOS call to get an arctangent.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.