Added component-wise min and max (cmin and cmax)

This commit is contained in:
Simon Lübeß
2025-02-16 01:04:21 +01:00
parent bb52f4c068
commit 28121d1b42
+34
View File
@@ -364,6 +364,40 @@ static
} }
#endregion #endregion
#region cmin / cmax
public static float cmin(float2 v)
{
return Math.Min(v.X, v.Y);
}
public static float cmin(float3 v)
{
return Math.Min(v.X, Math.Min(v.Y, v.Z));
}
public static float cmin(float4 v)
{
return Math.Min(v.X, Math.Min(v.Y, v.Z));
}
public static float cmax(float2 v)
{
return Math.Max(v.X, v.Y);
}
public static float cmax(float3 v)
{
return Math.Max(v.X, Math.Max(v.Y, v.Z));
}
public static float cmax(float4 v)
{
return Math.Max(v.X, Math.Max(v.Y, v.Z));
}
#endregion
#region exp, pow, log #region exp, pow, log