mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
// <auto-generated /> - edit Vector.math.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
public partial struct float2
|
|
{
|
|
/// <inheritdoc cref="Vector2.Reflect" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float2 Reflect(float2 vector, float2 normal)
|
|
{
|
|
return vector - 2 * Dot(vector, normal) * normal;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.Transform(Vector2, Matrix3x2)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float2 Transform(float2 position, float3x2 matrix)
|
|
{
|
|
var result = matrix.X * position.X;
|
|
|
|
result += matrix.Y * position.Y;
|
|
result += matrix.Z;
|
|
|
|
return result;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.Transform(Vector2, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float2 Transform(float2 position, float4x4 matrix)
|
|
{
|
|
return float4.Transform(position, matrix).XY;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.Transform(Vector2, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float2 Transform(float2 value, floatQuat rotation)
|
|
{
|
|
return float4.Transform(value, rotation).XY;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.TransformNormal(Vector2, Matrix3x2)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float2 TransformNormal(float2 normal, float3x2 matrix)
|
|
{
|
|
var result = matrix.X * normal.X;
|
|
result += matrix.Y * normal.Y;
|
|
return result;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.TransformNormal(Vector2, Matrix4x4)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static float2 TransformNormal(float2 normal, float4x4 matrix)
|
|
{
|
|
var result = matrix.X * normal.X;
|
|
|
|
result += matrix.Y * normal.Y;
|
|
|
|
return result.XY;
|
|
}
|
|
}
|