Extension.System.Numerics.Vectors.Swizzle
1.0.1
.NET Standard 2.0
Install-Package Extension.System.Numerics.Vectors.Swizzle -Version 1.0.1
dotnet add package Extension.System.Numerics.Vectors.Swizzle --version 1.0.1
<PackageReference Include="Extension.System.Numerics.Vectors.Swizzle" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Extension.System.Numerics.Vectors.Swizzle --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Extension.System.Numerics.Vectors.Swizzle, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Extension.System.Numerics.Vectors.Swizzle as a Cake Addin
#addin nuget:?package=Extension.System.Numerics.Vectors.Swizzle&version=1.0.1
// Install Extension.System.Numerics.Vectors.Swizzle as a Cake Tool
#tool nuget:?package=Extension.System.Numerics.Vectors.Swizzle&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Extension.System.Numerics.Vectors.Swizzle
Add Swizzling to float, Vector2, Vector3 and Vector4 as extension. https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
Installation
Package Manager
Install-Package Extension.System.Numerics.Vectors.Swizzle
.NET CLI
dotnet add package Extension.System.Numerics.Vectors.Swizzle
PackageReference
<PackageReference Include="Extension.System.Numerics.Vectors.Swizzle" />
Packet CLI
paket add Extension.System.Numerics.Vectors.Swizzle
Example
using System.Numerics;
class Program
{
static void Main(string[] args)
{
float pi = 3.14f;
// Get Vector2 from float by requesting the first component twice
Vector2 v2 = pi.XX();
Assert(v2.X == pi);
Assert(v2.Y == pi);
v2.X = 1.0f;
v2.Y = 3.0f;
// Get Vector4 from Vector2 by requesting components and injecting new ones
Vector3 v4 = v2.X_Y_(2.0f, 4.0f);
Assert(v4.X == 1.0f);
Assert(v4.Y == 2.0f);
Assert(v4.Z == 3.0f);
Assert(v4.W == 4.0f);
// Copy the W and X component over to a Vector2
v4.WX(ref v2);
Assert(v2.X == 4.0f);
Assert(v2.Y == 1.0f);
}
}
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- System.Numerics.Vectors (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.