mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
10 changed files with 784842 additions and 0 deletions
28
Brutal.Numerics/Vector/uint3/uint3.copy.gen.cs
Normal file
28
Brutal.Numerics/Vector/uint3/uint3.copy.gen.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// <auto-generated /> - edit Vector.copy.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly void CopyTo(Span<uint> destination)
|
||||
{
|
||||
if (destination.Length < ComponentCount)
|
||||
throw new ArgumentException("Length must be at least 3.", nameof(destination));
|
||||
|
||||
Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref MemoryMarshal.GetReference(destination)), this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly bool TryCopyTo(Span<uint> destination)
|
||||
{
|
||||
if (destination.Length < ComponentCount)
|
||||
return false;
|
||||
|
||||
Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref MemoryMarshal.GetReference(destination)), this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
41
Brutal.Numerics/Vector/uint3/uint3.equality.gen.cs
Normal file
41
Brutal.Numerics/Vector/uint3/uint3.equality.gen.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// <auto-generated /> - edit Vector.equality.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(X, Y, Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly bool Equals(uint3 other)
|
||||
{
|
||||
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly override bool Equals([NotNullWhen(true)] object? obj)
|
||||
{
|
||||
return obj is uint3 other && Equals(other);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(uint3 a, uint3 b)
|
||||
{
|
||||
return a.X == b.X && a.Y == b.Y && a.Z == b.Z;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(uint3 a, uint3 b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
}
|
||||
92
Brutal.Numerics/Vector/uint3/uint3.format.gen.cs
Normal file
92
Brutal.Numerics/Vector/uint3/uint3.format.gen.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// <auto-generated /> - edit Vector.format.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3 : ISpanFormattable, IUtf8SpanFormattable, ISpanParsable<uint3>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.ToString(string?)" />
|
||||
public readonly string ToString(string? format)
|
||||
{
|
||||
return ToString(format, CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
var separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
return $"<{X.ToString(format, formatProvider)}{separator} {Y.ToString(format, formatProvider)}{separator} {Z.ToString(format, formatProvider)}>";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
return StringHelpers.TryFormat<uint3, uint>(this, destination, out charsWritten, format, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public readonly bool TryFormat(Span<byte> destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
return StringHelpers.TryFormat<uint3, uint>(this, destination, out bytesWritten, format, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Parse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?)" />
|
||||
public static uint3 Parse(string s, IFormatProvider? provider)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(s);
|
||||
return Parse(s.AsSpan(), NumberStyles.Integer, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Parse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?)" />
|
||||
public static uint3 Parse(ReadOnlySpan<char> s, IFormatProvider? provider = null)
|
||||
{
|
||||
return Parse(s, NumberStyles.Integer, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Parse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?)" />
|
||||
public static uint3 Parse(string s, NumberStyles style, IFormatProvider? provider)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(s);
|
||||
return Parse(s.AsSpan(), style, provider);
|
||||
}
|
||||
|
||||
/// <summary>Parses from the <see cref="ToString()" /> format, <c><1, 2, 3></c>.</summary>
|
||||
/// <exception cref="FormatException">The input is not in a valid format, or a component fails to parse.</exception>
|
||||
public static uint3 Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider)
|
||||
{
|
||||
if (!TryParse(s, style, provider, out var result))
|
||||
throw new FormatException($"'{s}' is not in a valid uint3 format.");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="TryParse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?, out uint3)" />
|
||||
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out uint3 result)
|
||||
{
|
||||
return TryParse(s.AsSpan(), NumberStyles.Integer, provider, out result);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="TryParse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?, out uint3)" />
|
||||
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out uint3 result)
|
||||
{
|
||||
return TryParse(s, NumberStyles.Integer, provider, out result);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="TryParse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?, out uint3)" />
|
||||
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out uint3 result)
|
||||
{
|
||||
return TryParse(s.AsSpan(), style, provider, out result);
|
||||
}
|
||||
|
||||
/// <summary>Parses from the <see cref="ToString()" /> format, <c><1, 2, 3></c>.</summary>
|
||||
/// <returns>true if the input parsed as a uint3.</returns>
|
||||
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out uint3 result)
|
||||
{
|
||||
return StringHelpers.TryParse<uint3, uint>(s, style, provider, out result);
|
||||
}
|
||||
}
|
||||
123
Brutal.Numerics/Vector/uint3/uint3.gen.cs
Normal file
123
Brutal.Numerics/Vector/uint3/uint3.gen.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
// <auto-generated /> - edit Vector.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a 3D vector with uint components.
|
||||
/// </summary>
|
||||
[DebuggerTypeProxy(typeof(VectorDebugView3<uint3, uint, float>))]
|
||||
public partial struct uint3 : IVector3<uint3, uint>
|
||||
, IIntegerVector<uint3, uint, uint, float>
|
||||
, ICrossProduct<uint3>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public static int ComponentSize => sizeof(uint);
|
||||
|
||||
/// <summary>Gets the number of components.</summary>
|
||||
public static int ComponentCount => 3;
|
||||
|
||||
/// <inheritdoc cref="Vector3.X" />
|
||||
[XmlAttribute]
|
||||
public uint X;
|
||||
|
||||
/// <inheritdoc cref="Vector3.Y" />
|
||||
[XmlAttribute]
|
||||
public uint Y;
|
||||
|
||||
/// <inheritdoc cref="Vector3.Z" />
|
||||
[XmlAttribute]
|
||||
public uint Z;
|
||||
|
||||
uint IVector3<uint3, uint>.X { readonly get => X; set => X = value; }
|
||||
|
||||
uint IVector3<uint3, uint>.Y { readonly get => Y; set => Y = value; }
|
||||
|
||||
uint IVector3<uint3, uint>.Z { readonly get => Z; set => Z = value; }
|
||||
|
||||
/// <inheritdoc cref="Vector3(float, float, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint3(uint x, uint y, uint z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3(float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint3(uint xyz)
|
||||
: this(xyz, xyz, xyz) { }
|
||||
|
||||
/// <inheritdoc cref="Vector3(Vector2, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint3(uint2 xy, uint z)
|
||||
: this(xy.X, xy.Y, z) { }
|
||||
|
||||
/// <summary>Creates a vector from the leading 3 elements of a span.</summary>
|
||||
/// <param name="span">The elements to read; must contain at least 3, and any beyond that are ignored.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="span" /> holds fewer than 3 elements.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint3(ReadOnlySpan<uint> span)
|
||||
{
|
||||
if (span.Length < 3)
|
||||
throw new ArgumentOutOfRangeException(nameof(span), "Length must be at least 3.");
|
||||
|
||||
this = Unsafe.ReadUnaligned<uint3>(ref Unsafe.As<uint, byte>(ref MemoryMarshal.GetReference(span)));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="uint3(ReadOnlySpan{uint})" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static uint3 IComponentTuple<uint3, uint>.Create(ReadOnlySpan<uint> span) => new(span);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint3 UnitX => new(1, 0, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint3 UnitY => new(0, 1, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint3 UnitZ => new(0, 0, 1);
|
||||
|
||||
/// <inheritdoc />
|
||||
public uint this[int index]
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get
|
||||
{
|
||||
if ((uint)index >= ComponentCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
return Unsafe.Add(ref Unsafe.AsRef(in X), index);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
if ((uint)index >= ComponentCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
Unsafe.Add(ref X, index) = value;
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Deconstruct(out uint x, out uint y, out uint z)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
z = Z;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Span<uint> AsSpan()
|
||||
{
|
||||
return MemoryMarshal.CreateSpan(ref Unsafe.As<uint3, uint>(ref this), 3);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly ReadOnlySpan<uint> AsReadOnlySpan()
|
||||
{
|
||||
return MemoryMarshal.CreateReadOnlySpan(in Unsafe.As<uint3, uint>(ref Unsafe.AsRef(in this)), 3);
|
||||
}
|
||||
}
|
||||
43
Brutal.Numerics/Vector/uint3/uint3.math-metric.gen.cs
Normal file
43
Brutal.Numerics/Vector/uint3/uint3.math-metric.gen.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// <auto-generated /> - edit Vector.math-metric.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float Length()
|
||||
{
|
||||
return (float)double.Sqrt((double)X * X + (double)Y * Y + (double)Z * Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly uint LengthSquared()
|
||||
{
|
||||
return Dot(this, this);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Distance" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Distance(uint3 a, uint3 b)
|
||||
{
|
||||
return (float)double.Sqrt(((double)a.X - b.X) * ((double)a.X - b.X) + ((double)a.Y - b.Y) * ((double)a.Y - b.Y) + ((double)a.Z - b.Z) * ((double)a.Z - b.Z));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.DistanceSquared" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint DistanceSquared(uint3 a, uint3 b)
|
||||
{
|
||||
var difference = a - b;
|
||||
return Dot(difference, difference);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Dot" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint Dot(uint3 a, uint3 b)
|
||||
{
|
||||
return a.X * b.X + a.Y * b.Y + a.Z * b.Z;
|
||||
}
|
||||
}
|
||||
17
Brutal.Numerics/Vector/uint3/uint3.math.gen.cs
Normal file
17
Brutal.Numerics/Vector/uint3/uint3.math.gen.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// <auto-generated /> - edit Vector.math.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <inheritdoc cref="Vector3.Cross" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Cross(uint3 a, uint3 b)
|
||||
{
|
||||
return new(
|
||||
a.Y * b.Z - a.Z * b.Y,
|
||||
a.Z * b.X - a.X * b.Z,
|
||||
a.X * b.Y - a.Y * b.X);
|
||||
}
|
||||
}
|
||||
100
Brutal.Numerics/Vector/uint3/uint3.numerics-binary.gen.cs
Normal file
100
Brutal.Numerics/Vector/uint3/uint3.numerics-binary.gen.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// <auto-generated /> - edit Vector.numerics-binary.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
// IBinaryNumber
|
||||
public partial struct uint3 : IBinaryNumber<uint3>
|
||||
{
|
||||
/// <summary>Determines if every component of a value is a power of two.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool IBinaryNumber<uint3>.IsPow2(uint3 value)
|
||||
{
|
||||
return uint.IsPow2(value.X) && uint.IsPow2(value.Y) && uint.IsPow2(value.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryNumber{TSelf}.Log2" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Log2(uint3 value)
|
||||
{
|
||||
return new uint3(uint.Log2(value.X), uint.Log2(value.Y), uint.Log2(value.Z));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator &(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X & b.X, a.Y & b.Y, a.Z & b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator |(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X | b.X, a.Y | b.Y, a.Z | b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator ^(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X ^ b.X, a.Y ^ b.Y, a.Z ^ b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator ~(uint3 value)
|
||||
{
|
||||
return new(~value.X, ~value.Y, ~value.Z);
|
||||
}
|
||||
}
|
||||
|
||||
// the componentwise predicate mask (no interface to mirror) - the per-lane truth IsPow2 collapses
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <summary>Determines which components of a value are powers of two.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 IsPow2(uint3 value)
|
||||
{
|
||||
return new bool3(uint.IsPow2(value.X), uint.IsPow2(value.Y), uint.IsPow2(value.Z));
|
||||
}
|
||||
}
|
||||
|
||||
// the good bits from IBinaryInteger - declared on IIntegerVector
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.PopCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 PopCount(uint3 value)
|
||||
{
|
||||
return new uint3(uint.PopCount(value.X), uint.PopCount(value.Y), uint.PopCount(value.Z));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.LeadingZeroCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 LeadingZeroCount(uint3 value)
|
||||
{
|
||||
return new uint3(uint.LeadingZeroCount(value.X), uint.LeadingZeroCount(value.Y), uint.LeadingZeroCount(value.Z));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.TrailingZeroCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 TrailingZeroCount(uint3 value)
|
||||
{
|
||||
return new uint3(uint.TrailingZeroCount(value.X), uint.TrailingZeroCount(value.Y), uint.TrailingZeroCount(value.Z));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateLeft" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 RotateLeft(uint3 value, int rotateAmount)
|
||||
{
|
||||
return new uint3(uint.RotateLeft(value.X, rotateAmount), uint.RotateLeft(value.Y, rotateAmount), uint.RotateLeft(value.Z, rotateAmount));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateRight" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 RotateRight(uint3 value, int rotateAmount)
|
||||
{
|
||||
return new uint3(uint.RotateRight(value.X, rotateAmount), uint.RotateRight(value.Y, rotateAmount), uint.RotateRight(value.Z, rotateAmount));
|
||||
}
|
||||
}
|
||||
389
Brutal.Numerics/Vector/uint3/uint3.numerics.gen.cs
Normal file
389
Brutal.Numerics/Vector/uint3/uint3.numerics.gen.cs
Normal file
|
|
@ -0,0 +1,389 @@
|
|||
// <auto-generated /> - edit Vector.numerics.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
// INumberBase
|
||||
public partial struct uint3 : INumberBase<uint3>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public static uint3 Zero => new(0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint3 One => new(1);
|
||||
|
||||
static uint3 IAdditiveIdentity<uint3, uint3>.AdditiveIdentity => Zero;
|
||||
|
||||
static uint3 IMultiplicativeIdentity<uint3, uint3>.MultiplicativeIdentity => One;
|
||||
|
||||
static int INumberBase<uint3>.Radix => 2; // every component type is binary
|
||||
|
||||
static uint3 INumberBase<uint3>.Abs(uint3 value) => value;
|
||||
|
||||
static bool INumberBase<uint3>.IsCanonical(uint3 value) => true;
|
||||
|
||||
static bool INumberBase<uint3>.IsComplexNumber(uint3 value) => false;
|
||||
|
||||
static bool INumberBase<uint3>.IsImaginaryNumber(uint3 value) => false;
|
||||
|
||||
/// <summary>Determines if every component of a value is zero.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool INumberBase<uint3>.IsZero(uint3 value)
|
||||
{
|
||||
return value == Zero;
|
||||
}
|
||||
|
||||
/// <summary>Determines if every component of a value is an even integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool INumberBase<uint3>.IsEvenInteger(uint3 value)
|
||||
{
|
||||
return (value.X & 1) == 0 && (value.Y & 1) == 0 && (value.Z & 1) == 0;
|
||||
}
|
||||
|
||||
/// <summary>Determines if every component of a value is an odd integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool INumberBase<uint3>.IsOddInteger(uint3 value)
|
||||
{
|
||||
return (value.X & 1) == 1 && (value.Y & 1) == 1 && (value.Z & 1) == 1;
|
||||
}
|
||||
|
||||
static bool INumberBase<uint3>.IsNegative(uint3 value) => false;
|
||||
|
||||
static bool INumberBase<uint3>.IsPositive(uint3 value) => true;
|
||||
|
||||
static bool INumberBase<uint3>.IsFinite(uint3 value) => true;
|
||||
|
||||
static bool INumberBase<uint3>.IsInfinity(uint3 value) => false;
|
||||
|
||||
static bool INumberBase<uint3>.IsNegativeInfinity(uint3 value) => false;
|
||||
|
||||
static bool INumberBase<uint3>.IsPositiveInfinity(uint3 value) => false;
|
||||
|
||||
static bool INumberBase<uint3>.IsInteger(uint3 value) => true;
|
||||
|
||||
static bool INumberBase<uint3>.IsRealNumber(uint3 value) => true;
|
||||
|
||||
static bool INumberBase<uint3>.IsNaN(uint3 value) => false;
|
||||
|
||||
static bool INumberBase<uint3>.IsNormal(uint3 value) => value.X != 0 && value.Y != 0 && value.Z != 0;
|
||||
|
||||
static bool INumberBase<uint3>.IsSubnormal(uint3 value) => false;
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is greater.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 MaxMagnitude(uint3 a, uint3 b)
|
||||
{
|
||||
return Max(a, b);
|
||||
}
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is greater.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 MaxMagnitudeNumber(uint3 a, uint3 b)
|
||||
{
|
||||
return Max(a, b);
|
||||
}
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is smaller.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 MinMagnitude(uint3 a, uint3 b)
|
||||
{
|
||||
return Min(a, b);
|
||||
}
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is smaller.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 MinMagnitudeNumber(uint3 a, uint3 b)
|
||||
{
|
||||
return Min(a, b);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Add" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Add(uint3 a, uint3 b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Divide(Vector3, Vector3)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Divide(uint3 a, uint3 b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Multiply(Vector3, Vector3)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Multiply(uint3 a, uint3 b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Negate" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Negate(uint3 value)
|
||||
{
|
||||
return -value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Subtract" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Subtract(uint3 a, uint3 b)
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator +(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator -(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator *(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X * b.X, a.Y * b.Y, a.Z * b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator /(uint3 a, uint3 b)
|
||||
{
|
||||
return new(a.X / b.X, a.Y / b.Y, a.Z / b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator -(uint3 a)
|
||||
{
|
||||
return new(0 - a.X, 0 - a.Y, 0 - a.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator +(uint3 a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// ++/-- are well-defined (+/- One) but a footgun on a concrete vector: generic-plane only.
|
||||
|
||||
static uint3 IIncrementOperators<uint3>.operator ++(uint3 value) => value + One;
|
||||
|
||||
static uint3 IDecrementOperators<uint3>.operator --(uint3 value) => value - One;
|
||||
|
||||
|
||||
static bool INumberBase<uint3>.TryConvertFromChecked<TOther>(TOther value, out uint3 result)
|
||||
{
|
||||
return NumberConversion.TryConvertFrom<uint3, uint, TOther, NumberConversion.Checked>(value, out result);
|
||||
}
|
||||
|
||||
static bool INumberBase<uint3>.TryConvertToChecked<TOther>(uint3 value, [MaybeNullWhen(false)] out TOther result)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool INumberBase<uint3>.TryConvertFromSaturating<TOther>(TOther value, out uint3 result)
|
||||
{
|
||||
return NumberConversion.TryConvertFrom<uint3, uint, TOther, NumberConversion.Saturating>(value, out result);
|
||||
}
|
||||
|
||||
static bool INumberBase<uint3>.TryConvertToSaturating<TOther>(uint3 value, [MaybeNullWhen(false)] out TOther result)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool INumberBase<uint3>.TryConvertFromTruncating<TOther>(TOther value, out uint3 result)
|
||||
{
|
||||
return NumberConversion.TryConvertFrom<uint3, uint, TOther, NumberConversion.Truncating>(value, out result);
|
||||
}
|
||||
|
||||
static bool INumberBase<uint3>.TryConvertToTruncating<TOther>(uint3 value, [MaybeNullWhen(false)] out TOther result)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// IMultiplyOperators<TSelf, TComponent, TSelf>, IDivisionOperators<TSelf, TComponent, TSelf>
|
||||
public partial struct uint3
|
||||
: IMultiplyOperators<uint3, uint, uint3>
|
||||
, IDivisionOperators<uint3, uint, uint3>
|
||||
{
|
||||
/// <inheritdoc cref="Vector3.Divide(Vector3, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Divide(uint3 a, uint b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Multiply(Vector3, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Multiply(uint3 a, uint b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Multiply(float, Vector3)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Multiply(uint a, uint3 b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator *(uint3 a, uint b)
|
||||
{
|
||||
return new(a.X * b, a.Y * b, a.Z * b);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator /(uint3 a, uint b)
|
||||
{
|
||||
return new(a.X / b, a.Y / b, a.Z / b);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator *(uint a, uint3 b)
|
||||
{
|
||||
return new(a * b.X, a * b.Y, a * b.Z);
|
||||
}
|
||||
}
|
||||
|
||||
// INumber
|
||||
public partial struct uint3 : INumber<uint3>
|
||||
{
|
||||
/// <inheritdoc cref="Vector3.Clamp" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Clamp(uint3 value, uint3 min, uint3 max)
|
||||
{
|
||||
// HLSL contract when min > max: max wins (clamp is Max-then-Min); pinned in
|
||||
// Clamp_InvertedBounds_MatchesBcl. NOT scalar T.Clamp, which throws on inversion.
|
||||
return Min(Max(value, min), max);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Max" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Max(uint3 a, uint3 b)
|
||||
{
|
||||
return new(uint.Max(a.X, b.X), uint.Max(a.Y, b.Y), uint.Max(a.Z, b.Z));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Min" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 Min(uint3 a, uint3 b)
|
||||
{
|
||||
return new(uint.Min(a.X, b.X), uint.Min(a.Y, b.Y), uint.Min(a.Z, b.Z));
|
||||
}
|
||||
|
||||
static uint3 INumber<uint3>.MaxNumber(uint3 a, uint3 b) => Max(a, b);
|
||||
|
||||
static uint3 INumber<uint3>.MinNumber(uint3 a, uint3 b) => Min(a, b);
|
||||
|
||||
static uint3 INumber<uint3>.CopySign(uint3 value, uint3 sign) => value;
|
||||
|
||||
// the Native variants permit either NaN/signed-zero behavior - forwarding is always legal
|
||||
static uint3 INumber<uint3>.ClampNative(uint3 value, uint3 min, uint3 max) => Clamp(value, min, max);
|
||||
|
||||
static uint3 INumber<uint3>.MaxNative(uint3 a, uint3 b) => Max(a, b);
|
||||
|
||||
static uint3 INumber<uint3>.MinNative(uint3 a, uint3 b) => Min(a, b);
|
||||
|
||||
// Sign's int return cannot hold a per-lane answer, and a collapsed one would lie for mixed signs
|
||||
static int INumber<uint3>.Sign(uint3 value) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no scalar sign.");
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint3 operator %(uint3 a, uint3 b)
|
||||
{
|
||||
return new uint3(a.X % b.X, a.Y % b.Y, a.Z % b.Z);
|
||||
}
|
||||
|
||||
int IComparable.CompareTo(object? obj) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no total order.");
|
||||
|
||||
int IComparable<uint3>.CompareTo(uint3 other) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint3, uint3, bool>.operator <(uint3 a, uint3 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint3, uint3, bool>.operator <=(uint3 a, uint3 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint3, uint3, bool>.operator >(uint3 a, uint3 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint3, uint3, bool>.operator >=(uint3 a, uint3 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint3)} has no total order.");
|
||||
}
|
||||
|
||||
// IComponentwiseComparison + the componentwise predicate masks (no interface to mirror)
|
||||
public partial struct uint3 : IComponentwiseComparison<uint3, bool3>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 operator <(uint3 a, uint3 b)
|
||||
{
|
||||
return new bool3(a.X < b.X, a.Y < b.Y, a.Z < b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 operator <=(uint3 a, uint3 b)
|
||||
{
|
||||
return new bool3(a.X <= b.X, a.Y <= b.Y, a.Z <= b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 operator >(uint3 a, uint3 b)
|
||||
{
|
||||
return new bool3(a.X > b.X, a.Y > b.Y, a.Z > b.Z);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 operator >=(uint3 a, uint3 b)
|
||||
{
|
||||
return new bool3(a.X >= b.X, a.Y >= b.Y, a.Z >= b.Z);
|
||||
}
|
||||
|
||||
/// <summary>Determines which components of a value are zero.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 IsZero(uint3 value)
|
||||
{
|
||||
return new bool3(value.X == 0, value.Y == 0, value.Z == 0);
|
||||
}
|
||||
|
||||
/// <summary>Determines which components of a value are an even integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 IsEvenInteger(uint3 value)
|
||||
{
|
||||
return new bool3(uint.IsEvenInteger(value.X), uint.IsEvenInteger(value.Y), uint.IsEvenInteger(value.Z));
|
||||
}
|
||||
|
||||
/// <summary>Determines which components of a value are an odd integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool3 IsOddInteger(uint3 value)
|
||||
{
|
||||
return new bool3(uint.IsOddInteger(value.X), uint.IsOddInteger(value.Y), uint.IsOddInteger(value.Z));
|
||||
}
|
||||
}
|
||||
|
||||
// IUnsignedNumber - a marker, so there is nothing to implement
|
||||
public partial struct uint3 : IUnsignedNumber<uint3>;
|
||||
210
Brutal.Numerics/Vector/uint3/uint3.pack.gen.cs
Normal file
210
Brutal.Numerics/Vector/uint3/uint3.pack.gen.cs
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
// <auto-generated /> - edit Vector.pack.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
public static uint3 Unpack(in sbyte3 vector, Func<sbyte, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in byte3 vector, Func<byte, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in short3 vector, Func<short, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in ushort3 vector, Func<ushort, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in int3 vector, Func<int, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Pack(in float3 vector, Func<float, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Pack(in double3 vector, Func<double, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint3 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in sbyte3 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.SByte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in byte3 vector, Unpack.Integer mode = Numerics.Unpack.Integer.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.Byte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in short3 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.Short.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in ushort3 vector, Unpack.Integer mode = Numerics.Unpack.Integer.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.UShort.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint3 Unpack(in int3 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.Int.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint3 Pack(in float3 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
||||
{
|
||||
return Pack(vector, PackUtils.Float.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint3 Pack(in double3 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
||||
{
|
||||
return Pack(vector, PackUtils.Double.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<sbyte3> source,
|
||||
Span<uint3> destination,
|
||||
Func<sbyte, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<byte3> source,
|
||||
Span<uint3> destination,
|
||||
Func<byte, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<short3> source,
|
||||
Span<uint3> destination,
|
||||
Func<short, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<ushort3> source,
|
||||
Span<uint3> destination,
|
||||
Func<ushort, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<int3> source,
|
||||
Span<uint3> destination,
|
||||
Func<int, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<float3> source,
|
||||
Span<uint3> destination,
|
||||
Func<float, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<double3> source,
|
||||
Span<uint3> destination,
|
||||
Func<double, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<sbyte3> source,
|
||||
Span<uint3> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.SByte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<byte3> source,
|
||||
Span<uint3> destination,
|
||||
Unpack.Integer mode = Numerics.Unpack.Integer.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.Byte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<short3> source,
|
||||
Span<uint3> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.Short.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<ushort3> source,
|
||||
Span<uint3> destination,
|
||||
Unpack.Integer mode = Numerics.Unpack.Integer.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.UShort.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<int3> source,
|
||||
Span<uint3> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.Int.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<float3> source,
|
||||
Span<uint3> destination,
|
||||
Pack.Float mode = Numerics.Pack.Float.Truncate
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Float.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<double3> source,
|
||||
Span<uint3> destination,
|
||||
Pack.Float mode = Numerics.Pack.Float.Truncate
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Double.ToUInt(mode));
|
||||
}
|
||||
}
|
||||
400
Brutal.Numerics/Vector/uint3/uint3.swizzle.gen.cs
Normal file
400
Brutal.Numerics/Vector/uint3/uint3.swizzle.gen.cs
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
// <auto-generated /> - edit Vector.swizzle.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the X and Y components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 XY
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(X, Y);
|
||||
set
|
||||
{
|
||||
X = value.X;
|
||||
Y = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the X and Z components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 XZ
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(X, Z);
|
||||
set
|
||||
{
|
||||
X = value.X;
|
||||
Z = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Y and X components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 YX
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Y, X);
|
||||
set
|
||||
{
|
||||
Y = value.X;
|
||||
X = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Y and Z components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 YZ
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Y, Z);
|
||||
set
|
||||
{
|
||||
Y = value.X;
|
||||
Z = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Z and X components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 ZX
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Z, X);
|
||||
set
|
||||
{
|
||||
Z = value.X;
|
||||
X = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Z and Y components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 ZY
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Z, Y);
|
||||
set
|
||||
{
|
||||
Z = value.X;
|
||||
Y = value.Y;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the X, Y and Z components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 XYZ
|
||||
{
|
||||
readonly get => this;
|
||||
set => this = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the X, Z and Y components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 XZY
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(X, Z, Y);
|
||||
set
|
||||
{
|
||||
X = value.X;
|
||||
Z = value.Y;
|
||||
Y = value.Z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Y, X and Z components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 YXZ
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Y, X, Z);
|
||||
set
|
||||
{
|
||||
Y = value.X;
|
||||
X = value.Y;
|
||||
Z = value.Z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Y, Z and X components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 YZX
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Y, Z, X);
|
||||
set
|
||||
{
|
||||
Y = value.X;
|
||||
Z = value.Y;
|
||||
X = value.Z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Z, X and Y components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 ZXY
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Z, X, Y);
|
||||
set
|
||||
{
|
||||
Z = value.X;
|
||||
X = value.Y;
|
||||
Y = value.Z;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Z, Y and X components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 ZYX
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Z, Y, X);
|
||||
set
|
||||
{
|
||||
Z = value.X;
|
||||
Y = value.Y;
|
||||
X = value.Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial struct uint3
|
||||
{
|
||||
/// <summary>
|
||||
/// The Red component of the vector (synonym for X).
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint R
|
||||
{
|
||||
readonly get => X;
|
||||
set => X = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Green component of the vector (synonym for Y).
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint G
|
||||
{
|
||||
readonly get => Y;
|
||||
set => Y = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Blue component of the vector (synonym for Z).
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint B
|
||||
{
|
||||
readonly get => Z;
|
||||
set => Z = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Red and Green components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 RG
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(R, G);
|
||||
set
|
||||
{
|
||||
R = value.R;
|
||||
G = value.G;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Red and Blue components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 RB
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(R, B);
|
||||
set
|
||||
{
|
||||
R = value.R;
|
||||
B = value.G;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Green and Red components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 GR
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(G, R);
|
||||
set
|
||||
{
|
||||
G = value.R;
|
||||
R = value.G;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Green and Blue components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 GB
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(G, B);
|
||||
set
|
||||
{
|
||||
G = value.R;
|
||||
B = value.G;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Blue and Red components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 BR
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(B, R);
|
||||
set
|
||||
{
|
||||
B = value.R;
|
||||
R = value.G;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Blue and Green components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint2 BG
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(B, G);
|
||||
set
|
||||
{
|
||||
B = value.R;
|
||||
G = value.G;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Red, Green, and Blue components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 RGB
|
||||
{
|
||||
readonly get => this;
|
||||
set => this = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Red, Blue, and Green components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 RBG
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(X, Z, Y);
|
||||
set
|
||||
{
|
||||
R = value.R;
|
||||
B = value.G;
|
||||
G = value.B;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Green, Red, and Blue components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 GRB
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Y, X, Z);
|
||||
set
|
||||
{
|
||||
G = value.R;
|
||||
R = value.G;
|
||||
B = value.B;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Green, Blue, and Red components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 GBR
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Y, Z, X);
|
||||
set
|
||||
{
|
||||
G = value.R;
|
||||
B = value.G;
|
||||
R = value.B;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Blue, Red, and Green components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 BRG
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Z, X, Y);
|
||||
set
|
||||
{
|
||||
B = value.R;
|
||||
R = value.G;
|
||||
G = value.B;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swizzle readonly getter/setter for the Blue, Green, and Red components of the vector.
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public uint3 BGR
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => new(Z, Y, X);
|
||||
set
|
||||
{
|
||||
B = value.R;
|
||||
G = value.G;
|
||||
R = value.B;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue