// - edit Vector.math.tt to modify
#nullable enable
namespace Brutal.Numerics;
public partial struct float2
{
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 Reflect(float2 vector, float2 normal)
{
return vector - 2 * Dot(vector, normal) * normal;
}
///
[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;
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 Transform(float2 position, float4x4 matrix)
{
return float4.Transform(position, matrix).XY;
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 Transform(float2 value, floatQuat rotation)
{
return float4.Transform(value, rotation).XY;
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float2 TransformNormal(float2 normal, float3x2 matrix)
{
var result = matrix.X * normal.X;
result += matrix.Y * normal.Y;
return result;
}
///
[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;
}
}