Wednesday, April 04, 2012

How to convert Radians to Degrees and Degrees to Radians in Objective c

Radians to Degrees
#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI))
 
...
 
NSLog(@"Output radians as degrees: %f", RADIANS_TO_DEGREES(0.584));
 
 
Degrees to Radians
#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
 
...
 
NSLog(@"Output degrees as radians: %f", DEGREES_TO_RADIANS(60));
 
 
 

No comments:

Create a list in SwiftUI with sticky section headers

 Sample Code import SwiftUI struct ContentView : View {     @State var isCustomViewControllerDisplayed = false     @State private va...