Skip to content
MrNex edited this page Jun 28, 2015 · 11 revisions

If there is one single thing any NGen Developer is going to need to know, it is how to interface with the mathematics library used in NGen. There are two main components of this library, Vector and Matrix. Both are used for a myriad of things, the applications of these structures are endless. And they both share a common layout.

Structures or Arrays

Every structure in the Mathematics library has two sets of functions.

The first set, and the set I prefer developers use, is the Structure-Based functions. These take the Mathematics structures, Vectors and Matrices, as arguments, they provide error checking, and will print error messages in the case a mistake is made rather than carrying on with execution!

The second set is the Array-Based functions. These take arrays of floats and a few extra arguments allowing for maximum flexibility of the Mathematics structures. These functions will not perform error checking, however they will be slightly faster and more memory efficient (Take my word-- it is not worth it). However, it does allow you to take arrays of floats and manipulate them as if they were vectors or matrices- and this comes in handy if you ever need to manipulate an array of floats in a certain way that is already defined under a Vectors or Matrix operation. It may be worth noting that under the hood, after error checking, the structure based function set does call the corresponding array function.