Browse Source

Math.defToRad, Math.radToDeg

trethaller 7 years ago
parent
commit
1830480ff6
1 changed files with 13 additions and 0 deletions
  1. 13 0
      hxd/Math.hx

+ 13 - 0
hxd/Math.hx

@@ -246,4 +246,17 @@ class Math {
 		return r >= 0 ? r : r + modulo;
 	}
 
+	/**
+	 * Convert degrees to radians
+	**/
+	public static inline function degToRad( deg : Float) {
+		return deg * PI / 180.0;
+	}
+
+	/**
+	 * Convert radians to degrees
+	 */
+	public static inline function radToDeg( rad : Float) {
+		return rad * 180.0 / PI;
+	}
 }