// - edit Vector.math-metric.tt to modify
#nullable enable
namespace Brutal.Numerics;
public partial struct byte2
{
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Length()
{
return (float)double.Sqrt((double)X * X + (double)Y * Y);
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly int LengthSquared()
{
return Dot(this, this);
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Distance(byte2 a, byte2 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));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int DistanceSquared(byte2 a, byte2 b)
{
return (a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y);
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Dot(byte2 a, byte2 b)
{
return a.X * b.X + a.Y * b.Y;
}
}