mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
515 lines
19 KiB
C#
515 lines
19 KiB
C#
// <auto-generated /> - edit Quat.numerics.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
// INumberBase
|
|
public partial struct doubleQuat : INumberBase<doubleQuat>
|
|
{
|
|
/// <inheritdoc cref="Quaternion.Zero" />
|
|
public static doubleQuat Zero => default;
|
|
|
|
/// <inheritdoc cref="Quaternion.Identity" />
|
|
public static doubleQuat Identity => new(0, 0, 0, 1);
|
|
|
|
/* One is the multiplicative identity - the identity quaternion - which the concrete API
|
|
* already names Identity; a public One would read as all-ones. */
|
|
static doubleQuat INumberBase<doubleQuat>.One => Identity;
|
|
|
|
static doubleQuat IAdditiveIdentity<doubleQuat, doubleQuat>.AdditiveIdentity => Zero;
|
|
|
|
static doubleQuat IMultiplicativeIdentity<doubleQuat, doubleQuat>.MultiplicativeIdentity => Identity;
|
|
|
|
static int INumberBase<doubleQuat>.Radix => 2;
|
|
|
|
// Abs is the norm, embedded on the real axis as a scalar quaternion (cf. Complex.Abs)
|
|
static doubleQuat INumberBase<doubleQuat>.Abs(doubleQuat value) => new(0, 0, 0, value.Length());
|
|
|
|
static bool INumberBase<doubleQuat>.IsCanonical(doubleQuat value) => true;
|
|
|
|
static bool INumberBase<doubleQuat>.IsComplexNumber(doubleQuat value) =>
|
|
value.W != 0 && !(value.X == 0 && value.Y == 0 && value.Z == 0);
|
|
|
|
static bool INumberBase<doubleQuat>.IsImaginaryNumber(doubleQuat value) =>
|
|
value.W == 0 && double.IsRealNumber(value.X) && double.IsRealNumber(value.Y) && double.IsRealNumber(value.Z);
|
|
|
|
static bool INumberBase<doubleQuat>.IsRealNumber(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsRealNumber(value.W);
|
|
|
|
/// <summary>Determines if a value is zero.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool IsZero(doubleQuat value)
|
|
{
|
|
return value == Zero;
|
|
}
|
|
|
|
static bool INumberBase<doubleQuat>.IsEvenInteger(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsEvenInteger(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsOddInteger(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsOddInteger(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsInteger(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsInteger(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsNegative(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsRealNumber(value.W) && double.IsNegative(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsPositive(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsRealNumber(value.W) && double.IsPositive(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsFinite(doubleQuat value) =>
|
|
double.IsFinite(value.X) && double.IsFinite(value.Y) && double.IsFinite(value.Z) && double.IsFinite(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsInfinity(doubleQuat value) =>
|
|
double.IsInfinity(value.X) || double.IsInfinity(value.Y) || double.IsInfinity(value.Z) || double.IsInfinity(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsNegativeInfinity(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsNegativeInfinity(value.W);
|
|
|
|
static bool INumberBase<doubleQuat>.IsPositiveInfinity(doubleQuat value) =>
|
|
value.X == 0 && value.Y == 0 && value.Z == 0 && double.IsPositiveInfinity(value.W);
|
|
|
|
// NaN present and no infinity - infinity dominates, per Complex
|
|
static bool INumberBase<doubleQuat>.IsNaN(doubleQuat value) =>
|
|
(double.IsNaN(value.X) || double.IsNaN(value.Y) || double.IsNaN(value.Z) || double.IsNaN(value.W))
|
|
&& !(double.IsInfinity(value.X) || double.IsInfinity(value.Y) || double.IsInfinity(value.Z) || double.IsInfinity(value.W));
|
|
|
|
static bool INumberBase<doubleQuat>.IsNormal(doubleQuat value) =>
|
|
double.IsNormal(value.W)
|
|
&& (value.X == 0 && value.Y == 0 && value.Z == 0 || (double.IsNormal(value.X) && double.IsNormal(value.Y) && double.IsNormal(value.Z)));
|
|
|
|
static bool INumberBase<doubleQuat>.IsSubnormal(doubleQuat value) =>
|
|
double.IsSubnormal(value.X) || double.IsSubnormal(value.Y) || double.IsSubnormal(value.Z) || double.IsSubnormal(value.W);
|
|
|
|
static doubleQuat INumberBase<doubleQuat>.MaxMagnitude(doubleQuat a, doubleQuat b)
|
|
{
|
|
var magnitudeA = a.LengthSquared();
|
|
var magnitudeB = b.LengthSquared();
|
|
if (double.IsNaN(magnitudeA))
|
|
return a;
|
|
if (double.IsNaN(magnitudeB))
|
|
return b;
|
|
return magnitudeA >= magnitudeB ? a : b;
|
|
}
|
|
|
|
static doubleQuat INumberBase<doubleQuat>.MaxMagnitudeNumber(doubleQuat a, doubleQuat b)
|
|
{
|
|
var magnitudeA = a.LengthSquared();
|
|
var magnitudeB = b.LengthSquared();
|
|
if (double.IsNaN(magnitudeA))
|
|
return b;
|
|
if (double.IsNaN(magnitudeB))
|
|
return a;
|
|
return magnitudeA >= magnitudeB ? a : b;
|
|
}
|
|
|
|
static doubleQuat INumberBase<doubleQuat>.MinMagnitude(doubleQuat a, doubleQuat b)
|
|
{
|
|
var magnitudeA = a.LengthSquared();
|
|
var magnitudeB = b.LengthSquared();
|
|
if (double.IsNaN(magnitudeA))
|
|
return a;
|
|
if (double.IsNaN(magnitudeB))
|
|
return b;
|
|
return magnitudeA <= magnitudeB ? a : b;
|
|
}
|
|
|
|
static doubleQuat INumberBase<doubleQuat>.MinMagnitudeNumber(doubleQuat a, doubleQuat b)
|
|
{
|
|
var magnitudeA = a.LengthSquared();
|
|
var magnitudeB = b.LengthSquared();
|
|
if (double.IsNaN(magnitudeA))
|
|
return b;
|
|
if (double.IsNaN(magnitudeB))
|
|
return a;
|
|
return magnitudeA <= magnitudeB ? a : b;
|
|
}
|
|
|
|
/* ++/-- add/subtract One = Identity, bumping W - exactly what Complex does. Generic-plane
|
|
* only: a footgun on a concrete quat. */
|
|
|
|
static doubleQuat IIncrementOperators<doubleQuat>.operator ++(doubleQuat value) => value + Identity;
|
|
|
|
static doubleQuat IDecrementOperators<doubleQuat>.operator --(doubleQuat value) => value - Identity;
|
|
|
|
static bool INumberBase<doubleQuat>.TryConvertFromChecked<TOther>(TOther value, out doubleQuat result)
|
|
{
|
|
if (typeof(TOther) == typeof(doubleQuat))
|
|
{
|
|
result = (doubleQuat)(object)value!;
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(floatQuat))
|
|
{
|
|
var other = (floatQuat)(object)value!;
|
|
result = new(double.CreateChecked(other.X), double.CreateChecked(other.Y), double.CreateChecked(other.Z), double.CreateChecked(other.W));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(sbyte))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((sbyte)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(byte))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((byte)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(short))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((short)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(ushort))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((ushort)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(int))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((int)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(uint))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((uint)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(long))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((long)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(ulong))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((ulong)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(float))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((float)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(double))
|
|
{
|
|
result = new(0, 0, 0, double.CreateChecked((double)(object)value!));
|
|
return true;
|
|
}
|
|
result = default;
|
|
return false;
|
|
}
|
|
|
|
static bool INumberBase<doubleQuat>.TryConvertToChecked<TOther>(doubleQuat value, [MaybeNullWhen(false)] out TOther result)
|
|
{
|
|
result = default;
|
|
return false;
|
|
}
|
|
|
|
static bool INumberBase<doubleQuat>.TryConvertFromSaturating<TOther>(TOther value, out doubleQuat result)
|
|
{
|
|
if (typeof(TOther) == typeof(doubleQuat))
|
|
{
|
|
result = (doubleQuat)(object)value!;
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(floatQuat))
|
|
{
|
|
var other = (floatQuat)(object)value!;
|
|
result = new(double.CreateSaturating(other.X), double.CreateSaturating(other.Y), double.CreateSaturating(other.Z), double.CreateSaturating(other.W));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(sbyte))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((sbyte)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(byte))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((byte)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(short))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((short)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(ushort))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((ushort)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(int))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((int)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(uint))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((uint)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(long))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((long)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(ulong))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((ulong)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(float))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((float)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(double))
|
|
{
|
|
result = new(0, 0, 0, double.CreateSaturating((double)(object)value!));
|
|
return true;
|
|
}
|
|
result = default;
|
|
return false;
|
|
}
|
|
|
|
static bool INumberBase<doubleQuat>.TryConvertToSaturating<TOther>(doubleQuat value, [MaybeNullWhen(false)] out TOther result)
|
|
{
|
|
result = default;
|
|
return false;
|
|
}
|
|
|
|
static bool INumberBase<doubleQuat>.TryConvertFromTruncating<TOther>(TOther value, out doubleQuat result)
|
|
{
|
|
if (typeof(TOther) == typeof(doubleQuat))
|
|
{
|
|
result = (doubleQuat)(object)value!;
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(floatQuat))
|
|
{
|
|
var other = (floatQuat)(object)value!;
|
|
result = new(double.CreateTruncating(other.X), double.CreateTruncating(other.Y), double.CreateTruncating(other.Z), double.CreateTruncating(other.W));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(sbyte))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((sbyte)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(byte))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((byte)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(short))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((short)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(ushort))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((ushort)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(int))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((int)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(uint))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((uint)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(long))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((long)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(ulong))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((ulong)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(float))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((float)(object)value!));
|
|
return true;
|
|
}
|
|
if (typeof(TOther) == typeof(double))
|
|
{
|
|
result = new(0, 0, 0, double.CreateTruncating((double)(object)value!));
|
|
return true;
|
|
}
|
|
result = default;
|
|
return false;
|
|
}
|
|
|
|
static bool INumberBase<doubleQuat>.TryConvertToTruncating<TOther>(doubleQuat value, [MaybeNullWhen(false)] out TOther result)
|
|
{
|
|
result = default;
|
|
return false;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_Addition(Quaternion, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat Add(doubleQuat a, doubleQuat b)
|
|
{
|
|
return a + b;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.Divide(Quaternion, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat Divide(doubleQuat a, doubleQuat b)
|
|
{
|
|
return a / b;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.Multiply(Quaternion, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat Multiply(doubleQuat a, doubleQuat b)
|
|
{
|
|
return a * b;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.Negate(Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat Negate(doubleQuat value)
|
|
{
|
|
return -value;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.Subtract(Quaternion, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat Subtract(doubleQuat a, doubleQuat b)
|
|
{
|
|
return a - b;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_Addition(Quaternion, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat operator +(doubleQuat a, doubleQuat b)
|
|
{
|
|
if (!Vector256.IsHardwareAccelerated)
|
|
return new(a.X + b.X, a.Y + b.Y, a.Z + b.Z, a.W + b.W);
|
|
|
|
return Unsafe.BitCast<Vector256<double>, doubleQuat>(Unsafe.BitCast<doubleQuat, Vector256<double>>(a) + Unsafe.BitCast<doubleQuat, Vector256<double>>(b));
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_Division(Quaternion, Quaternion)" />
|
|
public static doubleQuat operator /(doubleQuat a, doubleQuat b)
|
|
{
|
|
doubleQuat ans;
|
|
|
|
var ax = a.X;
|
|
var ay = a.Y;
|
|
var az = a.Z;
|
|
var aw = a.W;
|
|
|
|
//-------------------------------------
|
|
// Inverse part.
|
|
var ls = b.X * b.X + b.Y * b.Y + b.Z * b.Z + b.W * b.W;
|
|
var invNorm = 1 / ls;
|
|
|
|
var bx = -b.X * invNorm;
|
|
var by = -b.Y * invNorm;
|
|
var bz = -b.Z * invNorm;
|
|
var bw = b.W * invNorm;
|
|
|
|
//-------------------------------------
|
|
// Multiply part.
|
|
|
|
// cross(av, bv)
|
|
var cx = ay * bz - az * by;
|
|
var cy = az * bx - ax * bz;
|
|
var cz = ax * by - ay * bx;
|
|
|
|
var dot = ax * bx + ay * by + az * bz;
|
|
|
|
ans.X = ax * bw + bx * aw + cx;
|
|
ans.Y = ay * bw + by * aw + cy;
|
|
ans.Z = az * bw + bz * aw + cz;
|
|
ans.W = aw * bw - dot;
|
|
|
|
return ans;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_Multiply(Quaternion, Quaternion)" />
|
|
public static doubleQuat operator *(doubleQuat a, doubleQuat b)
|
|
{
|
|
// off AVX2: scalar arm, in the kernel's accumulation order
|
|
if (!Vector256.IsHardwareAccelerated)
|
|
return new doubleQuat(
|
|
b.X * a.W + b.W * a.X + b.Z * a.Y - b.Y * a.Z,
|
|
b.Y * a.W - b.Z * a.X + b.W * a.Y + b.X * a.Z,
|
|
b.Z * a.W + b.Y * a.X - b.X * a.Y + b.W * a.Z,
|
|
b.W * a.W - b.X * a.X - b.Y * a.Y - b.Z * a.Z);
|
|
|
|
var left = Unsafe.BitCast<doubleQuat, Vector256<double>>(a);
|
|
var right = Unsafe.BitCast<doubleQuat, Vector256<double>>(b);
|
|
|
|
var result = right * left.GetElement(3);
|
|
result = Vector256.MultiplyAddEstimate(Vector256.ShuffleNative(right, Vector256.Create(3L, 2L, 1L, 0L)) * left.GetElement(0), Vector256.Create(+1.0, -1.0, +1.0, -1.0), result);
|
|
result = Vector256.MultiplyAddEstimate(Vector256.ShuffleNative(right, Vector256.Create(2L, 3L, 0L, 1L)) * left.GetElement(1), Vector256.Create(+1.0, +1.0, -1.0, -1.0), result);
|
|
result = Vector256.MultiplyAddEstimate(Vector256.ShuffleNative(right, Vector256.Create(1L, 0L, 3L, 2L)) * left.GetElement(2), Vector256.Create(-1.0, +1.0, +1.0, -1.0), result);
|
|
return Unsafe.BitCast<Vector256<double>, doubleQuat>(result);
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_Subtraction(Quaternion, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat operator -(doubleQuat a, doubleQuat b)
|
|
{
|
|
if (!Vector256.IsHardwareAccelerated)
|
|
return new(a.X - b.X, a.Y - b.Y, a.Z - b.Z, a.W - b.W);
|
|
|
|
return Unsafe.BitCast<Vector256<double>, doubleQuat>(Unsafe.BitCast<doubleQuat, Vector256<double>>(a) - Unsafe.BitCast<doubleQuat, Vector256<double>>(b));
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_UnaryNegation(Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat operator -(doubleQuat value)
|
|
{
|
|
return Zero - value;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat operator +(doubleQuat value)
|
|
{
|
|
return value;
|
|
}
|
|
}
|
|
|
|
// IMultiplyOperators<TSelf, TComponent, TSelf>, IDivisionOperators<TSelf, TComponent, TSelf>
|
|
public partial struct doubleQuat
|
|
: IMultiplyOperators<doubleQuat, double, doubleQuat>
|
|
, IDivisionOperators<doubleQuat, double, doubleQuat>
|
|
{
|
|
/// <inheritdoc cref="Quaternion.Multiply(Quaternion, float)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat Multiply(doubleQuat a, double b)
|
|
{
|
|
return a * b;
|
|
}
|
|
|
|
/// <inheritdoc cref="Quaternion.op_Multiply(Quaternion, float)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat operator *(doubleQuat a, double b)
|
|
{
|
|
if (!Vector256.IsHardwareAccelerated)
|
|
return new(a.X * b, a.Y * b, a.Z * b, a.W * b);
|
|
|
|
return Unsafe.BitCast<Vector256<double>, doubleQuat>(Unsafe.BitCast<doubleQuat, Vector256<double>>(a) * Vector256.Create(b));
|
|
}
|
|
|
|
/// <summary>Divides a quaternion by a scalar, componentwise.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static doubleQuat operator /(doubleQuat a, double b)
|
|
{
|
|
if (!Vector256.IsHardwareAccelerated)
|
|
return new(a.X / b, a.Y / b, a.Z / b, a.W / b);
|
|
|
|
return Unsafe.BitCast<Vector256<double>, doubleQuat>(Unsafe.BitCast<doubleQuat, Vector256<double>>(a) / Vector256.Create(b));
|
|
}
|
|
}
|