- Home /
tangents from angle gives weird results
Hi there. I want to print values like that:
http://www.grc.nasa.gov/WWW/k-12/airplane/tabltan.html Those are angles from tan. form 0 to infinity.
I know that using Mathf.Tan gives me values in radians and i have to feed in angles. But values are wierd. I tried converting to degrees but they still are wrong. Does anybody know how to get values form the link?
using code:
var rad : float = Mathf.Tan(2);
var deg : float = rad * Mathf.Rad2Deg;
Debug.Log(rad + " radians are equal to " + deg + " degrees.");
Answer by Owen-Reynolds · May 17, 2012 at 03:22 PM
Tangent doesn't give you an angle, it takes an angle and tells you the standard highschool slope. In other words, the table you're looking at runs from 0 to 90 degrees; so, run tangent from 0 to 1.57 radians (1.57 = PI/2 ~ 90 degrees.)
for(int degs = 0; deg<=90; degs++) {
float rads = degs * Mathf.Deg2Rad; // this is just "/360*(2PI)"
...Tan(rads)...
}
right, too many hours of frustration turned off my brain... Thanks!
Your answer
Follow this Question
Related Questions
Trigonometry help? 1 Answer
Convert Mathf.Sin() radians to degrees 2 Answers
Mathf.Sin() & Mathf.Cos() 1 Answer