mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48: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 double2
|
|
{
|
|
/// <inheritdoc cref="Vector2.Reflect" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double2 Reflect(double2 vector, double2 normal)
|
|
{
|
|
return vector - 2 * Dot(vector, normal) * normal;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.Transform(Vector2, Matrix3x2)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double2 Transform(double2 position, double3x2 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 double2 Transform(double2 position, double4x4 matrix)
|
|
{
|
|
return double4.Transform(position, matrix).XY;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.Transform(Vector2, Quaternion)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double2 Transform(double2 value, doubleQuat rotation)
|
|
{
|
|
return double4.Transform(value, rotation).XY;
|
|
}
|
|
|
|
/// <inheritdoc cref="Vector2.TransformNormal(Vector2, Matrix3x2)" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static double2 TransformNormal(double2 normal, double3x2 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 double2 TransformNormal(double2 normal, double4x4 matrix)
|
|
{
|
|
var result = matrix.X * normal.X;
|
|
|
|
result += matrix.Y * normal.Y;
|
|
|
|
return result.XY;
|
|
}
|
|
}
|