Degrees to Radians

Please support our C# advertiser: Intel Parallel Studio Home
vckicks vckicks is offline Offline Jun 16th, 2008, 2:59 am |
0
The .Net Framework uses by default radians in its trigonometry calculations. Find out how to convert degrees to radians to use with C#
Quick reply to this message  
C# Syntax
  1. private double DegreeToRadian(double angle)
  2. {
  3. return Math.PI * angle / 180.0;
  4. }
  5.  
  6. //Get the Cosine of a 45 degree angle
  7. double angle = Math.Cos(DegreeToRadian(45));
0
ddanbe ddanbe is offline Offline | Nov 21st, 2008
What about 45°30'10''?
Angles don't always come in whole parts.
 
0
vckicks vckicks is offline Offline | Nov 22nd, 2008
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.
 
 

Tags
degrees, math, radians

Message:


Similar Threads
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC