/godot-linalg

Linear Algebra library in GDScript for Godot Engine. Also available as C++ GDNative plugin!

Primary LanguageC++MIT LicenseMIT

godot-linalg

Linear Algebra library in GDScript for Godot Engine.

For documentation about the GDNative plugin, check README_GDNATIVE.md.
For information on how to build the GDNative plugin, check HOW_TO_BUILD.md.

All methods are optimised for maximum speed. They take arrays and assume the right dimension for them. If the inputs aren't right they'll crash. Third input is used for the answer, preallocated.

Just use the method appropriate to the situation. The names are coded to reflect that: s = scalar, v = vector and m = matrix. So for example

dot_mv(M, v)

is a dot product between a matrix and a vector (in that order). Wherever the in_place argument is provided, it is possible to perform the operation on the object itself instead of instantiating a new one (this too optimises performance). So for example

transpose(M, true)

will turn M into its own transpose by reference, whereas

MT = transpose(M)

will leave M unaltered.

Most method names are self-explanatory. The less intuitive are: