API Reference › Math › Math.deg_to_rad
method

Math.deg_to_rad

Math.deg_to_rad(degrees) -> fixed

Converts an angle from degrees to radians (multiplying by pi/180), since Math.sin/Math.cos/Math.tan all take radians. Use it when your data or design speaks in degrees — a 90-degree turn, a 45-degree cone — and you need to feed it to the trig functions.

Example

program Demo {
  handler Step phase Update {
    let r = Math.sin(Math.deg_to_rad(90.0))   # ~1.0
  }
}
← All symbols