0

I've been going through the documentation but could not seem to find an answer.

How do I use mathematical functions like Rad() and Deg() to convert degrees to radians also the rad to deg?

rmaddy
  • 307,833
  • 40
  • 508
  • 550

2 Answers2

1

Defining your own functions is trivial, i.e.:

func degToRad(deg : Double) -> Double {
    return deg / 180 * M_PI
}

Or put it in an extension.

Eiko
  • 25,483
  • 15
  • 55
  • 70
0

As an extension to @Eiko's answer, if you're using OpenGL, this answer tells us about this GLKMathDegreesToRadians function. You can see documentation for this function here.

Community
  • 1
  • 1
SevenBits
  • 2,796
  • 1
  • 19
  • 31