diff options
| author | chai <215380520@qq.com> | 2023-05-12 10:32:11 +0800 | 
|---|---|---|
| committer | chai <215380520@qq.com> | 2023-05-12 10:32:11 +0800 | 
| commit | 2fc9585797067730f28b03b0727bf05f9deed091 (patch) | |
| tree | 8807e37b85ba922045eaa17ac445dd0a1d2d730c /WorldlineKeepers/Assets/Scripts/Utils/MathUtils.cs | |
| parent | 2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 (diff) | |
+ worldline keepers
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Utils/MathUtils.cs')
| -rw-r--r-- | WorldlineKeepers/Assets/Scripts/Utils/MathUtils.cs | 25 | 
1 files changed, 25 insertions, 0 deletions
| diff --git a/WorldlineKeepers/Assets/Scripts/Utils/MathUtils.cs b/WorldlineKeepers/Assets/Scripts/Utils/MathUtils.cs new file mode 100644 index 0000000..c997495 --- /dev/null +++ b/WorldlineKeepers/Assets/Scripts/Utils/MathUtils.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public static class MathUtils +{ + +    public static Vector2 Abs(Vector2 v) +    { +        return new Vector2(Mathf.Abs(v.x), Mathf.Abs(v.y)); +    } + +    public static Vector2 Max(Vector2 src, float v) +    { +        return new Vector2(Mathf.Max(src.x, v), Mathf.Max(src.y, v)); +    } + +    public static void Swap(ref float f1, ref float f2) +    { +        float t = f1; +        f1 = f2; +        f2 = t; +    } + +}
\ No newline at end of file | 
