mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Switch norm and normalized again
This commit is contained in:
parent
364d2be862
commit
ba2f90e679
1 changed files with 1 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue