diff --git a/CHANGELOG.md b/CHANGELOG.md
index b84503b..74e52b7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,15 @@
- X10D: Added `char.IsEmoji`
- X10D: Added `Rune.IsEmoji`
- X10D: Added `string.IsEmoji`
+- X10D: Added `Vector2.WithX()`
+- X10D: Added `Vector2.WithY()`
+- X10D: Added `Vector3.WithX()`
+- X10D: Added `Vector3.WithY()`
+- X10D: Added `Vector3.WithZ()`
+- X10D: Added `Vector4.WithX()`
+- X10D: Added `Vector4.WithY()`
+- X10D: Added `Vector4.WithZ()`
+- X10D: Added `Vector4.WithW()`
- X10D.Unity: Added `Color.Inverted()`
- X10D.Unity: Added `Color.WithA()`
- X10D.Unity: Added `Color.WithB()`
@@ -45,6 +54,15 @@
- X10D.Unity: Added `Random.NextUnitVector3()`
- X10D.Unity: Added `Transform.LookAt(GameObject[, Vector3])`
- X10D.Unity: Added `Transform.SetParent(GameObject[, bool])`
+- X10D.Unity: Added `Vector2.WithX()`
+- X10D.Unity: Added `Vector2.WithY()`
+- X10D.Unity: Added `Vector3.WithX()`
+- X10D.Unity: Added `Vector3.WithY()`
+- X10D.Unity: Added `Vector3.WithZ()`
+- X10D.Unity: Added `Vector4.WithX()`
+- X10D.Unity: Added `Vector4.WithY()`
+- X10D.Unity: Added `Vector4.WithZ()`
+- X10D.Unity: Added `Vector4.WithW()`
## [3.0.0]
diff --git a/X10D.Tests/src/Numerics/Vector2Tests.cs b/X10D.Tests/src/Numerics/Vector2Tests.cs
new file mode 100644
index 0000000..72c1ddb
--- /dev/null
+++ b/X10D.Tests/src/Numerics/Vector2Tests.cs
@@ -0,0 +1,37 @@
+using System.Numerics;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using X10D.Numerics;
+
+namespace X10D.Tests.Numerics;
+
+[TestClass]
+public class Vector2Tests
+{
+ [TestMethod]
+ public void WithX_ShouldReturnVectorWithNewX_GivenVector()
+ {
+ Assert.AreEqual(Vector2.UnitY, Vector2.One.WithX(0));
+ Assert.AreEqual(Vector2.Zero, Vector2.Zero.WithX(0));
+ Assert.AreEqual(Vector2.Zero, Vector2.UnitX.WithX(0));
+ Assert.AreEqual(Vector2.UnitY, Vector2.UnitY.WithX(0));
+
+ Assert.AreEqual(Vector2.One, Vector2.One.WithX(1));
+ Assert.AreEqual(Vector2.UnitX, Vector2.Zero.WithX(1));
+ Assert.AreEqual(Vector2.UnitX, Vector2.UnitX.WithX(1));
+ Assert.AreEqual(Vector2.One, Vector2.UnitY.WithX(1));
+ }
+
+ [TestMethod]
+ public void WithY_ShouldReturnVectorWithNewY_GivenVector()
+ {
+ Assert.AreEqual(Vector2.UnitX, Vector2.One.WithY(0));
+ Assert.AreEqual(Vector2.Zero, Vector2.Zero.WithY(0));
+ Assert.AreEqual(Vector2.UnitX, Vector2.UnitX.WithY(0));
+ Assert.AreEqual(Vector2.Zero, Vector2.UnitY.WithY(0));
+
+ Assert.AreEqual(Vector2.One, Vector2.One.WithY(1));
+ Assert.AreEqual(Vector2.UnitY, Vector2.Zero.WithY(1));
+ Assert.AreEqual(Vector2.One, Vector2.UnitX.WithY(1));
+ Assert.AreEqual(Vector2.UnitY, Vector2.UnitY.WithY(1));
+ }
+}
diff --git a/X10D.Tests/src/Numerics/Vector3Tests.cs b/X10D.Tests/src/Numerics/Vector3Tests.cs
new file mode 100644
index 0000000..285a253
--- /dev/null
+++ b/X10D.Tests/src/Numerics/Vector3Tests.cs
@@ -0,0 +1,57 @@
+using System.Numerics;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using X10D.Numerics;
+
+namespace X10D.Tests.Numerics;
+
+[TestClass]
+public class Vector3Tests
+{
+ [TestMethod]
+ public void WithX_ShouldReturnVectorWithNewX_GivenVector()
+ {
+ Assert.AreEqual(new Vector3(0, 1, 1), Vector3.One.WithX(0));
+ Assert.AreEqual(Vector3.Zero, Vector3.Zero.WithX(0));
+ Assert.AreEqual(Vector3.Zero, Vector3.UnitX.WithX(0));
+ Assert.AreEqual(Vector3.UnitY, Vector3.UnitY.WithX(0));
+ Assert.AreEqual(Vector3.UnitZ, Vector3.UnitZ.WithX(0));
+
+ Assert.AreEqual(Vector3.One, Vector3.One.WithX(1));
+ Assert.AreEqual(Vector3.UnitX, Vector3.Zero.WithX(1));
+ Assert.AreEqual(Vector3.UnitX, Vector3.UnitX.WithX(1));
+ Assert.AreEqual(new Vector3(1, 1, 0), Vector3.UnitY.WithX(1));
+ Assert.AreEqual(new Vector3(1, 0, 1), Vector3.UnitZ.WithX(1));
+ }
+
+ [TestMethod]
+ public void WithY_ShouldReturnVectorWithNewY_GivenVector()
+ {
+ Assert.AreEqual(new Vector3(1, 0, 1), Vector3.One.WithY(0));
+ Assert.AreEqual(Vector3.Zero, Vector3.Zero.WithY(0));
+ Assert.AreEqual(Vector3.UnitX, Vector3.UnitX.WithY(0));
+ Assert.AreEqual(Vector3.Zero, Vector3.UnitY.WithY(0));
+ Assert.AreEqual(Vector3.UnitZ, Vector3.UnitZ.WithY(0));
+
+ Assert.AreEqual(Vector3.One, Vector3.One.WithY(1));
+ Assert.AreEqual(Vector3.UnitY, Vector3.Zero.WithY(1));
+ Assert.AreEqual(new Vector3(1, 1, 0), Vector3.UnitX.WithY(1));
+ Assert.AreEqual(Vector3.UnitY, Vector3.UnitY.WithY(1));
+ Assert.AreEqual(new Vector3(0, 1, 1), Vector3.UnitZ.WithY(1));
+ }
+
+ [TestMethod]
+ public void WithZ_ShouldReturnVectorWithNewZ_GivenVector()
+ {
+ Assert.AreEqual(new Vector3(1, 1, 0), Vector3.One.WithZ(0));
+ Assert.AreEqual(Vector3.Zero, Vector3.Zero.WithZ(0));
+ Assert.AreEqual(Vector3.UnitX, Vector3.UnitX.WithZ(0));
+ Assert.AreEqual(Vector3.UnitY, Vector3.UnitY.WithZ(0));
+ Assert.AreEqual(Vector3.Zero, Vector3.UnitZ.WithZ(0));
+
+ Assert.AreEqual(Vector3.One, Vector3.One.WithZ(1));
+ Assert.AreEqual(Vector3.UnitZ, Vector3.Zero.WithZ(1));
+ Assert.AreEqual(new Vector3(1, 0, 1), Vector3.UnitX.WithZ(1));
+ Assert.AreEqual(new Vector3(0, 1, 1), Vector3.UnitY.WithZ(1));
+ Assert.AreEqual(Vector3.UnitZ, Vector3.UnitZ.WithZ(1));
+ }
+}
diff --git a/X10D.Tests/src/Numerics/Vector4Tests.cs b/X10D.Tests/src/Numerics/Vector4Tests.cs
new file mode 100644
index 0000000..4a0b927
--- /dev/null
+++ b/X10D.Tests/src/Numerics/Vector4Tests.cs
@@ -0,0 +1,81 @@
+using System.Numerics;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using X10D.Numerics;
+
+namespace X10D.Tests.Numerics;
+
+[TestClass]
+public class Vector4Tests
+{
+ [TestMethod]
+ public void WithW_ShouldReturnVectorWithNewW_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(1, 1, 1, 0), Vector4.One.WithW(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.Zero.WithW(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.UnitW.WithW(0));
+ Assert.AreEqual(Vector4.UnitX, Vector4.UnitX.WithW(0));
+ Assert.AreEqual(Vector4.UnitY, Vector4.UnitY.WithW(0));
+ Assert.AreEqual(Vector4.UnitZ, Vector4.UnitZ.WithW(0));
+
+ Assert.AreEqual(Vector4.One, Vector4.One.WithW(1));
+ Assert.AreEqual(Vector4.UnitW, Vector4.Zero.WithW(1));
+ Assert.AreEqual(Vector4.UnitW, Vector4.UnitW.WithW(1));
+ Assert.AreEqual(new Vector4(1, 0, 0, 1), Vector4.UnitX.WithW(1));
+ Assert.AreEqual(new Vector4(0, 1, 0, 1), Vector4.UnitY.WithW(1));
+ Assert.AreEqual(new Vector4(0, 0, 1, 1), Vector4.UnitZ.WithW(1));
+ }
+
+ [TestMethod]
+ public void WithX_ShouldReturnVectorWithNewX_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(0, 1, 1, 1), Vector4.One.WithX(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.Zero.WithX(0));
+ Assert.AreEqual(Vector4.UnitW, Vector4.UnitW.WithX(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.UnitX.WithX(0));
+ Assert.AreEqual(Vector4.UnitY, Vector4.UnitY.WithX(0));
+ Assert.AreEqual(Vector4.UnitZ, Vector4.UnitZ.WithX(0));
+
+ Assert.AreEqual(Vector4.One, Vector4.One.WithX(1));
+ Assert.AreEqual(Vector4.UnitX, Vector4.Zero.WithX(1));
+ Assert.AreEqual(new Vector4(1, 0, 0, 1), Vector4.UnitW.WithX(1));
+ Assert.AreEqual(Vector4.UnitX, Vector4.UnitX.WithX(1));
+ Assert.AreEqual(new Vector4(1, 1, 0, 0), Vector4.UnitY.WithX(1));
+ Assert.AreEqual(new Vector4(1, 0, 1, 0), Vector4.UnitZ.WithX(1));
+ }
+
+ [TestMethod]
+ public void WithY_ShouldReturnVectorWithNewY_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(1, 0, 1, 1), Vector4.One.WithY(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.Zero.WithY(0));
+ Assert.AreEqual(Vector4.UnitW, Vector4.UnitW.WithY(0));
+ Assert.AreEqual(Vector4.UnitX, Vector4.UnitX.WithY(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.UnitY.WithY(0));
+ Assert.AreEqual(Vector4.UnitZ, Vector4.UnitZ.WithY(0));
+
+ Assert.AreEqual(Vector4.One, Vector4.One.WithY(1));
+ Assert.AreEqual(Vector4.UnitY, Vector4.Zero.WithY(1));
+ Assert.AreEqual(new Vector4(0, 1, 0, 1), Vector4.UnitW.WithY(1));
+ Assert.AreEqual(new Vector4(1, 1, 0, 0), Vector4.UnitX.WithY(1));
+ Assert.AreEqual(Vector4.UnitY, Vector4.UnitY.WithY(1));
+ Assert.AreEqual(new Vector4(0, 1, 1, 0), Vector4.UnitZ.WithY(1));
+ }
+
+ [TestMethod]
+ public void WithZ_ShouldReturnVectorWithNewZ_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(1, 1, 0, 1), Vector4.One.WithZ(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.Zero.WithZ(0));
+ Assert.AreEqual(Vector4.UnitW, Vector4.UnitW.WithZ(0));
+ Assert.AreEqual(Vector4.UnitX, Vector4.UnitX.WithZ(0));
+ Assert.AreEqual(Vector4.UnitY, Vector4.UnitY.WithZ(0));
+ Assert.AreEqual(Vector4.Zero, Vector4.UnitZ.WithZ(0));
+
+ Assert.AreEqual(Vector4.One, Vector4.One.WithZ(1));
+ Assert.AreEqual(Vector4.UnitZ, Vector4.Zero.WithZ(1));
+ Assert.AreEqual(new Vector4(0, 0, 1, 1), Vector4.UnitW.WithZ(1));
+ Assert.AreEqual(new Vector4(1, 0, 1, 0), Vector4.UnitX.WithZ(1));
+ Assert.AreEqual(new Vector4(0, 1, 1, 0), Vector4.UnitY.WithZ(1));
+ Assert.AreEqual(Vector4.UnitZ, Vector4.UnitZ.WithZ(1));
+ }
+}
diff --git a/X10D.Unity.Tests/Assets/Tests/Numerics/Vector2Tests.cs b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector2Tests.cs
new file mode 100644
index 0000000..45c2526
--- /dev/null
+++ b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector2Tests.cs
@@ -0,0 +1,43 @@
+using System.Collections;
+using NUnit.Framework;
+using UnityEngine;
+using UnityEngine.TestTools;
+using X10D.Unity.Numerics;
+
+namespace X10D.Unity.Tests.Numerics
+{
+ public class Vector2Tests
+ {
+ [UnityTest]
+ public IEnumerator WithX_ShouldReturnVectorWithNewX_GivenVector()
+ {
+ Assert.AreEqual(Vector2.up, Vector2.one.WithX(0));
+ Assert.AreEqual(Vector2.zero, Vector2.zero.WithX(0));
+ Assert.AreEqual(Vector2.zero, Vector2.right.WithX(0));
+ Assert.AreEqual(Vector2.up, Vector2.up.WithX(0));
+
+ Assert.AreEqual(Vector2.one, Vector2.one.WithX(1));
+ Assert.AreEqual(Vector2.right, Vector2.zero.WithX(1));
+ Assert.AreEqual(Vector2.right, Vector2.right.WithX(1));
+ Assert.AreEqual(Vector2.one, Vector2.up.WithX(1));
+
+ yield break;
+ }
+
+ [UnityTest]
+ public IEnumerator WithY_ShouldReturnVectorWithNewY_GivenVector()
+ {
+ Assert.AreEqual(Vector2.right, Vector2.one.WithY(0));
+ Assert.AreEqual(Vector2.zero, Vector2.zero.WithY(0));
+ Assert.AreEqual(Vector2.right, Vector2.right.WithY(0));
+ Assert.AreEqual(Vector2.zero, Vector2.up.WithY(0));
+
+ Assert.AreEqual(Vector2.one, Vector2.one.WithY(1));
+ Assert.AreEqual(Vector2.up, Vector2.zero.WithY(1));
+ Assert.AreEqual(Vector2.one, Vector2.right.WithY(1));
+ Assert.AreEqual(Vector2.up, Vector2.up.WithY(1));
+
+ yield break;
+ }
+ }
+}
diff --git a/X10D.Unity.Tests/Assets/Tests/Numerics/Vector2Tests.cs.meta b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector2Tests.cs.meta
new file mode 100644
index 0000000..54f9a75
--- /dev/null
+++ b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector2Tests.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 83385270996049569380ae9769ff1381
+timeCreated: 1652088132
\ No newline at end of file
diff --git a/X10D.Unity.Tests/Assets/Tests/Numerics/Vector3Tests.cs b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector3Tests.cs
new file mode 100644
index 0000000..cf7ad8c
--- /dev/null
+++ b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector3Tests.cs
@@ -0,0 +1,65 @@
+using System.Collections;
+using NUnit.Framework;
+using UnityEngine;
+using UnityEngine.TestTools;
+using X10D.Unity.Numerics;
+
+namespace X10D.Unity.Tests.Numerics
+{
+ public class Vector3Tests
+ {
+ [UnityTest]
+ public IEnumerator WithX_ShouldReturnVectorWithNewX_GivenVector()
+ {
+ Assert.AreEqual(new Vector3(0, 1, 1), Vector3.one.WithX(0));
+ Assert.AreEqual(Vector3.zero, Vector3.zero.WithX(0));
+ Assert.AreEqual(Vector3.zero, Vector3.right.WithX(0));
+ Assert.AreEqual(Vector3.up, Vector3.up.WithX(0));
+ Assert.AreEqual(Vector3.forward, Vector3.forward.WithX(0));
+
+ Assert.AreEqual(Vector3.one, Vector3.one.WithX(1));
+ Assert.AreEqual(Vector3.right, Vector3.zero.WithX(1));
+ Assert.AreEqual(Vector3.right, Vector3.right.WithX(1));
+ Assert.AreEqual(new Vector3(1, 1, 0), Vector3.up.WithX(1));
+ Assert.AreEqual(new Vector3(1, 0, 1), Vector3.forward.WithX(1));
+
+ yield break;
+ }
+
+ [UnityTest]
+ public IEnumerator WithY_ShouldReturnVectorWithNewY_GivenVector()
+ {
+ Assert.AreEqual(new Vector3(1, 0, 1), Vector3.one.WithY(0));
+ Assert.AreEqual(Vector3.zero, Vector3.zero.WithY(0));
+ Assert.AreEqual(Vector3.right, Vector3.right.WithY(0));
+ Assert.AreEqual(Vector3.zero, Vector3.up.WithY(0));
+ Assert.AreEqual(Vector3.forward, Vector3.forward.WithY(0));
+
+ Assert.AreEqual(Vector3.one, Vector3.one.WithY(1));
+ Assert.AreEqual(Vector3.up, Vector3.zero.WithY(1));
+ Assert.AreEqual(new Vector3(1, 1, 0), Vector3.right.WithY(1));
+ Assert.AreEqual(Vector3.up, Vector3.up.WithY(1));
+ Assert.AreEqual(new Vector3(0, 1, 1), Vector3.forward.WithY(1));
+
+ yield break;
+ }
+
+ [UnityTest]
+ public IEnumerator WithZ_ShouldReturnVectorWithNewZ_GivenVector()
+ {
+ Assert.AreEqual(new Vector3(1, 1, 0), Vector3.one.WithZ(0));
+ Assert.AreEqual(Vector3.zero, Vector3.zero.WithZ(0));
+ Assert.AreEqual(Vector3.right, Vector3.right.WithZ(0));
+ Assert.AreEqual(Vector3.up, Vector3.up.WithZ(0));
+ Assert.AreEqual(Vector3.zero, Vector3.forward.WithZ(0));
+
+ Assert.AreEqual(Vector3.one, Vector3.one.WithZ(1));
+ Assert.AreEqual(Vector3.forward, Vector3.zero.WithZ(1));
+ Assert.AreEqual(new Vector3(1, 0, 1), Vector3.right.WithZ(1));
+ Assert.AreEqual(new Vector3(0, 1, 1), Vector3.up.WithZ(1));
+ Assert.AreEqual(Vector3.forward, Vector3.forward.WithZ(1));
+
+ yield break;
+ }
+ }
+}
diff --git a/X10D.Unity.Tests/Assets/Tests/Numerics/Vector3Tests.cs.meta b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector3Tests.cs.meta
new file mode 100644
index 0000000..6255e34
--- /dev/null
+++ b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector3Tests.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: a00d613201bd497d91c9e98bca8dd6b1
+timeCreated: 1652088132
\ No newline at end of file
diff --git a/X10D.Unity.Tests/Assets/Tests/Numerics/Vector4Tests.cs b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector4Tests.cs
new file mode 100644
index 0000000..2e79b3f
--- /dev/null
+++ b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector4Tests.cs
@@ -0,0 +1,91 @@
+using System.Collections;
+using NUnit.Framework;
+using UnityEngine;
+using UnityEngine.TestTools;
+using X10D.Unity.Numerics;
+
+namespace X10D.Unity.Tests.Numerics
+{
+ public class Vector4Tests
+ {
+ [UnityTest]
+ public IEnumerator WithW_ShouldReturnVectorWithNewW_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(1, 1, 1, 0), Vector4.one.WithW(0));
+ Assert.AreEqual(Vector4.zero, Vector4.zero.WithW(0));
+ Assert.AreEqual(Vector4.zero, new Vector4(0, 0, 0, 1).WithW(0));
+ Assert.AreEqual(new Vector4(1, 0, 0, 0), new Vector4(1, 0, 0, 0).WithW(0));
+ Assert.AreEqual(new Vector4(0, 1, 0, 0), new Vector4(0, 1, 0, 0).WithW(0));
+ Assert.AreEqual(new Vector4(0, 0, 1, 0), new Vector4(0, 0, 1, 0).WithW(0));
+
+ Assert.AreEqual(Vector4.one, Vector4.one.WithW(1));
+ Assert.AreEqual(new Vector4(0, 0, 0, 1), Vector4.zero.WithW(1));
+ Assert.AreEqual(new Vector4(0, 0, 0, 1), new Vector4(0, 0, 0, 1).WithW(1));
+ Assert.AreEqual(new Vector4(1, 0, 0, 1), new Vector4(1, 0, 0, 0).WithW(1));
+ Assert.AreEqual(new Vector4(0, 1, 0, 1), new Vector4(0, 1, 0, 0).WithW(1));
+ Assert.AreEqual(new Vector4(0, 0, 1, 1), new Vector4(0, 0, 1, 0).WithW(1));
+
+ yield break;
+ }
+
+ [UnityTest]
+ public IEnumerator WithX_ShouldReturnVectorWithNewX_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(0, 1, 1, 1), Vector4.one.WithX(0));
+ Assert.AreEqual(Vector4.zero, Vector4.zero.WithX(0));
+ Assert.AreEqual(new Vector4(0, 0, 0, 1), new Vector4(0, 0, 0, 1).WithX(0));
+ Assert.AreEqual(Vector4.zero, new Vector4(1, 0, 0, 0).WithX(0));
+ Assert.AreEqual(new Vector4(0, 1, 0, 0), new Vector4(0, 1, 0, 0).WithX(0));
+ Assert.AreEqual(new Vector4(0, 0, 1, 0), new Vector4(0, 0, 1, 0).WithX(0));
+
+ Assert.AreEqual(Vector4.one, Vector4.one.WithX(1));
+ Assert.AreEqual(new Vector4(1, 0, 0, 0), Vector4.zero.WithX(1));
+ Assert.AreEqual(new Vector4(1, 0, 0, 1), new Vector4(0, 0, 0, 1).WithX(1));
+ Assert.AreEqual(new Vector4(1, 0, 0, 0), new Vector4(1, 0, 0, 0).WithX(1));
+ Assert.AreEqual(new Vector4(1, 1, 0, 0), new Vector4(0, 1, 0, 0).WithX(1));
+ Assert.AreEqual(new Vector4(1, 0, 1, 0), new Vector4(0, 0, 1, 0).WithX(1));
+
+ yield break;
+ }
+
+ [UnityTest]
+ public IEnumerator WithY_ShouldReturnVectorWithNewY_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(1, 0, 1, 1), Vector4.one.WithY(0));
+ Assert.AreEqual(Vector4.zero, Vector4.zero.WithY(0));
+ Assert.AreEqual(new Vector4(0, 0, 0, 1), new Vector4(0, 0, 0, 1).WithY(0));
+ Assert.AreEqual(new Vector4(1, 0, 0, 0), new Vector4(1, 0, 0, 0).WithY(0));
+ Assert.AreEqual(Vector4.zero, new Vector4(0, 1, 0, 0).WithY(0));
+ Assert.AreEqual(new Vector4(0, 0, 1, 0), new Vector4(0, 0, 1, 0).WithY(0));
+
+ Assert.AreEqual(Vector4.one, Vector4.one.WithY(1));
+ Assert.AreEqual(new Vector4(0, 1, 0, 0), Vector4.zero.WithY(1));
+ Assert.AreEqual(new Vector4(0, 1, 0, 1), new Vector4(0, 0, 0, 1).WithY(1));
+ Assert.AreEqual(new Vector4(1, 1, 0, 0), new Vector4(1, 0, 0, 0).WithY(1));
+ Assert.AreEqual(new Vector4(0, 1, 0, 0), new Vector4(0, 1, 0, 0).WithY(1));
+ Assert.AreEqual(new Vector4(0, 1, 1, 0), new Vector4(0, 0, 1, 0).WithY(1));
+
+ yield break;
+ }
+
+ [UnityTest]
+ public IEnumerator WithZ_ShouldReturnVectorWithNewZ_GivenVector()
+ {
+ Assert.AreEqual(new Vector4(1, 1, 0, 1), Vector4.one.WithZ(0));
+ Assert.AreEqual(Vector4.zero, Vector4.zero.WithZ(0));
+ Assert.AreEqual(new Vector4(0, 0, 0, 1), new Vector4(0, 0, 0, 1).WithZ(0));
+ Assert.AreEqual(new Vector4(1, 0, 0, 0), new Vector4(1, 0, 0, 0).WithZ(0));
+ Assert.AreEqual(new Vector4(0, 1, 0, 0), new Vector4(0, 1, 0, 0).WithZ(0));
+ Assert.AreEqual(Vector4.zero, new Vector4(0, 0, 1, 0).WithZ(0));
+
+ Assert.AreEqual(Vector4.one, Vector4.one.WithZ(1));
+ Assert.AreEqual(new Vector4(0, 0, 1, 0), Vector4.zero.WithZ(1));
+ Assert.AreEqual(new Vector4(0, 0, 1, 1), new Vector4(0, 0, 0, 1).WithZ(1));
+ Assert.AreEqual(new Vector4(1, 0, 1, 0), new Vector4(1, 0, 0, 0).WithZ(1));
+ Assert.AreEqual(new Vector4(0, 1, 1, 0), new Vector4(0, 1, 0, 0).WithZ(1));
+ Assert.AreEqual(new Vector4(0, 0, 1, 0), new Vector4(0, 0, 1, 0).WithZ(1));
+
+ yield break;
+ }
+ }
+}
diff --git a/X10D.Unity.Tests/Assets/Tests/Numerics/Vector4Tests.cs.meta b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector4Tests.cs.meta
new file mode 100644
index 0000000..041ceb9
--- /dev/null
+++ b/X10D.Unity.Tests/Assets/Tests/Numerics/Vector4Tests.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 0d487c2046a64354b199f4de01d57391
+timeCreated: 1652088132
\ No newline at end of file
diff --git a/X10D.Unity/src/Numerics/Vector2Extensions.cs b/X10D.Unity/src/Numerics/Vector2Extensions.cs
new file mode 100644
index 0000000..1f7b466
--- /dev/null
+++ b/X10D.Unity/src/Numerics/Vector2Extensions.cs
@@ -0,0 +1,43 @@
+using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
+using UnityEngine;
+
+namespace X10D.Unity.Numerics;
+
+///
+/// Numeric-extensions for .
+///
+public static class Vector2Extensions
+{
+ ///
+ /// Returns a vector whose Y component is the same as the specified vector, and whose X component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new X component value.
+ ///
+ /// A new instance of whose components is the same as that of
+ /// , and whose component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector2 WithX(this Vector2 vector, float x)
+ {
+ return vector with {x = x};
+ }
+
+ ///
+ /// Returns a vector whose X component is the same as the specified vector, and whose Y component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new Y component value.
+ ///
+ /// A new instance of whose components is the same as that of
+ /// , and whose component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector2 WithY(this Vector2 vector, float y)
+ {
+ return vector with {y = y};
+ }
+}
diff --git a/X10D.Unity/src/Numerics/Vector3Extensions.cs b/X10D.Unity/src/Numerics/Vector3Extensions.cs
new file mode 100644
index 0000000..52e0f56
--- /dev/null
+++ b/X10D.Unity/src/Numerics/Vector3Extensions.cs
@@ -0,0 +1,59 @@
+using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
+using UnityEngine;
+
+namespace X10D.Unity.Numerics;
+
+///
+/// Numeric-extensions for .
+///
+public static class Vector3Extensions
+{
+ ///
+ /// Returns a vector whose Y and Z components are the same as the specified vector, and whose X component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new X component value.
+ ///
+ /// A new instance of whose and components are
+ /// the same as that of , and whose component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector3 WithX(this Vector3 vector, float x)
+ {
+ return vector with {x = x};
+ }
+
+ ///
+ /// Returns a vector whose X and Z components are the same as the specified vector, and whose Y component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new Y component value.
+ ///
+ /// A new instance of whose and components are
+ /// the same as that of , and whose component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector3 WithY(this Vector3 vector, float y)
+ {
+ return vector with {y = y};
+ }
+
+ ///
+ /// Returns a vector whose X and Y components are the same as the specified vector, and whose Z component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new Z component value.
+ ///
+ /// A new instance of whose and components are
+ /// the same as that of , and whose component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector3 WithZ(this Vector3 vector, float z)
+ {
+ return vector with {z = z};
+ }
+}
diff --git a/X10D.Unity/src/Numerics/Vector4Extensions.cs b/X10D.Unity/src/Numerics/Vector4Extensions.cs
new file mode 100644
index 0000000..0a21bca
--- /dev/null
+++ b/X10D.Unity/src/Numerics/Vector4Extensions.cs
@@ -0,0 +1,83 @@
+using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
+using UnityEngine;
+
+namespace X10D.Unity.Numerics;
+
+///
+/// Numeric-extensions for .
+///
+public static class Vector4Extensions
+{
+ ///
+ /// Returns a vector whose Y, Z, and W components are the same as the specified vector, and whose X component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new X component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector4 WithX(this Vector4 vector, float x)
+ {
+ return vector with {x = x};
+ }
+
+ ///
+ /// Returns a vector whose X, Z, and W components are the same as the specified vector, and whose Y component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new Y component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector4 WithY(this Vector4 vector, float y)
+ {
+ return vector with {y = y};
+ }
+
+ ///
+ /// Returns a vector whose X, Y, and W components are the same as the specified vector, and whose Z component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new Z component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector4 WithZ(this Vector4 vector, float z)
+ {
+ return vector with {z = z};
+ }
+
+ ///
+ /// Returns a vector whose X, Y, and Z components are the same as the specified vector, and whose W component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new W component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Vector4 WithW(this Vector4 vector, float w)
+ {
+ return vector with {w = w};
+ }
+}
diff --git a/X10D/src/Numerics/Vector2Extensions.cs b/X10D/src/Numerics/Vector2Extensions.cs
new file mode 100644
index 0000000..8831e2c
--- /dev/null
+++ b/X10D/src/Numerics/Vector2Extensions.cs
@@ -0,0 +1,51 @@
+using System.Diagnostics.Contracts;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace X10D.Numerics;
+
+///
+/// Numeric-extensions for .
+///
+public static class Vector2Extensions
+{
+ ///
+ /// Returns a vector whose Y component is the same as the specified vector, and whose X component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new X component value.
+ ///
+ /// A new instance of whose components is the same as that of
+ /// , and whose component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector2 WithX(this Vector2 vector, float x)
+ {
+ return vector with {X = x};
+ }
+
+ ///
+ /// Returns a vector whose X component is the same as the specified vector, and whose Y component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new Y component value.
+ ///
+ /// A new instance of whose components is the same as that of
+ /// , and whose component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector2 WithY(this Vector2 vector, float y)
+ {
+ return vector with {Y = y};
+ }
+}
diff --git a/X10D/src/Numerics/Vector3Extensions.cs b/X10D/src/Numerics/Vector3Extensions.cs
new file mode 100644
index 0000000..0f906a9
--- /dev/null
+++ b/X10D/src/Numerics/Vector3Extensions.cs
@@ -0,0 +1,71 @@
+using System.Diagnostics.Contracts;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace X10D.Numerics;
+
+///
+/// Numeric-extensions for .
+///
+public static class Vector3Extensions
+{
+ ///
+ /// Returns a vector whose Y and Z components are the same as the specified vector, and whose X component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new X component value.
+ ///
+ /// A new instance of whose and components are
+ /// the same as that of , and whose component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector3 WithX(this Vector3 vector, float x)
+ {
+ return vector with {X = x};
+ }
+
+ ///
+ /// Returns a vector whose X and Z components are the same as the specified vector, and whose Y component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new Y component value.
+ ///
+ /// A new instance of whose and components are
+ /// the same as that of , and whose component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector3 WithY(this Vector3 vector, float y)
+ {
+ return vector with {Y = y};
+ }
+
+ ///
+ /// Returns a vector whose X and Y components are the same as the specified vector, and whose Z component is a new value.
+ ///
+ /// The vector to copy.
+ /// The new Z component value.
+ ///
+ /// A new instance of whose and components are
+ /// the same as that of , and whose component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector3 WithZ(this Vector3 vector, float z)
+ {
+ return vector with {Z = z};
+ }
+}
diff --git a/X10D/src/Numerics/Vector4Extensions.cs b/X10D/src/Numerics/Vector4Extensions.cs
new file mode 100644
index 0000000..20390bd
--- /dev/null
+++ b/X10D/src/Numerics/Vector4Extensions.cs
@@ -0,0 +1,99 @@
+using System.Diagnostics.Contracts;
+using System.Numerics;
+using System.Runtime.CompilerServices;
+
+namespace X10D.Numerics;
+
+///
+/// Numeric-extensions for .
+///
+public static class Vector4Extensions
+{
+ ///
+ /// Returns a vector whose Y, Z, and W components are the same as the specified vector, and whose X component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new X component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector4 WithX(this Vector4 vector, float x)
+ {
+ return vector with {X = x};
+ }
+
+ ///
+ /// Returns a vector whose X, Z, and W components are the same as the specified vector, and whose Y component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new Y component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector4 WithY(this Vector4 vector, float y)
+ {
+ return vector with {Y = y};
+ }
+
+ ///
+ /// Returns a vector whose X, Y, and W components are the same as the specified vector, and whose Z component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new Z component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector4 WithZ(this Vector4 vector, float z)
+ {
+ return vector with {Z = z};
+ }
+
+ ///
+ /// Returns a vector whose X, Y, and Z components are the same as the specified vector, and whose W component is a new
+ /// value.
+ ///
+ /// The vector to copy.
+ /// The new W component value.
+ ///
+ /// A new instance of whose , , and
+ /// components are the same as that of , and whose
+ /// component is .
+ ///
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
+ public static Vector4 WithW(this Vector4 vector, float w)
+ {
+ return vector with {W = w};
+ }
+}