Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl.Vector/llms.txt
Use this file to discover all available pages before exploring further.
This quickstart walks you from a blank .NET project to running, verified examples covering vectors, matrix transforms, quaternion rotations, and GJK collision detection — all in under five minutes. By the end you will have a solid mental model of the library’s main types and where to go next.
Install the Package
Add Prowl.Vector to your project via the .NET CLI:dotnet add package Prowl.Vector
Or add the PackageReference directly to your .csproj file:<ItemGroup>
<PackageReference Include="Prowl.Vector" Version="2.1.1" />
</ItemGroup>
Import the Namespaces
Add the two using directives at the top of any file that uses the library:using Prowl.Vector; // Core types: Double3, Float3, Quaternion, Maths, Noise, RNG …
using Prowl.Vector.Geometry; // Geometry tools: GJK, Intersection, GeometryData …
Create and Manipulate Vectors
Double3 is the primary 3-D vector type. All standard arithmetic operators are overloaded, and a rich set of static methods covers normalization, dot and cross products, distance, and interpolation.// Construct 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 variant
var fv3 = new Float3(1.0f, 2.0f, 3.0f);
// Arithmetic operators
var sum = v3 + new Double3(1.0, 1.0, 1.0); // (2, 3, 4)
var scaled = v3 * 2.0; // (2, 4, 6)
var negated = -v3; // (-1, -2, -3)
// Static helper methods
var normalized = Double3.Normalize(v3);
double dot = Double3.Dot(v3, normalized);
Double3 cross = Double3.Cross(v3, normalized);
double dist = Double3.Distance(v3, Double3.Zero);
// Lerp between two vectors
var midpoint = Maths.Lerp(Double3.Zero, v3, 0.5);
Build Matrix Transforms
Double4x4 provides factory methods for every common transform: translation, rotation, scale, combined TRS, look-at (view), and perspective / orthographic projection.// Individual transforms
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 — position (1,2,3), 45 ° yaw, uniform scale 1
var transform = Double4x4.CreateTRS(
new Double3(1, 2, 3),
Quaternion.FromEuler(new Float3(0, 45, 0)),
new Double3(1, 1, 1)
);
// Transform a point or a direction (normal)
var eye = new Double3(0, 5, -10);
var target = Double3.Zero;
Double3 transformedPoint = Double4x4.TransformPoint(new Double3(1, 0, 0), transform);
Double3 transformedNormal = Double4x4.TransformNormal(Double3.UnitY, transform);
// View and projection matrices
double aspectRatio = 16.0 / 9.0;
var view = Double4x4.CreateLookAt(eye, target, Double3.UnitY);
var proj = Double4x4.CreatePerspectiveFov(Maths.PI / 4.0, aspectRatio, 0.1, 1000.0);
Apply Quaternion Rotations
Quaternion stores rotations as a unit quaternion (X, Y, Z, W). Factory methods accept Euler angles in degrees, axis-angle pairs in radians, or a forward/up pair. The * operator applies a rotation to a Float3 vector.// Create from Euler angles (degrees: pitch, yaw, roll)
var fromEuler = Quaternion.FromEuler(new Float3(30, 45, 0));
// Create from an axis and an angle (radians)
float angle = Maths.PI / 4.0f; // 45 °
var fromAxis = Quaternion.AxisAngle(Float3.UnitY, angle);
// Build a look-rotation
var lookAt = Quaternion.LookRotation(
new Float3(0, 0, 1), // forward
Float3.UnitY // up
);
// Smoothly interpolate between two rotations
var q1 = Quaternion.Identity;
var q2 = Quaternion.FromEuler(new Float3(0, 180, 0));
var halfway = Quaternion.Slerp(q1, q2, 0.5f); // constant-velocity
var halfwayFast = Quaternion.Nlerp(q1, q2, 0.5f); // faster, non-constant
// Apply rotation to a vector via operator overload
var direction = new Float3(0, 0, 1);
Float3 rotated = fromEuler * direction;
Run a Collision Check
Any type that implements IBoundingShape — including AABB and Sphere — can be tested for intersection using the GJK algorithm. Direct ray and overlap tests are available through the Intersection static class.// GJK collision detection between any two IBoundingShape types
// AABB and Sphere use Float3 components
var box = new AABB(new Float3(-1, -1, -1), new Float3(1, 1, 1));
var sphere = new Sphere(Float3.Zero, 1.5f);
bool colliding = GJK.Intersects(box, sphere); // true — the sphere overlaps the box
// Direct ray-AABB test (Intersection uses Float3)
var ray = new Ray(new Float3(0, 5, 0), -Float3.UnitY);
bool hit = Intersection.RayAABB(
ray.Origin, ray.Direction,
box.Min, box.Max,
out float tMin, out float tMax
);
// Sphere-sphere overlap
bool spheresOverlap = Intersection.SphereSphereOverlap(
Float3.Zero, 1.0f,
new Float3(1.5f, 0, 0), 1.0f
);
These examples only scratch the surface. Prowl.Vector also includes Noise (Simplex, Perlin, Cellular), RNG (seeded xoshiro256**), Maths (constants, trig, interpolation, remap), color types (Color, Color32), and 2-D / 3-D transform helpers. Explore the full API in the API Reference section of the documentation.