Jump to content
  • Advertisement
Sign in to follow this  
Mr_Ridd

Degrees to Radian

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Mr_Ridd
How do I convert degress to radians and vica versa.


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

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!