954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Degrees to Radians

0
By vckicks on Jun 16th, 2008 11:59 am

The .Net Framework uses by default radians in its trigonometry calculations. Find out how to convert degrees to radians to use with C#

private double DegreeToRadian(double angle)
{
return Math.PI * angle / 180.0;
}

//Get the Cosine of a 45 degree angle
double angle = Math.Cos(DegreeToRadian(45));

What about 45°30'10''?
Angles don't always come in whole parts.

ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
 

If the angle isn't whole use a decimal point (45.352343). If you want to convert something like 45°30'10'' to a decimal representation then that would be a different function to write.

vckicks
Junior Poster in Training
58 posts since Jun 2008
Reputation Points: 11
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: