aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/math.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-core/src/math.rs')
-rw-r--r--azalea-core/src/math.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/azalea-core/src/math.rs b/azalea-core/src/math.rs
index 7c0ac7b4..62215749 100644
--- a/azalea-core/src/math.rs
+++ b/azalea-core/src/math.rs
@@ -68,6 +68,15 @@ pub fn fract(x: f64) -> f64 {
x - floor
}
+// these are copied from the java standard library, we don't calculate the
+// consts ourself to make sure it's the same as java
+pub fn to_radians(degrees: f64) -> f64 {
+ degrees * 0.017453292519943295
+}
+pub fn to_degrees(radians: f64) -> f64 {
+ radians * 57.29577951308232
+}
+
#[cfg(test)]
mod tests {
use super::*;