extend clamp caps as needed
This commit is contained in:
parent
6c3b1a2ae0
commit
41ae92a37e
1 changed files with 4 additions and 4 deletions
|
@ -20,10 +20,10 @@ public static class Maths
|
|||
public static float max(float a, float b) => Math.Max(a, b);
|
||||
public static double max(double a, double b) => Math.Max(a, b);
|
||||
|
||||
public static float u_clamp(float x) => min(1.0f, max(0.0f, x));
|
||||
public static double u_clamp(double x) => min(1.0, max(0.0, x));
|
||||
public static float s_clamp(float x) => min(1.0f, max(-1.0f, x));
|
||||
public static double s_clamp(double x) => min(1.0, max(-1.0, x));
|
||||
public static float u_clamp(float x, float cap = 1.0f) => min(cap, max(0.0f, x));
|
||||
public static double u_clamp(double x, double cap = 1.0) => min(cap, max(0.0, x));
|
||||
public static float s_clamp(float x, float cap = 1.0f) => min(cap, max(-cap, x));
|
||||
public static double s_clamp(double x, double cap = 1.0) => min(cap, max(-cap, x));
|
||||
|
||||
public static int abs(int x) => Math.Abs(x);
|
||||
public static float abs(float x) => Math.Abs(x);
|
||||
|
|
Loading…
Add table
Reference in a new issue