degtorad(angle)

Description

Converts an angle from degrees to radians.

Parameters

  • degrees: The angle in degrees to convert

Returns

Returns the angle converted to radians.

Examples

// Convert 180 degrees to radians
angle = degToRad(180)
// returns approximately 3.14159 (π)

// Convert 90 degrees to radians
angle = degToRad(90)
// returns approximately 1.5708 (π/2)

// Use with trigonometric functions
x = degToRad(45).sin * distance

Last updated

Was this helpful?