diff --git a/ChaosFramework.Math.SDK.csproj b/ChaosFramework.Math.SDK.csproj index d0b5740..ddcd1d6 100644 --- a/ChaosFramework.Math.SDK.csproj +++ b/ChaosFramework.Math.SDK.csproj @@ -4,6 +4,9 @@ SDK netstandard2.0 + netstandard2.0 + netstandard2.0 + netstandard2.0 @@ -16,6 +19,9 @@ + + + diff --git a/ChaosFramework.Math.VS.csproj b/ChaosFramework.Math.VS.csproj index 71cb99b..1b04ad6 100644 --- a/ChaosFramework.Math.VS.csproj +++ b/ChaosFramework.Math.VS.csproj @@ -8,6 +8,10 @@ VS net4.5 + net4.5 + net4.5 + net4.5 + net4.5 @@ -17,6 +21,7 @@ + @@ -24,6 +29,8 @@ + + diff --git a/generated/ChaosGenerators/ChaosGenerators.TemplateGenerator/ChaosFramework.Math.Clamping._Clamp.T.cs b/generated/ChaosGenerators/ChaosGenerators.TemplateGenerator/ChaosFramework.Math.Clamping._Clamp.T.cs new file mode 100644 index 0000000..b523925 --- /dev/null +++ b/generated/ChaosGenerators/ChaosGenerators.TemplateGenerator/ChaosFramework.Math.Clamping._Clamp.T.cs @@ -0,0 +1,84 @@ +// + +namespace ChaosFramework.Math +{ + public static partial class Clamping + { + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static sbyte Clamp(sbyte min, sbyte max, sbyte value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static byte Clamp(byte min, byte max, byte value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static short Clamp(short min, short max, short value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static ushort Clamp(ushort min, ushort max, ushort value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static int Clamp(int min, int max, int value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static uint Clamp(uint min, uint max, uint value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static long Clamp(long min, long max, long value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static ulong Clamp(ulong min, ulong max, ulong value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static float Clamp(float min, float max, float value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static double Clamp(double min, double max, double value) + => value < min ? min : value > max ? max : value; + + /// Clamps a value between a given minimum and maximum. + /// Will be returned if is less than . + /// Will be returned if is greater than . + /// The value to be clamped between and . + public static decimal Clamp(decimal min, decimal max, decimal value) + => value < min ? min : value > max ? max : value; + } +} diff --git a/source/_Math/Clamping/Clamp.cs b/source/_Math/Clamping/Clamp.cs index 35fd5b2..5729e8e 100644 --- a/source/_Math/Clamping/Clamp.cs +++ b/source/_Math/Clamping/Clamp.cs @@ -8,61 +8,15 @@ public static partial class Clamping /// Will be returned if is less than . /// Will be returned if is greater than . /// The value to be clamped between and . - public static byte Clamp(byte min, byte max, byte value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static short Clamp(short min, short max, short value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static ushort Clamp(ushort min, ushort max, ushort value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static int Clamp(int min, int max, int value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static uint Clamp(uint min, uint max, uint value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static long Clamp(long min, long max, long value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static ulong Clamp(ulong min, ulong max, ulong value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static float Clamp(float min, float max, float value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static double Clamp(double min, double max, double value) => value < min ? min : value > max ? max : value; - - /// Clamps a value between a given minimum and maximum. - /// Will be returned if is less than . - /// Will be returned if is greater than . - /// The value to be clamped between and . - public static decimal Clamp(decimal min, decimal max, decimal value) => value < min ? min : value > max ? max : value; + [ChaosGenerators.TemplateGenerator( + "=> value < min ? min : value > max ? max : value;", + typeof(sbyte), typeof(byte), + typeof(short), typeof(ushort), + typeof(int), typeof(uint), + typeof(long), typeof(ulong), + typeof(float), typeof(double), typeof(decimal) + )] + public delegate T _Clamp(T min, T max, T value); /// /// Clamps all components of the given between and . diff --git a/submodules/ChaosPresets.References b/submodules/ChaosPresets.References index bcdb018..a72018f 160000 --- a/submodules/ChaosPresets.References +++ b/submodules/ChaosPresets.References @@ -1 +1 @@ -Subproject commit bcdb018b603a2793ded2ffacca92a04328a3942f +Subproject commit a72018fc7aa5e632c81c860350031e2ce0bc3981