Prowl.Vector 2.3.1

dotnet add package Prowl.Vector --version 2.3.1
                    
NuGet\Install-Package Prowl.Vector -Version 2.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Prowl.Vector" Version="2.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Prowl.Vector" Version="2.3.1" />
                    
Directory.Packages.props
<PackageReference Include="Prowl.Vector" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Prowl.Vector --version 2.3.1
                    
#r "nuget: Prowl.Vector, 2.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Prowl.Vector@2.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Prowl.Vector&version=2.3.1
                    
Install as a Cake Addin
#tool nuget:?package=Prowl.Vector&version=2.3.1
                    
Install as a Cake Tool

Prowl.Vector 3D Mathematics

A comprehensive mathematics library (Built for the Prowl Game Engine). The library is designed for both 32-bit and 64-bit 3D applications, providing vector operations, matrix transformations, geometric utilities, noise functions, and collision detection. The API itself is heavily inspired by the Unity Game Engine.

Features

  • Core Types

    • Double2 / Float2 / Int2 — 2D vectors (double, float, int precision)
    • Double3 / Float3 / Int3 — 3D vectors
    • Double4 / Float4 / Int4 — 4D vectors
    • Double4x4 / Float4x4 — 4x4 matrices
    • Double3x3 / Float3x3 — 3x3 matrices
    • Double2x2 / Float2x2 — 2x2 matrices
    • Quaternion
    • Color / Color32 — float and byte RGBA color types
    • Rect / IntRect
    • RNG — xoshiro256** pseudo-random number generator
  • Geometry Types (Prowl.Vector.Geometry)

    • AABB — Axis-Aligned Bounding Box
    • Frustum — View frustum
    • Plane / Ray / Sphere / Cone / Triangle
    • LineSegment / Spline
    • Transform2D / Transform3D
    • GeometryData — Mesh data for wireframe and solid visualization
    • IBoundingShape — Interface for GJK-compatible shapes
    • GJK — Gilbert-Johnson-Keerthi collision detection
  • Vector Operations

    • Basic arithmetic (add, subtract, multiply, divide)
    • Dot and cross products
    • Normalization and magnitude calculations
    • Linear interpolation (Maths.Lerp)
    • Spherical interpolation (Double3.Slerp)
    • Min/Max, Clamp, Remap operations
    • Distance and angle calculations
    • Projection, reflection, refraction
    • And More!
  • Matrix Operations

    • Translation, rotation, and scaling (CreateTranslation, CreateTRS, RotateX/Y/Z)
    • View and projection matrices (CreateLookAt, CreatePerspectiveFov, CreateOrtho)
    • Matrix multiplication and inversion
    • Transpose and determinant
    • And More!
  • Quaternion Features

    • Euler angle conversions (FromEuler, EulerAngles)
    • Axis-angle construction (AxisAngle / AngleAxis)
    • Spherical interpolation (Slerp) and normalized lerp (Nlerp)
    • Look rotation (LookRotation)
    • Matrix conversions (FromMatrix)
    • And More!
  • Intersection Utilities (Intersection static class)

    • Ray vs. plane, triangle, AABB, sphere, cylinder
    • Overlap tests: sphere-sphere, AABB-AABB, sphere-AABB, frustum, cone, and more
    • Closest-point queries
    • Signed distance and plane classification
  • Noise Functions (Noise static class)

    • Noise.SNoise(Float2/3/4) — Simplex noise (2D, 3D, 4D)
    • Noise.CNoise(Float2/3/4) — Classic Perlin noise
    • Noise.PNoise(Float2/3, rep) — Periodic Perlin noise
    • Noise.Cellular2D(Float2) / Noise.Cellular3D(Float3) — Cellular (Worley) noise
    • Noise.Cellular2x2 / Noise.Cellular2x2x2 — Optimized cellular variants
    • Periodic simplex noise (Psrd_* family)
  • Other Notable Features

    • Comprehensive set of constants (Maths.PI, Maths.Tau, Maths.E, Maths.GoldenRatio, etc.)
    • Trigonometric, logarithmic, and interpolation functions
    • Angle conversions (Maths.ToDegrees / Maths.ToRadians)
    • Physics constants (Maths.StandardGravity, Maths.SpeedOfLight)
    • And Much More!

Usage

Basic Vector Operations

// Create vectors
var v2 = new Double2(1.0, 2.0);
var v3 = new Double3(1.0, 2.0, 3.0);
var v4 = new Double4(1.0, 2.0, 3.0, 4.0);

// Float precision variants
var fv3 = new Float3(1.0f, 2.0f, 3.0f);

// Vector arithmetic
var sum = v3 + new Double3(1.0, 1.0, 1.0);
var scaled = v3 * 2.0;
var normalized = Double3.Normalize(v3);

// Vector operations
float dot = Vector3.Dot(v3, normalized);
Vector3 cross = Vector3.Cross(v3, normalized);
float distance = Vector3.Distance(v3, normalized);

Matrix Transformations

// Create transformation matrices
var translation = Double4x4.CreateTranslation(new Double3(1, 2, 3));
var rotationY = Double4x4.RotateY(Maths.PI * 0.5);
var scale = Double4x4.CreateScale(2.0);

// Combined TRS matrix
var transform = Double4x4.CreateTRS(
    new Double3(1, 2, 3),
    Quaternion.FromEuler(0, 45, 0),
    new Double3(1, 1, 1)
);

// Transform points and normals
var transformedPoint = Double4x4.TransformPoint(v3, transform);
var transformedNormal = Double4x4.TransformNormal(v3, transform);

// View and projection
var view = Double4x4.CreateLookAt(eye, target, Double3.UnitY);
var proj = Double4x4.CreatePerspectiveFov(Maths.PI / 4.0, aspectRatio, 0.1, 1000.0);

Quaternion Rotations

// Create quaternions
var fromEuler = Quaternion.FromEuler(new Double3(pitch, yaw, roll));
var fromAxis = Quaternion.AxisAngle(Double3.UnitY, angle);
var lookAt = Quaternion.LookRotation(forward, Double3.UnitY);

// Interpolate between rotations
var interpolated = Quaternion.Slerp(q1, q2, t);
var fast = Quaternion.Nlerp(q1, q2, t);

// Apply rotation to vector (operator overload)
var rotated = rotation * v3;

Collision Detection

// GJK collision detection between any IBoundingShape types
var box = new AABB(new Double3(-1, -1, -1), new Double3(1, 1, 1));
var sphere = new Sphere(Double3.Zero, 1.5);

bool colliding = GJK.Intersects(box, sphere);

// Direct intersection tests
bool hit = Intersection.RayAABB(ray.Origin, ray.Direction, box.Min, box.Max, out double t);
bool overlap = Intersection.SphereSphereOverlap(centerA, radiusA, centerB, radiusB);

Random Number Generation

// Use the shared instance or create your own
var rng = RNG.Shared;
var seeded = new RNG(42);

// Basic values
double value = rng.NextDouble();        // [0, 1]
float f = rng.NextFloat();              // [0, 1]
int n = rng.Range(0, 100);             // [0, 100] inclusive

// Geometry
Float2 onCircle = rng.OnUnitCircle();   // Point on unit circle
Float3 onSphere = rng.OnUnitSphere();   // Point on unit sphere
Float4 color = rng.NextColor();         // Random opaque color

// Gaussian distribution
float gaussian = rng.NextGaussian(mean: 0f, standardDeviation: 1f);

Angle Conversions

// Generate random values
float value = Random.Value;                // Range [0,1]
Vector2 circle = Random.OnUnitCircle;       // Point on circle
Vector3 sphere = Random.InUnitSphere;       // Point in sphere
Quaternion rotation = Random.Rotation;      // Random rotation

// Quick conversions between Radiens and Degrees
float degree = radian.ToDeg();
float radian = degree.ToRad();

### Intersection Tests

```csharp
// Ray-triangle intersection
bool hits = Intersection.RayTriangle(
    rayOrigin, rayDirection,
    v0, v1, v2,
    out double t, out double u, out double v
);

// Closest point queries
Intersection.ClosestPointOnLineSegmentToPoint(lineStart, lineEnd, point, out Double3 closest);
Intersection.ClosestPointOnAABBToPoint(aabbMin, aabbMax, point, out Double3 closest);

Noise

// Simplex noise (2D, 3D, 4D)
float n2 = Noise.SNoise(new Float2(x, y));
float n3 = Noise.SNoise(new Float3(x, y, z));
float n4 = Noise.SNoise(new Float4(x, y, z, w));

// 3D simplex noise with gradient
float n3g = Noise.SNoise(new Float3(x, y, z), out Float3 gradient);

// Classic Perlin noise
float perlin = Noise.CNoise(new Float2(x, y));

// Periodic Perlin noise (tileable)
float periodic = Noise.PNoise(new Float2(x, y), new Float2(tileX, tileY));

// Cellular (Worley) noise
Float2 worley = Noise.Cellular2D(new Float2(x, y));

License

This component is part of the Prowl Game Engine and is licensed under the MIT License. See the LICENSE file in the project root for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on Prowl.Vector:

Package Downloads
Prowl.Scribe

TrueType font parser, glyph layout engine, dynamic atlas packing, and Markdown renderer.

Prowl.Graphite

A low-level, hardware-accelerated graphics and compute library for .NET, with backends for Vulkan, Direct3D 11, and OpenGL. Graphite can be used to create high-performance 2D and 3D games, simulations, tools, and other graphical applications.

Prowl.Graphite.Compiler

The Slang-based shader compiler for Prowl.Graphite.

Prowl.Graphite.ShaderDef

The ShaderDef language spec for Prowl.Graphite.

Prowl.Graphite.Shaders

The shared keyword and shader-variant system for Prowl.Graphite.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.1 0 7/3/2026
2.1.0 4,103 10/31/2025
2.0.0 270 10/22/2025
2.0.0-preview.80 249 10/12/2025
2.0.0-preview.70 158 10/12/2025
2.0.0-preview.60 168 10/12/2025
2.0.0-preview.50 173 10/12/2025
2.0.0-preview.33 131 10/10/2025
2.0.0-preview.32 131 10/10/2025
2.0.0-preview.31 131 10/10/2025
2.0.0-preview.30 133 10/10/2025
2.0.0-preview.20 143 10/10/2025
2.0.0-preview.16 172 10/10/2025
2.0.0-preview.15 181 10/9/2025
2.0.0-preview.12 187 10/9/2025
2.0.0-preview.11 166 10/9/2025
2.0.0-preview.10 177 10/9/2025
2.0.0-preview.5 183 10/8/2025
2.0.0-preview.3 160 9/14/2025
2.0.0-preview.2 169 8/17/2025
Loading failed