mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
feat: add VectorExtensions(WithX, WithY,...)
This commit is contained in:
parent
71aeee605d
commit
3ff67c709d
1 changed files with 56 additions and 0 deletions
56
Dalamud/Utility/Numerics/VectorExtensions.cs
Normal file
56
Dalamud/Utility/Numerics/VectorExtensions.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Dalamud.Utility.Numerics;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for vectors.
|
||||
/// </summary>
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Redundant.")]
|
||||
public static class VectorExtensions
|
||||
{
|
||||
public static Vector4 WithX(this Vector4 v, float x)
|
||||
{
|
||||
return new Vector4(x, v.Y, v.Z, v.W);
|
||||
}
|
||||
|
||||
public static Vector4 WithY(this Vector4 v, float y)
|
||||
{
|
||||
return new Vector4(v.X, y, v.Z, v.W);
|
||||
}
|
||||
|
||||
public static Vector4 WithZ(this Vector4 v, float z)
|
||||
{
|
||||
return new Vector4(v.X, v.Y, z, v.W);
|
||||
}
|
||||
|
||||
public static Vector4 WithW(this Vector4 v, float w)
|
||||
{
|
||||
return new Vector4(v.X, v.Y, v.Z, w);
|
||||
}
|
||||
|
||||
public static Vector3 WithX(this Vector3 v, float x)
|
||||
{
|
||||
return new Vector3(x, v.Y, v.Z);
|
||||
}
|
||||
|
||||
public static Vector3 WithY(this Vector3 v, float y)
|
||||
{
|
||||
return new Vector3(v.X, y, v.Z);
|
||||
}
|
||||
|
||||
public static Vector3 WithZ(this Vector3 v, float z)
|
||||
{
|
||||
return new Vector3(v.X, v.Y, z);
|
||||
}
|
||||
|
||||
public static Vector2 WithX(this Vector2 v, float x)
|
||||
{
|
||||
return new Vector2(x, v.Y);
|
||||
}
|
||||
|
||||
public static Vector2 WithY(this Vector2 v, float y)
|
||||
{
|
||||
return new Vector2(v.X, y);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue