summaryrefslogtreecommitdiff
path: root/modules/mono/glue/Managed/Files/MathfEx.cs
diff options
context:
space:
mode:
authorChaosus <chaosus89@gmail.com>2019-03-07 20:23:52 +0300
committerChaosus <chaosus89@gmail.com>2019-03-07 22:57:12 +0300
commit752055ccbaf0387af3925afb2765ef76677daf3b (patch)
tree6adf3b52d9bdf2af0adaf09cfe595da0c1a40812 /modules/mono/glue/Managed/Files/MathfEx.cs
parent9af7fa193f65f2caf206b079397fa810d012d803 (diff)
Fix division by zero at wrap functions in mono
Diffstat (limited to 'modules/mono/glue/Managed/Files/MathfEx.cs')
-rw-r--r--modules/mono/glue/Managed/Files/MathfEx.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/mono/glue/Managed/Files/MathfEx.cs b/modules/mono/glue/Managed/Files/MathfEx.cs
index 2ef02cc288..414762f7b1 100644
--- a/modules/mono/glue/Managed/Files/MathfEx.cs
+++ b/modules/mono/glue/Managed/Files/MathfEx.cs
@@ -35,5 +35,10 @@ namespace Godot
{
return (int)Math.Round(s);
}
+
+ public static bool IsEqualApprox(real_t a, real_t b, real_t ratio = Mathf.Epsilon)
+ {
+ return Abs(a - b) < ratio;
+ }
}
} \ No newline at end of file