Selaa lähdekoodia

Math.defToRad, Math.radToDeg

trethaller 7 vuotta sitten
vanhempi
commit
1830480ff6
1 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  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;
+	}
 }