From 00ca247d0f40534b373209f578ef2f617c5da88a Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 3 Jun 2021 19:12:33 -0400 Subject: [PATCH] Inverse trig logic functions --- core/assets/bundles/bundle.properties | 6 ++++++ core/src/mindustry/logic/LogicOp.java | 15 +++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 87ef5b2f5d..7533d4aa0a 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1636,9 +1636,15 @@ lenum.min = Minimum of two numbers. lenum.max = Maximum of two numbers. lenum.angle = Angle of vector in degrees. lenum.len = Length of vector. + lenum.sin = Sine, in degrees. lenum.cos = Cosine, in degrees. lenum.tan = Tangent, in degrees. + +lenum.asin = Arc sine, in degrees. +lenum.acos = Arc cosine, in degrees. +lenum.atan = Arc tangent, in degrees. + #not a typo, look up 'range notation' lenum.rand = Random decimal in range [0, value). lenum.log = Natural logarithm (ln). diff --git a/core/src/mindustry/logic/LogicOp.java b/core/src/mindustry/logic/LogicOp.java index f7021cc03e..2de33558b9 100644 --- a/core/src/mindustry/logic/LogicOp.java +++ b/core/src/mindustry/logic/LogicOp.java @@ -36,13 +36,20 @@ public enum LogicOp{ abs("abs", a -> Math.abs(a)), log("log", Math::log), log10("log10", Math::log10), - sin("sin", d -> Math.sin(d * 0.017453292519943295D)), - cos("cos", d -> Math.cos(d * 0.017453292519943295D)), - tan("tan", d -> Math.tan(d * 0.017453292519943295D)), floor("floor", Math::floor), ceil("ceil", Math::ceil), sqrt("sqrt", Math::sqrt), - rand("rand", d -> Mathf.rand.nextDouble() * d); + rand("rand", d -> Mathf.rand.nextDouble() * d), + + sin("sin", d -> Math.sin(d * Mathf.doubleDegRad)), + cos("cos", d -> Math.cos(d * Mathf.doubleDegRad)), + tan("tan", d -> Math.tan(d * Mathf.doubleDegRad)), + + asin("asin", d -> Math.asin(d) * Mathf.doubleRadDeg), + acos("acos", d -> Math.acos(d) * Mathf.doubleRadDeg), + atan("atan", d -> Math.atan(d) * Mathf.doubleRadDeg), + + ; public static final LogicOp[] all = values();