From ba2f90e6794834c035718525da03b16398554f15 Mon Sep 17 00:00:00 2001 From: ffrostfall <80861876+ffrostflame@users.noreply.github.com> Date: Mon, 13 May 2024 18:52:16 -0400 Subject: [PATCH] Switch norm and normalized again --- docs/vector-library.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/vector-library.md b/docs/vector-library.md index 6eab8fb..6d6b834 100644 --- a/docs/vector-library.md +++ b/docs/vector-library.md @@ -28,7 +28,7 @@ Due to the common usage of vectors, vector creation should be ergonomic. Therefo Calculates the magnitude of a given vector. -`vector.norm(vec: vector): vector` +`vector.normalized(vec: vector): vector` Returns the normalized version (aka unit vector) of a given vector. If a zero vector is passed, return `0`. `vector(0, 0, 0):normalized()` should return zero. @@ -109,5 +109,3 @@ Another alternative to vector creation is special syntax for creating buffers, s Instead of `vector.magnitude`, the magnitude could be derived from the vector's coordinates themselves, and be accessed by a property instead of a function. There is a downside to this: all current properties of vectors are hard-coded to the VM, so any new property to vectors requires a lot of additional complexity & changes to the VM to allow for this. A library function, however, would be trivial. An easy and quick workaround to the verbosity would be at the runtime/C API level. It's trivial to set the metatable of vectors to be the vector library: this allows for `vec:magnitude()` without much issue. Instead of ignoring the 4th dimension in `vector.cross`, the function could be disabled when four-dimensional vectors are enabled. - -While "norm" is the proper math term for a normalized vector, `vector.normalized` is more explicit to those who aren't as familiar with math terminology.