-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathSimplexMath.cs
More file actions
26 lines (23 loc) · 632 Bytes
/
Copy pathSimplexMath.cs
File metadata and controls
26 lines (23 loc) · 632 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Text;
namespace SimplexCore
{
public static class SimplexMath
{
public static float Lerp(float a, float b, float amt)
{
return a + (b - a) * amt;
}
public static float DegToRad(float angle)
{
return (float)(Math.PI * angle / 180.0);
}
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>
{
if (val.CompareTo(min) < 0) return min;
else if (val.CompareTo(max) > 0) return max;
else return val;
}
}
}