mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
75
Brutal.Numerics/Vector/float3/float3.math.gen.cs
Normal file
75
Brutal.Numerics/Vector/float3/float3.math.gen.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
// <auto-generated /> - edit Vector.math.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct float3
|
||||
{
|
||||
/// <inheritdoc cref="Vector3.Cross" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float3 Cross(float3 a, float3 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);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="float4.Multiply(float4, float4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float2 Multiply(float3 vector, float3x2 matrix)
|
||||
{
|
||||
float2 result = default;
|
||||
|
||||
result.X = Dot(vector, new float3(matrix.M11, matrix.M21, matrix.M31));
|
||||
result.Y = Dot(vector, new float3(matrix.M12, matrix.M22, matrix.M32));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Multiply(float3, float3x2)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float2 operator *(float3 vector, float3x2 matrix)
|
||||
{
|
||||
return Multiply(vector, matrix);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Reflect" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float3 Reflect(float3 vector, float3 normal)
|
||||
{
|
||||
return vector - 2 * Dot(vector, normal) * normal;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Transform(Vector3, Matrix4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float3 Transform(float3 position, float4x4 matrix)
|
||||
{
|
||||
var result = matrix.X * position.X;
|
||||
|
||||
result += matrix.Y * position.Y;
|
||||
result += matrix.Z * position.Z;
|
||||
result += matrix.W;
|
||||
|
||||
return result.XYZ;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.Transform(Vector3, Quaternion)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float3 Transform(float3 value, floatQuat rotation)
|
||||
{
|
||||
return float4.Transform(value, rotation).XYZ;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector3.TransformNormal(Vector3, Matrix4x4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float3 TransformNormal(float3 normal, float4x4 matrix)
|
||||
{
|
||||
var result = matrix.X * normal.X;
|
||||
|
||||
result += matrix.Y * normal.Y;
|
||||
result += matrix.Z * normal.Z;
|
||||
|
||||
return result.XYZ;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue