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
1 changed files with 784842 additions and 0 deletions
97
Brutal.Numerics/Vector/double4/double4.math.gen.cs
Normal file
97
Brutal.Numerics/Vector/double4/double4.math.gen.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
// <auto-generated /> - edit Vector.math.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct double4
|
||||
{
|
||||
/// <inheritdoc cref="float4.Multiply(float4, float4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Multiply(double4 vector, double4x4 matrix)
|
||||
{
|
||||
var result = matrix.X * vector.X;
|
||||
|
||||
result += matrix.Y * vector.Y;
|
||||
result += matrix.Z * vector.Z;
|
||||
result += matrix.W * vector.W;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Multiply(double4, double4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 operator *(double4 vector, double4x4 matrix)
|
||||
{
|
||||
return Multiply(vector, matrix);
|
||||
}
|
||||
|
||||
/// <summary>Reflects a vector off the hyperplane with the given unit normal.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Reflect(double4 vector, double4 normal)
|
||||
{
|
||||
return vector - 2 * Dot(vector, normal) * normal;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Transform(Vector2, Matrix4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Transform(double2 position, double4x4 matrix)
|
||||
{
|
||||
var result = matrix.X * position.X;
|
||||
|
||||
result += matrix.Y * position.Y;
|
||||
result += matrix.W;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Transform(Vector2, Quaternion)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Transform(double2 value, doubleQuat rotation)
|
||||
{
|
||||
// widen in a register: x, y, 0, 1
|
||||
var wide = Vector256.IsHardwareAccelerated
|
||||
? Unsafe.BitCast<Vector256<double>, double4>(Vector256.Create(value.X, value.Y, 0.0, 1.0))
|
||||
: new double4(value, 0, 1);
|
||||
return Transform(wide, rotation);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Transform(Vector3, Matrix4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Transform(double3 position, double4x4 matrix)
|
||||
{
|
||||
var result = matrix.X * position.X;
|
||||
|
||||
result += matrix.Y * position.Y;
|
||||
result += matrix.Z * position.Z;
|
||||
result += matrix.W;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Transform(Vector3, Quaternion)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Transform(double3 value, doubleQuat rotation)
|
||||
{
|
||||
// widen in a register: x, y, z, 1
|
||||
var wide = Vector256.IsHardwareAccelerated
|
||||
? Unsafe.BitCast<Vector256<double>, double4>(Vector256.Create(value.X, value.Y, value.Z, 1.0))
|
||||
: new double4(value, 1);
|
||||
return Transform(wide, rotation);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Transform(Vector4, Matrix4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Transform(double4 vector, double4x4 matrix)
|
||||
{
|
||||
return Multiply(vector, matrix);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Transform(Vector4, Quaternion)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double4 Transform(double4 value, doubleQuat rotation)
|
||||
{
|
||||
var conjugate = doubleQuat.Conjugate(rotation);
|
||||
var temp = doubleQuat.Concatenate(conjugate, Unsafe.BitCast<double4, doubleQuat>(value));
|
||||
return Unsafe.BitCast<doubleQuat, double4>(doubleQuat.Concatenate(temp, rotation));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue