Skip to content
Liam Riddell edited this page Sep 9, 2023 · 2 revisions

Here's an enhanced presentation of your documentation on the Vector Arithmetic Provider:


Embarking on a Vector Odyssey

Step into a realm where vectors reign supreme! The Vector Arithmetic Provider beckons you into the universe of vector mathematics, providing tools tailored for vectorial majesty. While its kin, the Functions Arithmetic Provider, builds upon the foundation of Basic Arithmetic, this particular provider stands apart, catering to the specialized nuances of vector operations.

The Dimensions of Possibility πŸ“

Unfurling before you are the dimensions supported by the Vector Arithmetic Provider:

  • 2D Vectors: Envisioned as vec2(X, Y) or simply (X, Y)
  • 3D Vectors: Portrayed as vec3(X, Y, Z) or (X, Y, Z)
  • 4D Vectors: Painted as vec4(X, Y, Z, W) or (X, Y, Z, W)

Mathematical Dance of Vectors πŸ•ΊπŸ»

All vector types gracefully waltz through these mathematical operations:

  • Addition: The art of combining vectors.
  • Subtraction: The elegance of withdrawing vectors.
  • Multiplication: The magnificence of scaling vectors.
  • Division: The finesse of partitioning vectors.

Vector 2D - The Planar Realm 🌍

Dive into the plane of 2D vector mathematics, where you can craft vectors in two distinctive styles:

  1. vec2(X, Y)
  2. (X, Y)

Glimpses 🌌

// Vector 2D Illustration
(4, 3)

In this snippet, (4, 3) brings to life a 2D vector, with X whispering 4 and Y murmuring 3.

// Vector 2D Division Glimpse
(4, 3) / (2, 1.5)

This dance results in the harmonious (2, 2).

Arcane Functions 🎩

Vector 2D isn't just about magnitude and direction; it's enchanted with functions like:

  • LengthSq
  • DistanceSq
  • Length
  • Distance
  • Normalise
  • Dot
  • AngleBetween
  • Cross
  • Lerp

Vector 3 - Delving into Depth 🌊

Sail into the oceanic expanse of 3D vector mathematics. Conjure these vectors using:

  1. vec3(X, Y, Z)
  2. (X, Y, Z)

Glimpses 🌌

// Vector 3D Illustration
(1, 2, 3)

This vignette conjures a 3D vector with X whispering 1, Y singing 2, and Z echoing 3.

Arcane Functions 🎩

Functions for Vector 3 are yet to be etched in the annals of this provider.

Vector 4 - Journey Beyond the Horizon 🌌

Venture into the vast void with 4D vector mathematics. Craft these vectors as:

  1. vec4(X, Y, Z, W)
  2. (X, Y, Z, W)

Glimpses 🌌

// Vector 4D Illustration
(1, 2, 3, 4)

In this canvas, (1, 2, 3, 4) paints a 4D vector with dimensions singing in 1, 2, 3, and 4.

Arcane Functions 🎩

For the 4D vectors, the magic is weaved through functions like:

  • LengthSq
  • DistanceSq
  • Length
  • Distance
  • Dot
  • Lerp