• What is your GameDev Story?

This topic is 4961 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey How do I convert degress to radians and vica versa. I searched google but could find anything that worked. I tested it against this, http://www.hal-pc.org/~johnnie2/tutors/degToRadian.html Thanks

Share on other sites
Little bit of help. (it has a script. Find the script, and it will tell you what you need to do).

<html><head><title>MICROGOODIES - Javascript Degree to Radian Converter</title><script language="Javascript">function convert() {	var radian = (document.makeRadian.degree.value / 180) * 3.142;	radian = radian.toString();	radian = radian.substring(0, radian.indexOf(".") + 4);	if (radian > 1) {		radian += " radians";	}	else {		radian += " radian";	}	document.makeRadian.radian.value = radian;}</script></head><body onLoad="document.makeRadian.degree.focus()"><h2>Degree to Radian Converter</h2><form name="makeRadian"><table><tr><td>Enter your degree measure:<p>The radian measure is:</td><td><input type="text" name="degree" size="25" onkeyup="convert()" onkeydown="convert()"><p><input type="text" name="radian" size="25"></td></tr></table></form><p align="center">Copyright &copy; 2000 <a href="mailto:johnnie2@hal-pc.org">Johnnie Rose, Jr.</a></p></body></html>

? (hint: Look at the script tags)

From,
Nice coder

Share on other sites
I use these two macros:

#define DegToRad(x) (x * (D3DX_PI / 180.0f))#define RadToDeg(x) (x * (D3DX_PI * 180.0f))

Just replace D3DX_PI with your favourite version of Pi

Share on other sites
Quote:
 Original post by Mr_RiddHow do I convert degress to radians and vica versa.

You don't really have to search google in order to do that.

x degrees = ? radians ==> (PI * x) / 180.0 radians
? degrees = y radians ==> (180 * y) / PI degrees

Share on other sites
Thanks a lot. It works now.

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• Forum Statistics

• Total Topics
634047
• Total Posts
3015232
×