Prowl.Vector 0.5.0

dotnet add package Prowl.Vector --version 0.5.0                
NuGet\Install-Package Prowl.Vector -Version 0.5.0                
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="0.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Prowl.Vector --version 0.5.0                
#r "nuget: Prowl.Vector, 0.5.0"                
#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.
// Install Prowl.Vector as a Cake Addin
#addin nuget:?package=Prowl.Vector&version=0.5.0

// Install Prowl.Vector as a Cake Tool
#tool nuget:?package=Prowl.Vector&version=0.5.0                

Prowl.Vector 3D Mathematics

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

Features

  • Core Type

    • Vector2/Vector2Int
    • Vector3/Vector3Int
    • Vector4/Vector4Int
    • Bool3 (Memory-efficient 3-boolean structure)
    • Matrix4x4
    • Quaternion
    • Bounds
    • Bounding Frustrum
    • Rect/IntRect
    • Random (Comprehensive random functions)
    • Ray
    • Plane
    • Less than 3k lines of executable code!
  • Vector Operations

    • Basic arithmetic (add, subtract, multiply, divide)
    • Dot and cross products
    • Normalization and magnitude calculations
    • Linear interpolation (Lerp)
    • Min/Max operations
    • Distance calculations
    • Vector transformations
    • And More!
  • Matrix Operations

    • Creation of view and projection matrices
    • Translation, rotation, and scaling transformations
    • Matrix multiplication and inversion
    • Billboard and constrained billboard creation
    • Decomposition into translation/rotation/scale
    • And More!
  • Quaternion Features

    • Euler angle conversions
    • Spherical interpolation (Slerp)
    • Rotation concatenation
    • Angular interpolation
    • Matrix conversions
    • And More!
  • Other Noteable features

    • Comprehensive set of constants (π, τ, e, golden ratio)
    • Trigonometric functions
    • Interpolation functions
    • Geometric calculations
    • Angle conversions
    • Ray and line intersection tests
    • And Much More!

Usage

Basic Vector Operations

// Create vectors
var v2 = new Vector2(1.0, 2.0);
var v3 = new Vector3(1.0, 2.0, 3.0);
var v4 = new Vector4(1.0, 2.0, 3.0, 4.0);

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

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

Matrix transformations

// Create transformation matrices
var translation = Matrix4x4.CreateTranslation(new Vector3(1, 2, 3));
var rotation = Matrix4x4.CreateRotationY(MathD.PI * 0.5);
var scale = Matrix4x4.CreateScale(2.0);

// Combine transformations
var transform = translation * rotation * scale;

// Transform vectors
var transformed = Vector3.Transform(v3, transform);

Quaternion Rotations

// Create quaternions
var rotation = Quaternion.CreateFromYawPitchRoll(yaw, pitch, roll);
var fromAxis = Quaternion.AngleAxis(angle, axis);

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

// Apply rotation to vector
var rotated = Vector3.Transform(v3, rotation);

Other Usefull Functions

// Generate random values
double 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
double degree = radian.ToDeg();
double radian = degree.ToRad();

// Line intersection
bool intersects = MathD.DoesLineIntersectLine(start1, end1, start2, end2, out Vector2 intersection);

// Ray-triangle intersection
bool hits = MathD.RayIntersectsTriangle(rayOrigin, rayDir, v1, v2, v3, out Vector3 hitPoint);

// Point in triangle test
bool inside = MathD.IsPointInTriangle(point, v1, v2, v3);

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 net6.0 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 28 1/10/2025