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
  • 314,917
  • 42
  • 532
  • 579

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,601
  • 15
  • 56
  • 71
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,836
  • 1
  • 20
  • 33